Trait vector2math::Vector2 [−][src]
Trait for manipulating 2D vectors
Associated Types
Loading content...Required methods
fn x(&self) -> Self::Scalar
[src]
Get the x component
fn y(&self) -> Self::Scalar
[src]
Get the y component
fn new(x: Self::Scalar, y: Self::Scalar) -> Self
[src]
Create a new vector from an x and y component
Provided methods
fn set_x(&mut self, x: Self::Scalar)
[src]
Set the x component
fn set_y(&mut self, y: Self::Scalar)
[src]
Set the y component
fn with_x(self, x: Self::Scalar) -> Self
[src]
Get this vector with a different x component
fn with_y(self, y: Self::Scalar) -> Self
[src]
Get this vector with a different y component
fn square(s: Self::Scalar) -> Self
[src]
Create a new square vector
fn map_into<V>(self) -> V where
V: Vector2,
V::Scalar: From<Self::Scalar>,
[src]
V: Vector2,
V::Scalar: From<Self::Scalar>,
Map this vector to a vector of another type
fn map_vec2(self) -> [Self::Scalar; 2]
[src]
Map this vector to a [Self::Scalar; 2]
This is an alias for Vector2::map_into::<[Self::Scalar; 2]>()
that is more concise
fn map_dims<F>(self, f: F) -> Self where
F: FnMut(Self::Scalar) -> Self::Scalar,
[src]
F: FnMut(Self::Scalar) -> Self::Scalar,
Map the individual components of this vector
fn map_with<V, F>(self, f: F) -> V where
V: Vector2,
F: FnMut(Self::Scalar) -> V::Scalar,
[src]
V: Vector2,
F: FnMut(Self::Scalar) -> V::Scalar,
Map this vector to a vector of another type using a function
fn neg(self) -> Self where
Self::Scalar: Neg<Output = Self::Scalar>,
[src]
Self::Scalar: Neg<Output = Self::Scalar>,
Negate the vector
fn add(self, other: Self) -> Self
[src]
Add this vector to another
fn sub(self, other: Self) -> Self
[src]
Subtract another vector from this one
fn mul(self, by: Self::Scalar) -> Self
[src]
Multiply this vector by a scalar
fn mul2(self, other: Self) -> Self
[src]
Multiply this vector component-wise by another
fn div(self, by: Self::Scalar) -> Self
[src]
Divide this vector by a scalar
fn div2(self, other: Self) -> Self
[src]
Divide this vector component-wise by another
fn add_assign(&mut self, other: Self)
[src]
Add another vector into this one
fn sub_assign(&mut self, other: Self)
[src]
Subtract another vector into this one
fn mul_assign(&mut self, by: Self::Scalar)
[src]
Multiply a scalar into this vector
fn mul2_assign(&mut self, other: Self)
[src]
Multiply another vector component-wise into this one
fn div_assign(&mut self, by: Self::Scalar)
[src]
Divide a scalar into this vector
fn div2_assign(&mut self, other: Self)
[src]
Divide another vector component-wise into this one
fn max_dim(self) -> Self::Scalar
[src]
Get the value of the dimension with the higher magnitude
fn min_dim(self) -> Self::Scalar
[src]
Get the value of the dimension with the lower magnitude
fn dot(self, other: Self) -> Self::Scalar
[src]
Get the dot product of this vector and another
Implementors
impl Vector2 for f32x2
[src]
simd
only.type Scalar = f32
fn new(x: Self::Scalar, y: Self::Scalar) -> Self
[src]
fn x(&self) -> Self::Scalar
[src]
fn y(&self) -> Self::Scalar
[src]
fn with_x(self, x: f32) -> Self
[src]
fn with_y(self, y: f32) -> Self
[src]
fn square(s: Self::Scalar) -> Self
[src]
fn add(self, other: Self) -> Self
[src]
fn sub(self, other: Self) -> Self
[src]
fn mul2(self, other: Self) -> Self
[src]
fn div2(self, other: Self) -> Self
[src]
fn add_assign(&mut self, other: Self)
[src]
fn sub_assign(&mut self, other: Self)
[src]
fn mul2_assign(&mut self, other: Self)
[src]
fn div2_assign(&mut self, other: Self)
[src]
impl Vector2 for f64x2
[src]
simd
only.type Scalar = f64
fn new(x: Self::Scalar, y: Self::Scalar) -> Self
[src]
fn x(&self) -> Self::Scalar
[src]
fn y(&self) -> Self::Scalar
[src]
fn with_x(self, x: f64) -> Self
[src]
fn with_y(self, y: f64) -> Self
[src]
fn square(s: Self::Scalar) -> Self
[src]
fn add(self, other: Self) -> Self
[src]
fn sub(self, other: Self) -> Self
[src]
fn mul2(self, other: Self) -> Self
[src]
fn div2(self, other: Self) -> Self
[src]
fn add_assign(&mut self, other: Self)
[src]
fn sub_assign(&mut self, other: Self)
[src]
fn mul2_assign(&mut self, other: Self)
[src]
fn div2_assign(&mut self, other: Self)
[src]
impl Vector2 for i8x2
[src]
simd
only.type Scalar = i8
fn new(x: Self::Scalar, y: Self::Scalar) -> Self
[src]
fn x(&self) -> Self::Scalar
[src]
fn y(&self) -> Self::Scalar
[src]
fn with_x(self, x: i8) -> Self
[src]
fn with_y(self, y: i8) -> Self
[src]
fn square(s: Self::Scalar) -> Self
[src]
fn add(self, other: Self) -> Self
[src]
fn sub(self, other: Self) -> Self
[src]
fn mul2(self, other: Self) -> Self
[src]
fn div2(self, other: Self) -> Self
[src]
fn add_assign(&mut self, other: Self)
[src]
fn sub_assign(&mut self, other: Self)
[src]
fn mul2_assign(&mut self, other: Self)
[src]
fn div2_assign(&mut self, other: Self)
[src]
impl Vector2 for i16x2
[src]
simd
only.type Scalar = i16
fn new(x: Self::Scalar, y: Self::Scalar) -> Self
[src]
fn x(&self) -> Self::Scalar
[src]
fn y(&self) -> Self::Scalar
[src]
fn with_x(self, x: i16) -> Self
[src]
fn with_y(self, y: i16) -> Self
[src]
fn square(s: Self::Scalar) -> Self
[src]
fn add(self, other: Self) -> Self
[src]
fn sub(self, other: Self) -> Self
[src]
fn mul2(self, other: Self) -> Self
[src]
fn div2(self, other: Self) -> Self
[src]
fn add_assign(&mut self, other: Self)
[src]
fn sub_assign(&mut self, other: Self)
[src]
fn mul2_assign(&mut self, other: Self)
[src]
fn div2_assign(&mut self, other: Self)
[src]
impl Vector2 for i32x2
[src]
simd
only.type Scalar = i32
fn new(x: Self::Scalar, y: Self::Scalar) -> Self
[src]
fn x(&self) -> Self::Scalar
[src]
fn y(&self) -> Self::Scalar
[src]
fn with_x(self, x: i32) -> Self
[src]
fn with_y(self, y: i32) -> Self
[src]
fn square(s: Self::Scalar) -> Self
[src]
fn add(self, other: Self) -> Self
[src]
fn sub(self, other: Self) -> Self
[src]
fn mul2(self, other: Self) -> Self
[src]
fn div2(self, other: Self) -> Self
[src]
fn add_assign(&mut self, other: Self)
[src]
fn sub_assign(&mut self, other: Self)
[src]
fn mul2_assign(&mut self, other: Self)
[src]
fn div2_assign(&mut self, other: Self)
[src]
impl Vector2 for i64x2
[src]
simd
only.type Scalar = i64
fn new(x: Self::Scalar, y: Self::Scalar) -> Self
[src]
fn x(&self) -> Self::Scalar
[src]
fn y(&self) -> Self::Scalar
[src]
fn with_x(self, x: i64) -> Self
[src]
fn with_y(self, y: i64) -> Self
[src]
fn square(s: Self::Scalar) -> Self
[src]
fn add(self, other: Self) -> Self
[src]
fn sub(self, other: Self) -> Self
[src]
fn mul2(self, other: Self) -> Self
[src]
fn div2(self, other: Self) -> Self
[src]
fn add_assign(&mut self, other: Self)
[src]
fn sub_assign(&mut self, other: Self)
[src]
fn mul2_assign(&mut self, other: Self)
[src]
fn div2_assign(&mut self, other: Self)
[src]
impl Vector2 for u8x2
[src]
simd
only.type Scalar = u8
fn new(x: Self::Scalar, y: Self::Scalar) -> Self
[src]
fn x(&self) -> Self::Scalar
[src]
fn y(&self) -> Self::Scalar
[src]
fn with_x(self, x: u8) -> Self
[src]
fn with_y(self, y: u8) -> Self
[src]
fn square(s: Self::Scalar) -> Self
[src]
fn add(self, other: Self) -> Self
[src]
fn sub(self, other: Self) -> Self
[src]
fn mul2(self, other: Self) -> Self
[src]
fn div2(self, other: Self) -> Self
[src]
fn add_assign(&mut self, other: Self)
[src]
fn sub_assign(&mut self, other: Self)
[src]
fn mul2_assign(&mut self, other: Self)
[src]
fn div2_assign(&mut self, other: Self)
[src]
impl Vector2 for u16x2
[src]
simd
only.type Scalar = u16
fn new(x: Self::Scalar, y: Self::Scalar) -> Self
[src]
fn x(&self) -> Self::Scalar
[src]
fn y(&self) -> Self::Scalar
[src]
fn with_x(self, x: u16) -> Self
[src]
fn with_y(self, y: u16) -> Self
[src]
fn square(s: Self::Scalar) -> Self
[src]
fn add(self, other: Self) -> Self
[src]
fn sub(self, other: Self) -> Self
[src]
fn mul2(self, other: Self) -> Self
[src]
fn div2(self, other: Self) -> Self
[src]
fn add_assign(&mut self, other: Self)
[src]
fn sub_assign(&mut self, other: Self)
[src]
fn mul2_assign(&mut self, other: Self)
[src]
fn div2_assign(&mut self, other: Self)
[src]
impl Vector2 for u32x2
[src]
simd
only.type Scalar = u32
fn new(x: Self::Scalar, y: Self::Scalar) -> Self
[src]
fn x(&self) -> Self::Scalar
[src]
fn y(&self) -> Self::Scalar
[src]
fn with_x(self, x: u32) -> Self
[src]
fn with_y(self, y: u32) -> Self
[src]
fn square(s: Self::Scalar) -> Self
[src]
fn add(self, other: Self) -> Self
[src]
fn sub(self, other: Self) -> Self
[src]
fn mul2(self, other: Self) -> Self
[src]
fn div2(self, other: Self) -> Self
[src]
fn add_assign(&mut self, other: Self)
[src]
fn sub_assign(&mut self, other: Self)
[src]
fn mul2_assign(&mut self, other: Self)
[src]
fn div2_assign(&mut self, other: Self)
[src]
impl Vector2 for u64x2
[src]
simd
only.type Scalar = u64
fn new(x: Self::Scalar, y: Self::Scalar) -> Self
[src]
fn x(&self) -> Self::Scalar
[src]
fn y(&self) -> Self::Scalar
[src]
fn with_x(self, x: u64) -> Self
[src]
fn with_y(self, y: u64) -> Self
[src]
fn square(s: Self::Scalar) -> Self
[src]
fn add(self, other: Self) -> Self
[src]
fn sub(self, other: Self) -> Self
[src]
fn mul2(self, other: Self) -> Self
[src]
fn div2(self, other: Self) -> Self
[src]
fn add_assign(&mut self, other: Self)
[src]
fn sub_assign(&mut self, other: Self)
[src]
fn mul2_assign(&mut self, other: Self)
[src]
fn div2_assign(&mut self, other: Self)
[src]
impl<P> Vector2 for P where
P: Pair + Copy,
P::Item: Scalar,
[src]
P: Pair + Copy,
P::Item: Scalar,