pub trait DistanceMetric<T: SpatialScalar, P: SpatialPoint<T>> {
// Required methods
fn distance(&self, p1: &P, p2: &P) -> T;
fn name(&self) -> &'static str;
// Provided methods
fn squared_distance(&self, p1: &P, p2: &P) -> Option<T> { ... }
fn is_metric(&self) -> bool { ... }
}Expand description
Trait for distance metrics
Required Methods§
Provided Methods§
Sourcefn squared_distance(&self, p1: &P, p2: &P) -> Option<T>
fn squared_distance(&self, p1: &P, p2: &P) -> Option<T>
Calculate squared distance (if applicable, for efficiency)