Trait sif_kdtree::Point
source · pub trait Point {
type Coord: Num + Copy + PartialOrd;
const DIM: usize;
// Required methods
fn coord(&self, axis: usize) -> Self::Coord;
fn distance_2(&self, other: &Self) -> Self::Coord;
}
Expand description
Defines a finite-dimensional space in terms of coordinate values along a chosen set of axes
Required Associated Types§
sourcetype Coord: Num + Copy + PartialOrd
type Coord: Num + Copy + PartialOrd
The type of the coordinate values
Required Associated Constants§
Required Methods§
sourcefn coord(&self, axis: usize) -> Self::Coord
fn coord(&self, axis: usize) -> Self::Coord
Access the coordinate value of the point along the given axis
sourcefn distance_2(&self, other: &Self) -> Self::Coord
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> Point for [T; N]where
T: Num + Copy + PartialOrd,
impl<T, const N: usize> Point for [T; N]where T: Num + Copy + PartialOrd,
N
-dimensional space using Euclidean distance