当前位置: 首页>>代码示例>>C#>>正文


C# DTSweepContext.RemoveFromList方法代码示例

本文整理汇总了C#中Poly2Tri.Triangulation.Delaunay.Sweep.DTSweepContext.RemoveFromList方法的典型用法代码示例。如果您正苦于以下问题:C# DTSweepContext.RemoveFromList方法的具体用法?C# DTSweepContext.RemoveFromList怎么用?C# DTSweepContext.RemoveFromList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Poly2Tri.Triangulation.Delaunay.Sweep.DTSweepContext的用法示例。


在下文中一共展示了DTSweepContext.RemoveFromList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FinalizationConvexHull

        /// <summary>
        /// If this is a Delaunay Triangulation of a pointset we need to fill so the triangle mesh gets a ConvexHull 
        /// </summary>
        private static void FinalizationConvexHull(DTSweepContext tcx)
        {
            AdvancingFrontNode n1, n2;
            DelaunayTriangle t1, t2;
            TriangulationPoint first, p1;

            n1 = tcx.aFront.Head.Next;
            n2 = n1.Next;
            first = n1.Point;

            TurnAdvancingFrontConvex(tcx, n1, n2);

            // TODO: implement ConvexHull for lower right and left boundary

            // Lets remove triangles connected to the two "algorithm" points

            // XXX: When the first the nodes are points in a triangle we need to do a flip before 
            //      removing triangles or we will lose a valid triangle.
            //      Same for last three nodes!
            // !!! If I implement ConvexHull for lower right and left boundary this fix should not be 
            //     needed and the removed triangles will be added again by default
            n1 = tcx.aFront.Tail.Prev;
            if (n1.Triangle.Contains(n1.Next.Point) && n1.Triangle.Contains(n1.Prev.Point))
            {
                t1 = n1.Triangle.NeighborAcross(n1.Point);
                RotateTrianglePair(n1.Triangle, n1.Point, t1, t1.OppositePoint(n1.Triangle, n1.Point));
                tcx.MapTriangleToNodes(n1.Triangle);
                tcx.MapTriangleToNodes(t1);
            }
            n1 = tcx.aFront.Head.Next;
            if (n1.Triangle.Contains(n1.Prev.Point) && n1.Triangle.Contains(n1.Next.Point))
            {
                t1 = n1.Triangle.NeighborAcross(n1.Point);
                RotateTrianglePair(n1.Triangle, n1.Point, t1, t1.OppositePoint(n1.Triangle, n1.Point));
                tcx.MapTriangleToNodes(n1.Triangle);
                tcx.MapTriangleToNodes(t1);
            }

            // Lower right boundary 
            first = tcx.aFront.Head.Point;
            n2 = tcx.aFront.Tail.Prev;
            t1 = n2.Triangle;
            p1 = n2.Point;
            n2.Triangle = null;
            do
            {
                tcx.RemoveFromList(t1);
                p1 = t1.PointCCW(p1);
                if (p1 == first) break;
                t2 = t1.NeighborCCW(p1);
                t1.Clear();
                t1 = t2;
            } while (true);

            // Lower left boundary
            first = tcx.aFront.Head.Next.Point;
            p1 = t1.PointCW(tcx.aFront.Head.Point);
            t2 = t1.NeighborCW(tcx.aFront.Head.Point);
            t1.Clear();
            t1 = t2;
            while (p1 != first) //TODO: Port note. This was do while before.
            {
                tcx.RemoveFromList(t1);
                p1 = t1.PointCCW(p1);
                t2 = t1.NeighborCCW(p1);
                t1.Clear();
                t1 = t2;
            }

            // Remove current head and tail node now that we have removed all triangles attached
            // to them. Then set new head and tail node points
            tcx.aFront.Head = tcx.aFront.Head.Next;
            tcx.aFront.Head.Prev = null;
            tcx.aFront.Tail = tcx.aFront.Tail.Prev;
            tcx.aFront.Tail.Next = null;

            tcx.FinalizeTriangulation();
        }
开发者ID:Werkheisera2,项目名称:RaginRovers,代码行数:81,代码来源:DTSweep.cs


注:本文中的Poly2Tri.Triangulation.Delaunay.Sweep.DTSweepContext.RemoveFromList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。