Trait vector_space::InnerSpace
source · pub trait InnerSpace: VectorSpace {
Show 14 methods
// Required method
fn scalar(self, other: Self) -> Self::Scalar;
// 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 defines the scalar product and adds commom vector operations.
Required Methods§
Provided Methods§
sourcefn magnitude2(self) -> Self::Scalar
fn magnitude2(self) -> Self::Scalar
The squared magnitude.
This is more efficient than calculating the magnitude. Useful if you need the squared magnitude anyway.
sourcefn with_magnitude(self, magnitude: Self::Scalar) -> Self
fn with_magnitude(self, magnitude: Self::Scalar) -> Self
Sets the magnitude of a vector.
sourcefn with_direction(self, dir: Self) -> Self
fn with_direction(self, dir: Self) -> Self
Sets the direction of a vector.
sourcefn query_axis(self, dir: Self) -> Self::Scalar
fn query_axis(self, dir: Self) -> Self::Scalar
The value of the vector along the specified axis.
sourcefn normalized_project(self, dir: Self) -> Self
fn normalized_project(self, dir: Self) -> Self
Projects a vector onto an already normalized direction vector.
sourcefn normalized_reject(self, dir: Self) -> Self
fn normalized_reject(self, dir: Self) -> Self
Rejects a vector from an already normalized direction vector.
sourcefn normalized_reflect(self, dir: Self) -> Self
fn normalized_reflect(self, dir: Self) -> Self
Reflects a vector from an already normalized direction vector.
Object Safety§
This trait is not object safe.