Exemplo n.º 1
0
        private void Fill(SweepContext tcx, Node node)
        {
            Triangle triangle = new Triangle(node.Prev.Point, node.Point, node.Next.Point);

            triangle.MarkNeighbor(node.Prev.Triangle);
            triangle.MarkNeighbor(node.Triangle);

            tcx.AddToMap(triangle);

            // Update the advancing front
            node.Prev.Next = node.Next;
            node.Next.Prev = node.Prev;

            // If it was legalized the triangle has already been mapped
            if (!Legalize(tcx, triangle))
            {
                tcx.MapTriangleToNodes(triangle);
            }
        }
Exemplo n.º 2
0
        private Node NewFrontTriangle(SweepContext tcx, TriPoint point, Node node)
        {
            Triangle triangle = new Triangle(point, node.Point, node.Next.Point);

            triangle.MarkNeighbor(node.Triangle);
            tcx.AddToMap(triangle);

            Node new_node = new Node(point);

            _nodes.Add(new_node);

            new_node.Next  = node.Next;
            new_node.Prev  = node;
            node.Next.Prev = new_node;
            node.Next      = new_node;

            if (!Legalize(tcx, triangle))
            {
                tcx.MapTriangleToNodes(triangle);
            }

            return(new_node);
        }