Math in Delaunay triangulation algorithm, too many triangles appearing

Nevermind I see the issue.

The problem comes the part where you don’t add an edge if a similar one already exists in the array.

auto AddEdgeIfNotSimilar = [&Edges](const FDEdge& InEdge) {
					bool bAdd = true;
					for (const FDEdge& EdgeX : Edges) {
						if (EdgeX.IsSimilar(InEdge)) {
							bAdd = false;
							break;
						}
					}
					if (bAdd) {
						Edges.Add(InEdge);
					}
				};
				AddEdgeIfNotSimilar(CurTriangle.E1);
				AddEdgeIfNotSimilar(CurTriangle.E2);
				AddEdgeIfNotSimilar(CurTriangle.E3);

The working implementations always add the edges, and then they look for duplicates and remove BOTH duplicates when they find them. This produces the desired result :


This does seem to produce similar result in a more compact way like you originally intended :

image

2 Likes