re_types/components/
vector2d_ext.rs

1use super::Vector2D;
2
3impl Vector2D {
4    /// The zero vector, i.e. the additive identity.
5    pub const ZERO: Self = Self(crate::datatypes::Vec2D::ZERO);
6
7    /// `[1, 1]`, i.e. the multiplicative identity.
8    pub const ONE: Self = Self(crate::datatypes::Vec2D::ONE);
9}
10
11#[cfg(feature = "glam")]
12impl From<Vector2D> for glam::Vec2 {
13    #[inline]
14    fn from(v: Vector2D) -> Self {
15        Self::new(v.x(), v.y())
16    }
17}
18
19#[cfg(feature = "mint")]
20impl From<Vector2D> for mint::Vector2<f32> {
21    #[inline]
22    fn from(v: Vector2D) -> Self {
23        Self { x: v.x(), y: v.y() }
24    }
25}