/// <summary> /// Adds a triangle to the advancing front to fill a hole. /// </summary> /// <param name="tcx"></param> /// <param name="node">middle node, that is the bottom of the hole</param> private static void Fill(DTSweepContext tcx, AdvancingFrontNode node) { DelaunayTriangle triangle = new DelaunayTriangle(node.Prev.Point, node.Point, node.Next.Point); // TODO: should copy the cEdge value from neighbor triangles // for now cEdge values are copied during the legalize triangle.MarkNeighbor(node.Prev.Triangle); triangle.MarkNeighbor(node.Triangle); tcx.Triangles.Add(triangle); // Update the advancing front node.Prev.Next = node.Next; node.Next.Prev = node.Prev; tcx.RemoveNode(node); // If it was legalized the triangle has already been mapped if (!Legalize(tcx, triangle)) { tcx.MapTriangleToNodes(triangle); } }