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§

source

fn from_angle(radians: Self::Scalar) -> Self

Create a new unit vector from the given angle in radians

source

fn dist(self, to: Self) -> Self::Scalar

Get the distance between this vector and another

source

fn squared_dist(self, to: Self) -> Self::Scalar

Get the squared distance between this vector and another

source

fn mag(self) -> Self::Scalar

Get the vector’s magnitude

source

fn squared_mag(self) -> Self::Scalar

Get the vector’s squared magnitude

source

fn unit(self) -> Self

Get the unit vector

source

fn rotate(self, radians: Self::Scalar) -> Self

Rotate the vector some number of radians about the origin

source

fn rotate_about(self, radians: Self::Scalar, pivot: Self) -> Self

Rotate the vector some number of radians about a pivot

source

fn lerp(self, other: Self, t: Self::Scalar) -> Self

Linear interpolate the vector with another

source

fn atan(self) -> Self::Scalar

Get the arctangent of the vector, which corresponds to the angle it represents bounded between -π to π

source

fn transform<T>(self, transform: T) -> Selfwhere T: Transform<Scalar = Self::Scalar>,

Apply a transform to the vector

source

fn project(self, other: Self) -> Self

Project this vector onto another

Implementors§