Wrong result for two simple polygons
See original GitHub issueThese are my two simple polygons:

with coordinates:
[[115,96], [140,206], [120,210], [125,250], [80,300]]
[[111,228], [129,192], [309,282]]
And this is the resulting union:

There are no vertical edges, in fact, no two points share the same x-coordinate. I believe the issue here is with the otherInOut property not being correctly computed as these are the sweep events with otherInOut set to true after the subdivision step:

I also tried with the C++ code available online from the original paper, and the resulting union is the same.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:12 (4 by maintainers)
Top Results From Across the Web
Merging touching polygons giving wrong result - Stack Overflow
Now this is obviously wrong as these two polygons do not touch each other. The same result occurs with both methods. The result...
Read more >Intersection gives wrong result · Issue #1216 · shapely/shapely
I ran into a case where an intersection between two (valid) (multi)polygons results in a wrong result. One example results in an "invalid" ......
Read more >Detecting two kinds of almost-simple polygons
We can determine whether a given polygon is simple in O(n2) time by checking every pair of edges for intersection, or in O(nlogn)...
Read more >Triangulations and arrangements - ICS, UCI
The resulting polytope, with eight triangular faces, cannot be triangulated. ... THE TWO-EARS THEOREM (Meister, 1975): Every simple polygon with at least ...
Read more >Detecting Weakly Simple Polygons∗ - Hsien-Chih Chang
Top row: Two weakly simple polygons from Meis- ... is incorrect for polygons with spurs; many of these definitions are incorrect even for...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I would love to get some help here, I didn’t have time to look at it recently
Exactly. I can also confirm it is not related to floating-point arithmetic and/or epsilon values, I tested the implementation with a type for rational numbers, and the issue remains.