Which algrorithm and mathematical logic is used behind scipy.spatial.KDTree(curve)

171 views Asked by At

I am finding the shortest distance to the point using this

#find the nearest point and shortest distance 
curve=np.column_stack((curve_mrds,curve_nrds)) # <-- the coordinates of the curve 
point = points_2  # <-- the point to find
#The distance of the point to the curve
dist=spatial.KDTree(curve).query(point)[0] #<-- The distance of the point to the curve. 

The things i want to know, if possible with references -the mathematical equations/logic behind the spatial.KDTree(curve).query(point)[0] -the algorithm behind the spatial.KDTree(curve).query(point)[0]

I have looked in the help as well, but it does not state the mathematical notation or reference to the original algorithm. I originally need references for publications.

1

There are 1 answers

0
Tim Roberts On

The documentation makes this very clear. https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.KDTree.html

Notes

The algorithm used is described in Maneewongvatana and Mount 1999. The general idea is that the kd-tree is a binary tree, each of whose nodes represents an axis-aligned hyperrectangle. Each node specifies an axis and splits the set of points based on whether their coordinate along that axis is greater than or less than a particular value.