/// <summary> /// Exhaustive search to update neighbor pointers /// </summary> public void MarkNeighbor(DelaunayTriangle t) { if (t.Contains(Points[1], Points[2])) { Neighbors[0] = t; t.MarkNeighbor(Points[1], Points[2], this); } else if (t.Contains(Points[0], Points[2])) { Neighbors[1] = t; t.MarkNeighbor(Points[0], Points[2], this); } else if (t.Contains(Points[0], Points[1])) { Neighbors[2] = t; t.MarkNeighbor(Points[0], Points[1], this); } else { Debug.WriteLine("markNeighbor failed"); } }
private static AdvancingFrontNode NewFrontTriangle(DTSweepContext tcx, TriangulationPoint point, AdvancingFrontNode node) { DelaunayTriangle delaunayTriangle = new DelaunayTriangle(point, node.Point, node.Next.Point); delaunayTriangle.MarkNeighbor(node.Triangle); tcx.Triangles.Add(delaunayTriangle); AdvancingFrontNode advancingFrontNode = new AdvancingFrontNode(point); advancingFrontNode.Next = node.Next; advancingFrontNode.Prev = node; node.Next.Prev = advancingFrontNode; node.Next = advancingFrontNode; tcx.AddNode(advancingFrontNode); bool flag = !DTSweep.Legalize(tcx, delaunayTriangle); if (flag) { tcx.MapTriangleToNodes(delaunayTriangle); } return(advancingFrontNode); }
/// <summary> /// Creates a new front triangle and legalize it /// </summary> private static AdvancingFrontNode NewFrontTriangle(DTSweepContext tcx, TriangulationPoint point, AdvancingFrontNode node) { DelaunayTriangle triangle = new DelaunayTriangle(point, node.Point, node.Next.Point); triangle.MarkNeighbor(node.Triangle); tcx.Triangles.Add(triangle); AdvancingFrontNode newNode = new AdvancingFrontNode(point); newNode.Next = node.Next; newNode.Prev = node; node.Next.Prev = newNode; node.Next = newNode; tcx.AddNode(newNode); // XXX: BST if (!Legalize(tcx, triangle)) { tcx.MapTriangleToNodes(triangle); } return(newNode); }