Beispiel #1
0
        private static void FillLeftAboveEdgeEvent(DTSweepContext tcx, DTSweepConstraint edge, AdvancingFrontNode node)
        {
            while (node.Prev.Point.X > edge.P.X)
            {
                if (tcx.IsDebugEnabled)
                {
                    tcx.DTDebugContext.ActiveNode = node;
                }

                Orientation o1 = TriangulationUtil.Orient2d(edge.Q, node.Prev.Point, edge.P);
                if (o1 == Orientation.CW)
                {
                    FillLeftBelowEdgeEvent(tcx, edge, node);
                }
                else
                {
                    node = node.Prev;
                }
            }
        }
Beispiel #2
0
 private static void FillLeftConcaveEdgeEvent(DTSweepContext tcx, DTSweepConstraint edge, AdvancingFrontNode node)
 {
     Fill(tcx, node.Prev);
     if (node.Prev.Point != edge.P)
     {
         if (TriangulationUtil.Orient2d(edge.Q, node.Prev.Point, edge.P) == Orientation.CW)
         {
             if (TriangulationUtil.Orient2d(node.Point, node.Prev.Point, node.Prev.Prev.Point) == Orientation.CW)
             {
                 FillLeftConcaveEdgeEvent(tcx, edge, node);
             }
         }
     }
 }
Beispiel #3
0
        private static void FillLeftBelowEdgeEvent(DTSweepContext tcx, DTSweepConstraint edge, AdvancingFrontNode node)
        {
            if (tcx.IsDebugEnabled)
            {
                tcx.DTDebugContext.ActiveNode = node;
            }

            if (node.Point.X > edge.P.X)
            {
                if (TriangulationUtil.Orient2d(node.Point, node.Prev.Point, node.Prev.Prev.Point) == Orientation.CW)
                {
                    FillLeftConcaveEdgeEvent(tcx, edge, node);
                }
                else
                {
                    FillLeftConvexEdgeEvent(tcx, edge, node);
                    FillLeftBelowEdgeEvent(tcx, edge, node);
                }
            }
        }
Beispiel #4
0
 private static void FillEdgeEvent(DTSweepContext tcx, DTSweepConstraint edge, AdvancingFrontNode node)
 {
     if (tcx.EdgeEvent.Right)
     {
         FillRightAboveEdgeEvent(tcx, edge, node);
     }
     else
     {
         FillLeftAboveEdgeEvent(tcx, edge, node);
     }
 }
Beispiel #5
0
 private static void FillRightConvexEdgeEvent(DTSweepContext tcx, DTSweepConstraint edge, AdvancingFrontNode node)
 {
     if (TriangulationUtil.Orient2d(node.Next.Point, node.Next.Next.Point, node.Next.Next.Next.Point) == Orientation.CCW)
     {
         FillRightConcaveEdgeEvent(tcx, edge, node.Next);
     }
     else
     if (TriangulationUtil.Orient2d(edge.Q, node.Next.Next.Point, edge.P) == Orientation.CCW)
     {
         FillRightConvexEdgeEvent(tcx, edge, node.Next);
     }
 }
Beispiel #6
0
        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);
        }
Beispiel #7
0
        private static void TurnAdvancingFrontConvex(DTSweepContext tcx, AdvancingFrontNode b, AdvancingFrontNode c)
        {
            AdvancingFrontNode first = b;

            while (c != tcx.Front.Tail)
            {
                if (tcx.IsDebugEnabled)
                {
                    tcx.DTDebugContext.ActiveNode = c;
                }

                if (TriangulationUtil.Orient2d(b.Point, c.Point, c.Next.Point) == Orientation.CCW)
                {
                    Fill(tcx, c);
                    c = c.Next;
                }
                else
                {
                    if (b != first && TriangulationUtil.Orient2d(b.Prev.Point, b.Point, c.Point) == Orientation.CCW)
                    {
                        Fill(tcx, b);
                        b = b.Prev;
                    }
                    else
                    {
                        b = c;
                        c = c.Next;
                    }
                }
            }
        }
Beispiel #8
0
 public void RemoveNode(AdvancingFrontNode node)
 {
     Front.RemoveNode(node);
 }
Beispiel #9
0
 public void AddNode(AdvancingFrontNode node)
 {
     Front.AddNode(node);
 }
Beispiel #10
0
 public void AddNode(AdvancingFrontNode node)
 {
 }