Given a point, we can find all the points that are within a distance to the point by locate_within_distance.
tree.locate_within_distance((3, 3), 20);The example finds all the points that are within distance 20 to point (3, 3).
The complete example is shown below:
use rstar::RTree;
fn main() {
let tree = RTree::bulk_load(vec![(0, 0), (1, 2), (8, 5)]);
for point in tree.locate_within_distance((3, 3), 20) {
println!("{:?}", point);
}
}Output:
(1, 2)
(0, 0)
➡️ Next: Points
📘 Back: Table of contents