Пример #1
0
        /// <summary>
        /// Triangulate simple polygon with holes
        /// </summary>
        public static void Triangulate(DTSweepContext tcx)
        {
            tcx.CreateAdvancingFront();

            Sweep(tcx);

            // TODO: remove temporary
            // Check if the sweep algorithm is legalize robust
            // By doing a legalize on all triangles and see if anything happens
            // we know if the sweep algorithm missed some legalizations
            //        Console.WriteLine("============================");
            //        foreach ( DelaunayTriangle t in tcx.Triangles )
            //        {
            //            if( Legalize( tcx, t ) )
            //            {
            //                tcx.getDebugContext().setPrimaryTriangle( t );
            //                Console.WriteLine("[FIX] Triangle needed legalization after sweep");
            //            }
            //        }

            // Finalize triangulation
            if (tcx.TriangulationMode == TriangulationMode.Polygon)
            {
                FinalizationPolygon(tcx);
            }
            else
            {
                FinalizationConvexHull(tcx);
            }

            tcx.Done();
        }
Пример #2
0
 public static void Triangulate(DTSweepContext tcx)
 {
     tcx.CreateAdvancingFront();
     Sweep(tcx);
     if (tcx.TriangulationMode == TriangulationMode.Polygon)
     {
         FinalizationPolygon(tcx);
     }
     else
     {
         FinalizationConvexHull(tcx);
     }
     tcx.Done();
 }
Пример #3
0
        /// <summary>
        /// Triangulate simple polygon with holes
        /// </summary>
        public static void Triangulate( DTSweepContext tcx )
        {
            tcx.CreateAdvancingFront();

            Sweep(tcx);

            // TODO: remove temporary
            // Check if the sweep algorithm is legalize robust
            // By doing a legalize on all triangles and see if anything happens
            // we know if the sweep algorithm missed some legalizations
            //        Console.WriteLine("============================");
            //        foreach ( DelaunayTriangle t in tcx.Triangles )
            //        {
            //            if( Legalize( tcx, t ) )
            //            {
            //                tcx.getDebugContext().setPrimaryTriangle( t );
            //                Console.WriteLine("[FIX] Triangle needed legalization after sweep");
            //            }
            //        }

            // Finalize triangulation
            if (tcx.TriangulationMode == TriangulationMode.Polygon) {
                FinalizationPolygon(tcx);
            } else {
                FinalizationConvexHull(tcx);
            }

            tcx.Done();
        }