Trait truck_geometry::base::cgmath::prelude::MetricSpace

source ·
pub trait MetricSpace: Sized {
    type Metric;

    // Required method
    fn distance2(self, other: Self) -> Self::Metric;

    // Provided method
    fn distance(self, other: Self) -> Self::Metric
       where Self::Metric: Float { ... }
}
Expand description

A type with a distance function between values.

Examples are vectors, points, and quaternions.

Required Associated Types§

source

type Metric

The metric to be returned by the distance function.

Required Methods§

source

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§

source

fn distance(self, other: Self) -> Self::Metric
where Self::Metric: Float,

The distance between two values.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<S> MetricSpace for Point1<S>
where S: BaseFloat,

source§

impl<S> MetricSpace for Point2<S>
where S: BaseFloat,

source§

impl<S> MetricSpace for Point3<S>
where S: BaseFloat,

source§

impl<S> MetricSpace for Quaternion<S>
where S: BaseFloat,

source§

impl<S> MetricSpace for Vector1<S>
where S: BaseNum,

source§

impl<S> MetricSpace for Vector2<S>
where S: BaseNum,

source§

impl<S> MetricSpace for Vector3<S>
where S: BaseNum,

source§

impl<S> MetricSpace for Vector4<S>
where S: BaseNum,