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


C# Polygon.RemoveAt方法代码示例

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


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

示例1: triangulateHelper

 /// <summary>
 /// Helper function to triangulate.
 /// </summary>
 /// <param name="poly">Polygon to breakdown</param>
 /// <param name="tris">List of triangles</param>
 /// <returns>List of triangles</returns>
 private List<Polygon> triangulateHelper(Polygon poly, List<Polygon> tris)
 {
     Polygon p = new Polygon(poly);
     if (p.Count <= 3)
     {
         tris.Add(p);
         return tris;
     }
     else
     {
         for (int i = 0; i < p.Count; i++)
         {
             Vector2 v = p[i+2] - p[i];
             DEASL.Core.Mathematics.Shapes.LineSegment ls = new DEASL.Core.Mathematics.Shapes.LineSegment(
                 p[i]+0.00001*v, p[i + 2]-0.00001*v);
             if(!p.DoesIntersect(ls) && p.IsInside(ls))
             {
                 tris.Add(new Polygon(new Vector2[] {p[i], p[i+1], p[i+2]}));
                 p.RemoveAt(i+1);
                 break;
             }
         }
         return triangulateHelper(p, tris);
     }
 }
开发者ID:elieberson,项目名称:Map-Builder,代码行数:31,代码来源:Field.cs

示例2: DecomposePolygon

 /// <summary>
 /// Decompose polygon into triangles
 /// </summary>
 /// <param name="polygon"></param>
 /// <returns></returns>
 public List<Polygon> DecomposePolygon(Polygon polygon)
 {
     List<Polygon> triangles = new List<Polygon>();
     bool foundAll = false;
     while (!foundAll)
     {
         for (int i = 1; i < polygon.Count - 1; i++)
         {
             if (polygon.Count == 3)
             {
                 triangles.Add(polygon);
                 foundAll = true;
             }
             // make a triangle
             Polygon thisTriangle = new Polygon();
             for (int j = -1; j <= 1; j++)
                 thisTriangle.Add(polygon[i - j]);
             // check if the triangle is an ear. If so, add to the list of triangles
             if (IsEar(thisTriangle, polygon))
             {
                 triangles.Add(thisTriangle);
                 polygon.RemoveAt(i);
                 continue;
             }
         }
     }
     return triangles;
 }
开发者ID:iamchucky,项目名称:3DpointCloud,代码行数:33,代码来源:OcGrid2Poly.cs


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