I have the following setup - it's rtree build on points:
from collections import defaultdict
from math import sqrt
import rtree.index
points = [(5, 4), (3, 1), (6, 3), (2, 8), (7, 8), (8, 1), (2, 3), (0, 4), (3, 7), (6, 4)]
idx = rtree.index.Rtree()
for i, p in enumerate(points):
idx.insert(i, p+p, p)
Now I'm trying to find all points within the certain distance from certain point:
max_distance=5
p = (6,4)
list(idx.nearest(p, 5, objects='raw'))
I receive
[(6, 4), (6, 3), (5, 4), (8, 1), (2, 3), (7, 8)]
The question is - why (3, 1)
is not included in the list? The distance is ~4.24 so it should be included, right?