Trait cgmath::prelude::MetricSpace
[−]
[src]
pub trait MetricSpace: Sized { type Metric: BaseFloat; fn distance2(self, other: Self) -> Self::Metric; fn distance(self, other: Self) -> Self::Metric { ... } }
A type with a distance function between values.
Examples are vectors, points, and quaternions.
Associated Types
Required Methods
fn distance2(self, other: Self) -> Self::Metric
Returns the squared distance.
This does not perform an expensive square root operation like in
MetricSpace::distance
method, and so can be used to compare distances
more efficiently.
Provided Methods
Implementors
impl<S: BaseFloat> MetricSpace for Quaternion<S>
impl<S: BaseFloat> MetricSpace for Vector1<S>
impl<S: BaseFloat> MetricSpace for Vector2<S>
impl<S: BaseFloat> MetricSpace for Vector3<S>
impl<S: BaseFloat> MetricSpace for Vector4<S>
impl<S: BaseFloat> MetricSpace for Point1<S>
impl<S: BaseFloat> MetricSpace for Point2<S>
impl<S: BaseFloat> MetricSpace for Point3<S>