You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const a = [[[0.17283,18.40241],[0.22772,18.48456],[0.22772,18.48461],[0.17281,18.40243],[0.17283,18.40241]]];
const b = [[[0.11978,18.32302],[0.14685,17.90202],[0.15809,18.11877],[0.11978,18.32302],[0.11978,18.32306],[0.11978,18.32302]]];
polygonClipping.union(a, b);
produces
"Tried to create degenerate segment at [0.11978, 18.32302]"
Which is a bit odd, because the two shapes don't overlap.
The text was updated successfully, but these errors were encountered:
Ah, nice. Thank you for the bug report @pentacular I've reproduced the failure on my side with the latest on master.
One of those two polygons is really thin, I would assume that's what's prompting the library to barf. It's trying to create a segment from [0.11978, 18.32302] to [0.11978, 18.32302], and there's a check in there to avoid creating of zero-length segments.... that's what's throwing the error.
Do you have a preference as to which of the bugs you've reported I look at first? Cheers.
Good thought - the library already does try to drop zero length segments by default. What was going on here was one of the input polygons has an infinitely thin 'peninsula' sticking off one of its vertices. The algorithm was getting confused trying to trim this off.
const a = [[[0.17283,18.40241],[0.22772,18.48456],[0.22772,18.48461],[0.17281,18.40243],[0.17283,18.40241]]];
const b = [[[0.11978,18.32302],[0.14685,17.90202],[0.15809,18.11877],[0.11978,18.32302],[0.11978,18.32306],[0.11978,18.32302]]];
polygonClipping.union(a, b);
produces
"Tried to create degenerate segment at [0.11978, 18.32302]"
Which is a bit odd, because the two shapes don't overlap.
The text was updated successfully, but these errors were encountered: