gorhill / Javascript-Voronoi

A Javascript implementation of Fortune's algorithm to compute Voronoi cells
http://www.raymondhill.net/voronoi/
Other
1.03k stars 166 forks source link

Avoid array usage to store disappearing transitions on beachsection removal #32

Open fjwong opened 7 years ago

fjwong commented 7 years ago

When a beachsection is removed, the original implementation creates an array and stores all "disappearing transitions" in it, so that the starting points of their edges can be updated.

This PR changes the removeBeachsection method so that endpoints are set when cycling through the disappearing transitions the first time, avoiding the creation of this new array, and reducing the amount of time spent on garbage collection because of this.