private static AdvancingFrontNode NewFrontTriangle(DTSweepContext tcx, TriangulationPoint point, AdvancingFrontNode node) { AdvancingFrontNode newNode; DelaunayTriangle triangle; triangle = new DelaunayTriangle(point, node.Point, node.Next.Point); triangle.MarkNeighbor(node.Triangle); tcx.Triangles.Add(triangle); newNode = new AdvancingFrontNode(point); newNode.Next = node.Next; newNode.Prev = node; node.Next.Prev = newNode; node.Next = newNode; tcx.AddNode(newNode); if (tcx.IsDebugEnabled) { tcx.DTDebugContext.ActiveNode = newNode; } if (!Legalize(tcx, triangle)) { tcx.MapTriangleToNodes(triangle); } return(newNode); }
private static AdvancingFrontNode PointEvent(DTSweepContext tcx, TriangulationPoint point) { AdvancingFrontNode node, newNode; node = tcx.LocateNode(point); if (tcx.IsDebugEnabled) { tcx.DTDebugContext.ActiveNode = node; } if (node == null || point == null) { return(null); } newNode = NewFrontTriangle(tcx, point, node); if (point.X <= node.Point.X + MathUtil.EPSILON) { Fill(tcx, node); } tcx.AddNode(newNode); FillAdvancingFront(tcx, newNode); return(newNode); }