NearestNeighbors.jl
NearestNeighbors.jl copied to clipboard
Modify `inrange` to accept hyper-rectangle?
As I understand, inrange
currently accepts a radius r
which is used to determine if points exist within the hypersphere with radius r
. I need to find the points existing within the hyperrectangle ϵ
, a vector of the lengths of each dimension of the hyperrectangle.
I wanted to get your thoughts (and any pointers on how to go about implementing this) before I wasted any time.
Curious to know was there a good solution? The issue was closed the same day it was opened.
Honestly, I don't recall what exactly I was working on at the time. I believe I realized I could do what I needed to do without a hyperrectangle inrange
.
This functionality would be useful. Could you @halleysfifthinc re-open the issue, otherwise I have to open a new issue.
I feel embarrassed to write something like this
idx_x = inrange(tree_x, x, dx)
idx_y = inrange(tree_y, y, dy)
#idx = intersect(idx_x, idx_y)
#idx = intersect(Set(idx_x), Set(idx_y))
idx = intersect(BitSet(idx_x), BitSet(idx_y)) # faster that the two above for my use case