mapbox / earcut.hpp

Fast, header-only polygon triangulation
ISC License
858 stars 133 forks source link

Fix a race condition that could cause an infinite loop #66

Closed mourner closed 5 years ago

mourner commented 5 years ago

A port of https://github.com/mapbox/earcut/pull/108

The test code change is about not comparing "area deviation" if the number of expected triangles is 0 (it doesn't make sense).

mourner commented 5 years ago

@mrgreywater yes, see the comment above.

mrgreywater commented 5 years ago

The "expected_triangles" is just meant as a test for earcut though. Libtess sometimes has a different result. So where previously you could easily see libtess produces a wrong result for empty_square, now you can't. I'm fine with it, just something to consider.

mourner commented 5 years ago

@mrgreywater ah, good point. I disabled it for libtess too because it was failing the build, but I rolled that back in the last commit.

mrgreywater commented 5 years ago

libtess is now showing a deviation of -200% for issue107, which is unexpected, since it should be a positive value. But I can debug that later when it's merged if necessary.

mourner commented 5 years ago

@mrgreywater found the issue, fixed now.