geo icon indicating copy to clipboard operation
geo copied to clipboard

Boolean difference causes panic: `segment not found`

Open prideout opened this issue 1 year ago • 6 comments

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.

prideout avatar Jun 24 '24 04:06 prideout

Does it work with f64? I suspect there's a reason why other libraries use double precision.

lnicola avatar Jun 24 '24 05:06 lnicola

Yes this test passes with f64.

prideout avatar Jun 24 '24 13:06 prideout

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.

michaelkirk avatar Jun 24 '24 17:06 michaelkirk

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.

lnicola avatar Jun 24 '24 17:06 lnicola

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.

prideout avatar Jun 24 '24 18:06 prideout

Update: unfortunately we can still easily reproduce a similar panic after changing our codebase to use 64-bit precision.

prideout avatar Jun 24 '24 21:06 prideout

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.

michaelkirk avatar Oct 28 '24 18:10 michaelkirk