pub trait InnerSpace:
VectorSpace
+ MetricSpace<Metric = Self::Scalar>
+ UlpsEq<Epsilon = Self::Scalar>{
// Required method
fn dot(self, other: Self) -> Self::Scalar;
// Provided methods
fn is_perpendicular(self, other: Self) -> bool { ... }
fn magnitude2(self) -> Self::Scalar { ... }
fn magnitude(self) -> Self::Scalar { ... }
fn angle(self, other: Self) -> Rad<Self::Scalar> { ... }
fn normalize(self) -> Self { ... }
fn normalize_to(self, magnitude: Self::Scalar) -> Self { ... }
fn project_on(self, other: Self) -> Self { ... }
}
Expand description
Required Methods§
Provided Methods§
Sourcefn is_perpendicular(self, other: Self) -> bool
fn is_perpendicular(self, other: Self) -> bool
Returns true
if the vector is perpendicular (at right angles) to the
other vector.
Sourcefn magnitude2(self) -> Self::Scalar
fn magnitude2(self) -> Self::Scalar
Returns the squared magnitude.
This does not perform an expensive square root operation like in
InnerSpace::magnitude
method, and so can be used to compare magnitudes
more efficiently.
Sourcefn angle(self, other: Self) -> Rad<Self::Scalar>
fn angle(self, other: Self) -> Rad<Self::Scalar>
Returns the angle between two vectors in radians.
Sourcefn normalize(self) -> Self
fn normalize(self) -> Self
Returns a vector with the same direction, but with a magnitude of 1
.
Sourcefn normalize_to(self, magnitude: Self::Scalar) -> Self
fn normalize_to(self, magnitude: Self::Scalar) -> Self
Returns a vector with the same direction and a given magnitude.
Sourcefn project_on(self, other: Self) -> Self
fn project_on(self, other: Self) -> Self
Returns the vector projection of the current inner space projected onto the supplied argument.
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.