[−][src]Trait vector2math::Vector2
Trait for manipulating 2D vectors
Associated Types
Loading content...Required methods
fn x(self) -> Self::Scalar
Get the x component
fn y(self) -> Self::Scalar
Get the y component
fn new(x: Self::Scalar, y: Self::Scalar) -> Self
Create a new vector from an x and y component
Provided methods
fn set_x(&mut self, x: Self::Scalar)
Set the x component
fn set_y(&mut self, y: Self::Scalar)
Set the y component
fn with_x(self, x: Self::Scalar) -> Self
Get this vector with a different x component
fn with_y(self, y: Self::Scalar) -> Self
Get this vector with a different y component
fn square(s: Self::Scalar) -> Self
Create a new square vector
fn map<V>(self) -> V where
V: Vector2,
V::Scalar: From<Self::Scalar>,
V: Vector2,
V::Scalar: From<Self::Scalar>,
Map this vector to a vector of another type
fn map_f32(self) -> [f32; 2] where
f32: From<Self::Scalar>,
f32: From<Self::Scalar>,
Map this vector to a [f32;2]
This is an alias for Vector2::map::<[f32;2]>() that is more concise
fn map_f64(self) -> [f64; 2] where
f64: From<Self::Scalar>,
f64: From<Self::Scalar>,
Map this vector to a [f64;2]
This is an alias for Vector2::map::<[f64;2]>() that is more concise
fn map_with<V, F>(self, f: F) -> V where
V: Vector2,
F: FnMut(Self::Scalar) -> V::Scalar,
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>,
Self::Scalar: Neg<Output = Self::Scalar>,
Negate the vector
fn add(self, other: Self) -> Self
Add this vector to another
fn sub(self, other: Self) -> Self
Subtract another vector from this one
fn mul(self, by: Self::Scalar) -> Self
Multiply this vector by a scalar
fn mul2(self, other: Self) -> Self
Multiply this vector component-wise by another
fn div(self, by: Self::Scalar) -> Self
Divide this vector by a scalar
fn div2(self, other: Self) -> Self
Divide this vector component-wise by another
fn add_assign(&mut self, other: Self)
Add another vector into this one
fn sub_assign(&mut self, other: Self)
Subtract another vector into this one
fn mul_assign(&mut self, by: Self::Scalar)
Multiply a scalar into this vector
fn mul2_assign(&mut self, other: Self)
Multiply another vector component-wise into this one
fn div_assign(&mut self, by: Self::Scalar)
Divide a scalar into this vector
fn div2_assign(&mut self, other: Self)
Divide another vector component-wise into this one
fn max_dim(self) -> Self::Scalar
Get the value of the dimension with the higher magnitude
fn min_dim(self) -> Self::Scalar
Get the value of the dimension with the lower magnitude
fn dot<V>(self, other: V) -> Self::Scalar where
V: Vector2<Scalar = Self::Scalar>,
V: Vector2<Scalar = Self::Scalar>,
Get the dot product of this vector and another
Implementors
impl Vector2 for f32x2[src]
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 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]
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 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]
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 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]
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 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]
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 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]
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 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]
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 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]
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 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]
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 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]
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 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,