Using NearestNeighbor.jl I can find which points within a collection col
are closest to a (different) given point or set of points. What I need is slightly different. I would like to compute the points p_i in col
that are within a certain distance of each point p_j, also in col
. I suspect this is an “easier” problem, hence the question below.
I can currently get what I want by (1) building a KDTree
of col
, tree=KDTree(col)
, and then (2) running e.g. knn(tree, col, 3)
over all points in col
.
It turns out that step (1) is typically ~ six times faster than (2) for me, and I suspect all the information I need is already contained in tree
. So the question: is it possible to obtain the n nearest neighbors for each point in a collection without invoking knn
, just from the data inside the KDTree
of that collection?
[Please complain if the question is not clear. Also let me know if it should be posted elsewhere]
I take the liberty of pinging @kristoffer.carlsson, the author of NearestNeighbors.jl, I hope that’s ok!