InnerSpace

Trait InnerSpace 

Source
pub trait InnerSpace: DotProduct<Output = <Self as VectorSpace>::Scalar> {
Show 13 methods // Provided methods fn magnitude2(&self) -> Self::Scalar { ... } fn magnitude(&self) -> Self::Scalar { ... } fn normalize(self) -> Self { ... } fn angle(&self, other: &Self) -> Self::Scalar { ... } fn with_magnitude(self, magnitude: Self::Scalar) -> Self { ... } fn with_direction(self, dir: Self) -> Self { ... } fn query_axis(&self, dir: Self) -> Self::Scalar { ... } fn normalized_project(self, dir: Self) -> Self { ... } fn project(self, dir: Self) -> Self { ... } fn normalized_reject(self, dir: Self) -> Self { ... } fn reject(self, dir: Self) -> Self { ... } fn normalized_reflect(self, dir: Self) -> Self { ... } fn reflect(self, dir: Self) -> Self { ... }
}
Expand description

This trait adds common vector operations to a vector space if the dot product is defined.

Provided Methods§

Source

fn magnitude2(&self) -> Self::Scalar

The squared magnitude.

This is more efficient than calculating the magnitude. Useful if you need the squared magnitude anyway.

Source

fn magnitude(&self) -> Self::Scalar

The magnitude of a vector.

Source

fn normalize(self) -> Self

The normalized vector.

Source

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

The angle between two vectors.

Source

fn with_magnitude(self, magnitude: Self::Scalar) -> Self

Sets the magnitude of a vector.

Source

fn with_direction(self, dir: Self) -> Self

Sets the direction of a vector.

Source

fn query_axis(&self, dir: Self) -> Self::Scalar

The value of the vector along the specified axis.

Source

fn normalized_project(self, dir: Self) -> Self

Projects a vector onto an already normalized direction vector.

Source

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

Projects a vector onto the specified direction vector.

Source

fn normalized_reject(self, dir: Self) -> Self

Rejects a vector from an already normalized direction vector.

Source

fn reject(self, dir: Self) -> Self

Rejects a vector from the specified direction vector.

Source

fn normalized_reflect(self, dir: Self) -> Self

Reflects a vector from an already normalized direction vector.

Source

fn reflect(self, dir: Self) -> Self

Reflects a vector from the specified direction vector.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T: DotProduct<Output = Self::Scalar>> InnerSpace for T