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

            Sweep(tcx);

            FixupConstrainedEdges(tcx);

            // Finalize triangulation
            if (tcx.TriangulationMode == TriangulationMode.Polygon)
            {
                FinalizationPolygon(tcx);
            }
            else
            {
                FinalizationConvexHull(tcx);
                if (tcx.TriangulationMode == TriangulationMode.Constrained)
                {
                    // work in progress.  When it's done, call FinalizationConstraints INSTEAD of tcx.FinalizeTriangulation
                    //FinalizationConstraints(tcx);

                    tcx.FinalizeTriangulation();
                }
                else
                {
                    tcx.FinalizeTriangulation();
                }
            }

            tcx.Done();
        }
Пример #2
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();
        }
Пример #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();
		}
Пример #4
0
        /// <summary>
        /// Triangulate simple polygon with holes
        /// </summary>
        public static void Triangulate(DTSweepContext tcx)
        {
            tcx.CreateAdvancingFront();

            Sweep(tcx);

            FixupConstrainedEdges(tcx);

            // Finalize triangulation
            if (tcx.TriangulationMode == TriangulationMode.Polygon)
            {
                FinalizationPolygon(tcx);
            }
            else 
            {
                FinalizationConvexHull(tcx);
                if (tcx.TriangulationMode == TriangulationMode.Constrained)
                {
                    // work in progress.  When it's done, call FinalizationConstraints INSTEAD of tcx.FinalizeTriangulation
                    //FinalizationConstraints(tcx);

                    tcx.FinalizeTriangulation();
                }
                else
                {
                    tcx.FinalizeTriangulation();
                }
            }

            tcx.Done();
        }