@fogleman Just something I noticed when porting this to JS — currently, triangle data is always appended to triangles / halfedges / candidates / errors / queueIndexes arrays, leaving a ton of redundant old triangles that flipped on legalization.
An easy fix is to add an optional argument to addTriangle which is an existing halfedge index, and use that instead of a new one if provided. Then you can pass that to the first addTriangle after every QueueRemove or QueuePop.
This reduces the size of the arrays above at the end of a run by ~4x (they should exactly match the number of output triangles), and also modestly improves overall running time because of better cache locality / less allocation.
@fogleman Just something I noticed when porting this to JS — currently, triangle data is always appended to
triangles
/halfedges
/candidates
/errors
/queueIndexes
arrays, leaving a ton of redundant old triangles that flipped on legalization.An easy fix is to add an optional argument to
addTriangle
which is an existing halfedge index, and use that instead of a new one if provided. Then you can pass that to the firstaddTriangle
after everyQueueRemove
orQueuePop
.This reduces the size of the arrays above at the end of a run by ~4x (they should exactly match the number of output triangles), and also modestly improves overall running time because of better cache locality / less allocation.