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
{{ message }}
Repository navigation
Overlapping triangles on a simple polygon with two holes since 3.1.0 #219
The polygon below is simple, and the holes don't touch each other or the outer ring. earcut 3.0.2 returns 11 triangles. Since 3.1.0 it returns 7. Two of them cover the second hole, and one more lies on top of three others.
The first hole is bridged to (1, 1). The copy of (1, 1) made for that bridge lies on a straight line between (3, 3) and (0, 0), so filterPoints in eliminateHole removes it. The ray from the second hole then hits the vertex (1, 1) and the new edge from (3, 3) to (0, 0) at the same x, and findHoleBridge keeps the vertex, although the hole is outside its angle.
It happens on bigger inputs too. On a valid outline of a noisy raster region with 9113 holes and 65426 vertices the triangles cover 1.3% more area than the polygon.
Activity
fix an edge case with hole bridging, close mapbox#219