[−][src]Trait acap::distance::Distance
A distance between two points.
An implementation may be an actual numerical distance, or an order embedding of the true
distance. This allows for optimizations whenever distances can be compared more efficiently
than their exact values can be computed. Implementors must satisfy, for all distances $x$
and
$y$
:
\begin{aligned}
x.\mathrm{value}() &< y.\mathrm{value}() & &\iff& x.\mathrm{value}() &< y \\
& & &\iff& x &< y.\mathrm{value}() \\
& & &\iff& x &< y
\end{aligned}
Any monotonically increasing function can be used to create an order embedding. For example,
EuclideanDistance
holds a squared distance, rather than the distance itself. Comparisons
still behave correctly because $x \mapsto x^2$
is an increasing function. This lets us avoid
computing relatively expensive square roots until we need the value()
itself, at which point
the inverse function $x \mapsto \sqrt{x}$
must be applied.
Associated Types
Loading content...Provided methods
Loading content...Implementors
impl Distance for AngularDistance<f32>
[src]
impl Distance for AngularDistance<f64>
[src]
impl Distance for EuclideanDistance<f32>
[src]
impl Distance for EuclideanDistance<f64>
[src]
impl Distance for EuclideanDistance<i16>
[src]
impl Distance for EuclideanDistance<i32>
[src]
impl Distance for EuclideanDistance<i64>
[src]
impl Distance for EuclideanDistance<isize>
[src]
impl<T: Value> Distance for T
[src]
Any numerical distance value can be a Distance
.