I'm trying to implement Delaunay Triangulation. However, I seem to be having a problem with edges creating overlapping triangles:
I'm basing my implementation as described on this site. I'm just using a brute force loop to check whether or not an edge already exists in the set.
v = vertex to be added
edgeBuffer = [];
for each triangle
if v is in the triangle's circumscribed circle
for each edge in the triangle
check if it's already in edgeBuffer
if not, add it
remove triangle
I suspect that it's another part of my algorithm that's going wrong and causing this to happen, but I have implemented everything in a pretty straightforward manner. What is wrong with this code? Fiddle