pub trait EuclideanVector: Vector + Sizedwhere
    <Self as Vector>::Scalar: BaseFloat,
    Self: ApproxEq<Epsilon = <Self as Vector>::Scalar>,{
    // Required method
    fn angle(self, other: Self) -> Rad<Self::Scalar>;

    // Provided methods
    fn is_perpendicular(self, other: Self) -> bool { ... }
    fn length2(self) -> Self::Scalar { ... }
    fn length(self) -> Self::Scalar { ... }
    fn normalize(self) -> Self { ... }
    fn normalize_to(self, length: Self::Scalar) -> Self { ... }
    fn lerp(self, other: Self, amount: Self::Scalar) -> Self { ... }
    fn normalize_self(&mut self) { ... }
    fn normalize_self_to(&mut self, length: Self::Scalar) { ... }
    fn lerp_self(&mut self, other: Self, amount: Self::Scalar) { ... }
}
Expand description

Specifies geometric operations for vectors. This is only implemented for 2-dimensional and 3-dimensional vectors.

Required Methods§

source

fn angle(self, other: Self) -> Rad<Self::Scalar>

The angle between the vector and other, in radians.

Provided Methods§

source

fn is_perpendicular(self, other: Self) -> bool

Returns true if the vector is perpendicular (at right angles) to the other vector.

source

fn length2(self) -> Self::Scalar

Returns the squared length of the vector. This does not perform an expensive square root operation like in the length method and can therefore be more efficient for comparing the lengths of two vectors.

source

fn length(self) -> Self::Scalar

The norm of the vector.

source

fn normalize(self) -> Self

Returns a vector with the same direction, but with a length (or norm) of 1.

source

fn normalize_to(self, length: Self::Scalar) -> Self

Returns a vector with the same direction and a given length.

source

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

Returns the result of linarly interpolating the length of the vector towards the length of other by the specified amount.

source

fn normalize_self(&mut self)

Normalises the vector to a length of 1.

source

fn normalize_self_to(&mut self, length: Self::Scalar)

Normalizes the vector to length.

source

fn lerp_self(&mut self, other: Self, amount: Self::Scalar)

Linearly interpolates the length of the vector towards the length of other by the specified amount.

Implementors§