storpipfugl / pykdtree

Fast kd-tree implementation in Python
GNU Lesser General Public License v3.0
206 stars 48 forks source link

Return early for coincident points #77

Open Alessi42 opened 1 year ago

Alessi42 commented 1 year ago

This library is excellent.

My use case is IWD interpolation which has many coincident points (dist=0) which simplifies the computation (as I simply take the value of the coincident point)

My question specifically is is can this be adapted to return early for a point should one with distance 0 be found.

As this would reduce the search from k=8 neighbours to k=1 for points who have a matching point in the tree.

djhoese commented 1 year ago

I don't know the internals of the algorithm used, so we may have to wait for @storpipfugl to have time to look into this. Otherwise, if you can dive into the code and determine where the extra if statements would go that'd be a great start.