Trait Distance

Source
pub trait Distance: Point {
    // Required method
    fn distance_2(&self, other: &Self) -> Self::Coord;
}
Expand description

Extends the Point trait by a distance metric required for nearest neighbour search

Required Methods§

Source

fn distance_2(&self, other: &Self) -> Self::Coord

Return the squared distance between self and other

This is called during nearest neighbour search and hence only the relation between two distance values is required so that computing square roots can be avoided.

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.

Implementations on Foreign Types§

Source§

impl<T, const N: usize> Distance for [T; N]
where T: Num + Copy + PartialOrd,

Source§

fn distance_2(&self, other: &Self) -> Self::Coord

Implementors§