Duplicate edges not being removed in Delaunay Triangle construction

瘦欲@ 提交于 2020-01-03 04:38:08

问题


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


回答1:


If the edge already exist in the edge buffer and its not the first triangle after the super triangle it needs to be removed from the edge buffer and not to skip the loop. The vertices of this edge are needed for the new computation. Just reinsert the vertices in your other buffer or remove the edge from edge buffer.



来源:https://stackoverflow.com/questions/29639924/duplicate-edges-not-being-removed-in-delaunay-triangle-construction

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!