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§

source

type Coord: Num + Copy + PartialOrd

The type of the coordinate values

Required Associated Constants§

source

const DIM: usize

The dimension of the underlying space

Required Methods§

source

fn coord(&self, axis: usize) -> Self::Coord

Access the coordinate value of the point along the given axis

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> Point for [T; N]where T: Num + Copy + PartialOrd,

N-dimensional space using Euclidean distance

source§

const DIM: usize = N

§

type Coord = T

source§

fn coord(&self, axis: usize) -> Self::Coord

source§

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

Implementors§