Exemplo n.º 1
0
 public static void Triangulate(PolygonSet ps)
 {
     foreach (Polygon p in ps.Polygons)
     {
         Triangulate(p);
     }
 }
Exemplo n.º 2
0
 public static void Triangulate(PolygonSet ps)
 {
     foreach (Polygon p in ps.Polygons)
     {
         Triangulate(p);
     }
 }
Exemplo n.º 3
0
 public static void Triangulate(PolygonSet ps)
 {
     TriangulationContext tcx = CreateContext(_defaultAlgorithm);
     foreach (Polygon p in ps.Polygons)
     {
         Triangulate(p);
     }
 }
Exemplo n.º 4
0
 public static void Triangulate(PolygonSet ps)
 {
     //TriangulationContext tcx = CreateContext(_defaultAlgorithm);
     foreach (Polygon p in ps.Polygons)
     {
         Triangulate(p);
     }
 }
Exemplo n.º 5
0
 public static void Triangulate(PolygonSet ps)
 {
     TriangulationContext tcx = CreateContext(_defaultAlgorithm);
     foreach (Polygon p in ps.Polygons) {
         tcx.PrepareTriangulation(p);
         Triangulate(tcx);
         tcx.Clear();
     }
 }
Exemplo n.º 6
0
        public static void Triangulate(PolygonSet ps)
        {
            TriangulationContext tcx = CreateContext(_defaultAlgorithm);

            foreach (Polygon p in ps.Polygons)
            {
                tcx.PrepareTriangulation(p);
                Triangulate(tcx);
                tcx.Clear();
            }
        }
Exemplo n.º 7
0
        public static void triangulate(PolygonSet ps)
        {
            TriangulationContext tcx = createContext(_defaultAlgorithm);

            foreach (Polygon p in ps.getPolygons())
            {
                tcx.prepareTriangulation(p);
                triangulate(tcx);
                tcx.clear();
            }
        }
Exemplo n.º 8
0
 public static void Triangulate(PolygonSet ps)
 {
     foreach (Polygon p in ps.Polygons)
     {
         try
         {
             Triangulate(p);
         }
         catch (System.Exception e)
         {
             UnityEngine.Debug.LogError("Triangulation Exception: " + e.Message);
         }
     }
 }
Exemplo n.º 9
0
 public static void Triangulate(PolygonSet ps)
 {
     foreach (Polygon p in ps.Polygons)
     {
         try
         {
             Triangulate(p);
         }
         catch (System.Exception e)
         {
             UnityEngine.Debug.LogError("Triangulation Exception: " + e.Message);
         }
     }
 }
Exemplo n.º 10
0
 static void InsertIntoSet(PolygonSet set, Polygon poly)
 {
     //first test to see if any of the existing polygons are inside our input.
     for (int i = set.Polygons.Count - 1; i >= 0; i--)
     {
         if (TryInsertHole(poly, set.Polygons[i]))
             set.Polygons.RemoveAt(i); //we go from the end, so the indices remain valid.
     }
     foreach (var item in set.Polygons)
     {
         if (TryInsertHole(item, poly))
         {
             return; //nothing more to do.
         }
     }
     set.Add(poly);
 }
Exemplo n.º 11
0
 static PolygonSet DeNestHoles(PolygonSet set)
 {
     PolygonSet output = new PolygonSet();
     foreach (var polygon in set.Polygons)
     {
         output.Polygons.AddRange(DeNestHoles(polygon));
     }
     return output;
 }
Exemplo n.º 12
0
 void ConvertToMesh(PolygonSet polySet, float height)
 {
     Dictionary<TriangulationPoint, int> pointIndices = new Dictionary<TriangulationPoint, int>();
     P2T.Triangulate(polySet);
     foreach (var polygon in polySet.Polygons)
     {
         foreach (var triangle in polygon.Triangles)
         {
             for(int i = 2; i >= 0; i--)
             {
                 var point = triangle.Points[i];
                 int index;
                 if (!pointIndices.ContainsKey(point))
                 {
                     index = vertices.Count;
                     pointIndices[point] = index;
                     vertices.Add(new Vector3(point.Xf, height, point.Yf));
                     uvs.Add(new Vector2(point.Xf / GameMap.tileWidth, point.Yf / GameMap.tileWidth));
                 }
                 else
                     index = pointIndices[point];
                 triangles.Add(index);
             }
         }
     }
 }