mapbox / earcut

The fastest and smallest JavaScript polygon triangulation library for your WebGL apps
ISC License
2.21k stars 207 forks source link

Another edge case with touching holes #129

Open rodovich opened 5 years ago

rodovich commented 5 years ago

The following triangulation was generated with earcut 2.2.1 using viz/viz.js setting testPoints to [[[16,12],[0,12],[0,0],[16,0]],[[12,7],[13,7],[13,6]],[[12,5],[13,6],[14,5]],[[4,8],[6,8],[5,6]],[[4,4],[5,6],[8,4]]]:

image

Looks similar to the input in https://github.com/mapbox/earcut/pull/120#discussion_r325121577.

AZm87 commented 4 years ago

I found another situation where this bug occurs. I used earcut 2.2.2 with the following testPoints:

[
    [[4430, 22202], [10568, 22777], [18532, 19422], [12883, 16586], [3634, 16908], [-2575, -3924], [36246, -3032], [35220, 36947], [-4648, 36039]],
    [[21522, 13778], [15738, 13643], [18532, 19422]],
    [[16205, 25080], [19383, 25153], [18532, 19422]]
]

Screenshot 2020-01-28 at 11 31 38