Panic in RegionAssembly reproducibly
Occasionally (1:8) I observe a panic condition. I managed to print out the data of RegionAssembly causing the panic, and using this data to create a regression test (see PR)
Code with regresssion test assembling 3668 segments/lines https://github.com/georust/geo/pull/1126
The panic occures in the the check in file assembly.rs
debug_assert!(num_segments % 2 == 0, "assembly segments must be eulierian");
The execution path leading to this point of the RegionAssembly occures in the context of bop.sweep() in the following code
impl<T: GeoFloat> BooleanOps for MultiPolygon<T> {
type Scalar = T;
fn boolean_op(&self, other: &Self, op: OpType) -> MultiPolygon<Self::Scalar> {
let spec = BoolOp::from(op);
let mut bop = Proc::new(spec, self.coords_count() + other.coords_count());
bop.add_multi_polygon(self, 0);
bop.add_multi_polygon(other, 1);
bop.sweep()
}
Appreciating any hint why this crash occures and how to avoid the panic crash
#1102, #1103, and #1104 may be related here.
is the code of RegionAssembly crashing due to a bug in the algorithm, or due to bad input parameters? In case of the latter, how to prevent this?
It's crashing due to a bug, and a fix is unlikely in the short term.
hopefully this test https://github.com/georust/geo/pull/1126 can help you to reproduce the issue and fix the code
I believe this is a dupe of https://github.com/georust/geo/issues/913
That issue is still open - but let's try to focus any future discussion on this bug there. Note there may be other bugs with the boolean operations - this one in particular is about the "assembly segments must be eulierian", which I believe is caused by a collapse of floating point precision.
Feel free to re-open if I'm mistaken and this represents a different bug.