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


C# Path.RemoveAt方法代码示例

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


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

示例1: CleanPolygon

      //------------------------------------------------------------------------------

      public static Path CleanPolygon(Path path,
          double distance = 1.415)
      {
          //distance = proximity in units/pixels below which vertices
          //will be stripped. Default ~= sqrt(2) so when adjacent
          //vertices have both x & y coords within 1 unit, then
          //the second vertex will be stripped.
          double distSqrd = (distance * distance);
          int highI = path.Count -1;
          Path result = new Path(highI + 1);
          while (highI > 0 && PointsAreClose(path[highI], path[0], distSqrd)) highI--;
          if (highI < 2) return result;
          IntPoint pt = path[highI];
          int i = 0;
          for (;;)
          {
              while (i < highI && PointsAreClose(pt, path[i], distSqrd)) i+=2;
              int i2 = i;
              while (i < highI && (PointsAreClose(path[i], path[i + 1], distSqrd) ||
                  SlopesNearCollinear(pt, path[i], path[i + 1], distSqrd))) i++;
              if (i >= highI) break;
              else if (i != i2) continue;
              pt = path[i++];
              result.Add(pt);
          }
          if (i <= highI) result.Add(path[i]);
          i = result.Count;
          if (i > 2 && SlopesNearCollinear(result[i - 2], result[i - 1], result[0], distSqrd)) 
              result.RemoveAt(i -1);
          if (result.Count < 3) result.Clear();
          return result;
      }
开发者ID:CharlesTaylor95,项目名称:clipper,代码行数:34,代码来源:clipper.cs

示例2: StripDupsAndGetBotPt

      //------------------------------------------------------------------------------

      internal static bool StripDupsAndGetBotPt(Path in_path, 
        Path out_path, bool closed, out IntPoint botPt)
      {
        botPt = new IntPoint(0, 0);
        int len = in_path.Count;
        if (closed)    
          while (len > 0 && (in_path[0] == in_path[len -1])) len--;
        if (len == 0) return false;
        out_path.Capacity = len;
        int j = 0;
        out_path.Add(in_path[0]);
        botPt = in_path[0];
        for (int i = 1; i < len; ++i)
          if (in_path[i] != out_path[j])
          {
            out_path.Add(in_path[i]);
            j++;
            if (out_path[j].Y > botPt.Y ||
              ((out_path[j].Y == botPt.Y) && out_path[j].X < botPt.X))
                botPt = out_path[j];
          }
        j++;
        if (j < 2 || (closed && (j == 2))) j = 0;
        while (out_path.Count > j) out_path.RemoveAt(j);
        return j > 0;
      }
开发者ID:CharlesTaylor95,项目名称:clipper,代码行数:28,代码来源:clipper.cs


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