Trait vector2math::FloatingVector2
source · pub trait FloatingVector2: Vector2where
Self::Scalar: FloatingScalar,{
// Provided methods
fn from_angle(radians: Self::Scalar) -> Self { ... }
fn dist(self, to: Self) -> Self::Scalar { ... }
fn squared_dist(self, to: Self) -> Self::Scalar { ... }
fn mag(self) -> Self::Scalar { ... }
fn squared_mag(self) -> Self::Scalar { ... }
fn unit(self) -> Self { ... }
fn rotate(self, radians: Self::Scalar) -> Self { ... }
fn rotate_about(self, radians: Self::Scalar, pivot: Self) -> Self { ... }
fn lerp(self, other: Self, t: Self::Scalar) -> Self { ... }
fn atan(self) -> Self::Scalar { ... }
fn transform<T>(self, transform: T) -> Self
where T: Transform<Scalar = Self::Scalar> { ... }
fn project(self, other: Self) -> Self { ... }
}
Expand description
Trait for manipulating floating-point 2D vectors
Provided Methods§
sourcefn from_angle(radians: Self::Scalar) -> Self
fn from_angle(radians: Self::Scalar) -> Self
Create a new unit vector from the given angle in radians
sourcefn squared_dist(self, to: Self) -> Self::Scalar
fn squared_dist(self, to: Self) -> Self::Scalar
Get the squared distance between this vector and another
sourcefn squared_mag(self) -> Self::Scalar
fn squared_mag(self) -> Self::Scalar
Get the vector’s squared magnitude
sourcefn rotate(self, radians: Self::Scalar) -> Self
fn rotate(self, radians: Self::Scalar) -> Self
Rotate the vector some number of radians about the origin
sourcefn rotate_about(self, radians: Self::Scalar, pivot: Self) -> Self
fn rotate_about(self, radians: Self::Scalar, pivot: Self) -> Self
Rotate the vector some number of radians about a pivot
sourcefn atan(self) -> Self::Scalar
fn atan(self) -> Self::Scalar
Get the arctangent of the vector, which corresponds to the angle it represents bounded between -π to π