Boolean difference causes panic: `segment not found`
In this new unit test, a panic is provoked by calling difference. The error message looks like this:
thread 'algorithm::bool_ops::tests::test_issue_1104' panicked at geo/src/algorithm/sweep/vec_set.rs:29:14:
segment not found in active-vec-set: 2
Here's the new regression test:
https://github.com/prideout/geo/commit/632d15226ac7120deb01bfbe193507532ce3207c
This might be related to https://github.com/georust/geo/issues/1104?
At Arcol we're quite vested in Geo, and we ran into this with one of our customers.
Does it work with f64? I suspect there's a reason why other libraries use double precision.
Yes this test passes with f64.
The issue in #913 is equally possible for any floating point representation, but less probable as precision increases.
I'm not sure if this issue is the same underlying cause as #913.
Right, it can still happen, but it does make sense to use higher than input precision for computation. Not an elegant solution, but worth considering.
Understood, we'll change our codebase to use f64.
For some context, we're currently using f32 only because we're generating vertex buffer data that gets fed into WebGL, and out of laziness we're avoiding a f64 => f32 conversion step.
Update: unfortunately we can still easily reproduce a similar panic after changing our codebase to use 64-bit precision.
I just merged #1234 which replaces our BoolOps implementation with one backed by the i_overlay crate. This should resolve the issue you're seeing. Let us know if it recurs. You can use it now if you use the unreleased geo crate, otherwise we expect it to be part of the upcoming v0.29.0 release.