summaryrefslogtreecommitdiffstats
path: root/src/taxi.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/taxi.rs')
-rw-r--r--src/taxi.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/taxi.rs b/src/taxi.rs
index 7c33ecb..e189a36 100644
--- a/src/taxi.rs
+++ b/src/taxi.rs
@@ -1,7 +1,8 @@
//! [Taxicab (Manhattan) distance](https://en.wikipedia.org/wiki/Taxicab_geometry).
-use crate::coords::{CoordinateMetric, CoordinateProximity, Coordinates};
+use crate::coords::Coordinates;
use crate::distance::{Metric, Proximity};
+use crate::lp::Minkowski;
use num_traits::{zero, Signed};
@@ -100,15 +101,12 @@ impl<T: Coordinates> Metric<T> for Taxicab<T> {}
impl<T: Coordinates> Metric<Taxicab<T>> for T {}
-impl<T: Coordinates> CoordinateProximity<T::Value> for Taxicab<T> {
- type Distance = T::Value;
+/// Taxicab distance is a [Minkowski] distance.
+impl<T: Coordinates> Minkowski for Taxicab<T> {}
- fn distance_to_coords(&self, coords: &[T::Value]) -> Self::Distance {
- taxicab_distance(self, coords)
- }
-}
+impl<T: Coordinates> Minkowski<T> for Taxicab<T> {}
-impl<T: Coordinates> CoordinateMetric<T::Value> for Taxicab<T> {}
+impl<T: Coordinates> Minkowski<Taxicab<T>> for T {}
#[cfg(test)]
mod tests {