From 88e25e9f83dcdea676a78caa78231d5036270eba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20H=C3=BCgel?= Date: Wed, 27 Sep 2023 11:20:22 +0100 Subject: [PATCH] Better distance_2 docs --- rstar/CHANGELOG.md | 1 + rstar/src/object.rs | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/rstar/CHANGELOG.md b/rstar/CHANGELOG.md index 9cd204a..b4111d7 100644 --- a/rstar/CHANGELOG.md +++ b/rstar/CHANGELOG.md @@ -5,6 +5,7 @@ ## Changed - Fixed a stack overflow error in `DrainIterator::next` +- Clarified that the distance measure in `distance_2` is not restricted to euclidean distance # 0.11.0 diff --git a/rstar/src/object.rs b/rstar/src/object.rs index d1ddee9..b37fc1f 100644 --- a/rstar/src/object.rs +++ b/rstar/src/object.rs @@ -145,7 +145,12 @@ pub trait RTreeObject { /// assert!(circle.contains_point(&[1.0, 0.0])); /// ``` pub trait PointDistance: RTreeObject { - /// Returns the squared euclidean distance between an object to a point. + /// Returns the squared distance between an object to a point. + /// + /// # Notes + /// While euclidean distance will be the correct choice for most use cases, any distance metric + /// fulfilling the [usual axioms](https://en.wikipedia.org/wiki/Metric_space) + /// can be used when implementing this method. fn distance_2( &self, point: &::Point,