Trait sif_kdtree::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.

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§