Exemplo n.º 1
0
        public static void AddNonConcaveSubPolygons(
            this List <int[]> polygonList, Polygon2d poly,
            double absoluteEpsilon)
        {
            var indices = new int[poly.PointCount].SetByIndex(i => i);

            while (indices.Length > 0)
            {
                var subPoly = poly.ComputeNonConcaveSubPolygon(
                    ref indices, absoluteEpsilon);

                if (subPoly == null)
                {
                    Console.WriteLine("encountered degenerated polygon that cannot be easily triangulated");
                    break;
                }

                if (subPoly.Length < 3)
                {
                    Console.WriteLine("encountered invalid subpolygon");
                    continue;
                }
                polygonList.Add(subPoly);
            }
        }