KristofferC / NearestNeighbors.jl

High performance nearest neighbor data structures (KDTree and BallTree) and algorithms for Julia.
Other
418 stars 65 forks source link

`get_min_distance_sq` seems weird #189

Closed KristofferC closed 3 months ago

KristofferC commented 3 months ago

Why does it unconditionally square? And surely it needs to consider the metric. For example:

rec = HyperRectangle{SVector{2, Float64}}([0.0, 0.0], [1.0, 1.0])
point = SVector{2}(2.0, 2.0)
d = get_min_distance_sq(rec, point) 

(NearestNeighbors) julia> d
2.0

(NearestNeighbors) julia> Chebyshev()([1.0, 1.0], [2.0, 2.0])
1.0

It says the minimum distance is 2 (or well, the min distance squared) but I can find a point where the min distance is 1.