Trait sif_rtree::Distance

source ·
pub trait Distance<P>
where P: Point,
{ // Required method fn distance_2(&self, point: &P) -> P::Coord; // Provided method fn contains(&self, point: &P) -> bool { ... } }
Expand description

Defines a distance metric between a type (objects, points, AABB, etc.) and points

Required Methods§

source

fn distance_2(&self, point: &P) -> P::Coord

Return the squared distance between self and point

Generally, only the relation between two distance values is required so that computing square roots can be avoided.

Provided Methods§

source

fn contains(&self, point: &P) -> bool

Checks whether self contains point

The default implementation just checks whether the squared distance is zero.

Implementations on Foreign Types§

source§

impl<P> Distance<P> for (P, P)
where P: Point + Distance<P>,

source§

fn distance_2(&self, point: &P) -> P::Coord

source§

fn contains(&self, point: &P) -> bool

source§

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

source§

fn distance_2(&self, point: &[T; N]) -> T

Implementors§