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


C# Polyline.ClosestParameter方法代码示例

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


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

示例1: CreateConvexHullAsClosedPolyline

        internal static Polyline CreateConvexHullAsClosedPolyline(IEnumerable<Point> points) {
            var convexHull = new Polyline(CalculateConvexHull(points)) { Closed = true };
#if TEST_MSAGL
            foreach (var point in points) {
                if (Curve.PointRelativeToCurveLocation(point, convexHull) == PointLocation.Outside) {
                    var hullPoint = convexHull[convexHull.ClosestParameter(point)];

                    // This can be too restrictive if very close points are put into the hull.  It is probably 
                    // better to clean up in the caller before doing this, but this assert can also be relaxed.
                  Debug.Assert(ApproximateComparer.Close(point, hullPoint, ApproximateComparer.IntersectionEpsilon * 20), String.Format("not CloseIntersections: initial point {0}, hull point {1}", point, hullPoint));
                    
                }
            }
#endif // TEST_MSAGL
            return convexHull;
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:16,代码来源:ConvexHull.cs

示例2: VerifyPointsAreInOrOnHull

 public static void VerifyPointsAreInOrOnHull(IEnumerable<Point> points, Polyline hull) 
 {
     // A convex hull may not pick up points that are just barely outside the hull because GetTriangleOrientation won't
     // show a significant enough distance to consider them non-collinear.
     foreach (var point in points)
     {
         if (Curve.PointRelativeToCurveLocation(point, hull) == PointLocation.Outside)
         {
             var hullPoint = hull[hull.ClosestParameter(point)];
             if (!ApproximateComparer.CloseIntersections(point, hullPoint))
             {
                 Validate.Fail(String.Format("not CloseIntersections: initial point {0}, closest hull point {1}", point, hullPoint));
             }
         }
     }
 }
开发者ID:WenzCao,项目名称:automatic-graph-layout,代码行数:16,代码来源:ConvexHullTest.cs


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