Closed grovesNL closed 1 month ago
I think the problem is with recent changes to new_empty
default bounds https://github.com/georust/rstar/blob/0139255a78ada92277ce0d1025c009254ea5b298/rstar/src/aabb.rs#L222
If 1
is always lower than the values provided the components of any points provided, then it will show up here. The same thing happens if the points are always lower than the default upper bound of 0
:
let aabb = AABB::from_points(&[(-0.5, -0.5)]);
println!("{:?}", aabb); // AABB { lower: (-0.5, -0.5), upper: (0.0, 0.0) }
Good catch! That might be due to #162 (as of yet unreleased)
Sorry for introducing that regression. I do think we should fix from_points
though instead of reverting as the current implementation does rely on the initial having min/max coordinates instead of just being empty.
I think the most straight-forward implementation would be something like
i.into_iter().map(Self::from_point).reduce(|mut lhs, rhs| {
lhs.merge(&rhs);
lhs
).unwrap_or(Self::new_empty())
or we could change the initial value of the fold
to really use max/min-valued points?
The lower bounds are wrong in this example on
master
: