mapbox / delaunator

An incredibly fast JavaScript library for Delaunay triangulation of 2D points
https://mapbox.github.io/delaunator/
ISC License
2.33k stars 142 forks source link

Fix rare race condition that produces corrupt halfedges structure #25

Closed mourner closed 6 years ago

mourner commented 6 years ago

Closes #24, and a more robust fix for #11. It's not an elegant fix, but since the condition happens pretty rarely, it shouldn't affect performance.

I've also added a crude ASCII illustration to code comments so that I don't forget what's going on in the _legalize routine again.

cc @mbostock @redblobgames