本文整理汇总了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;
}
示例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));
}
}
}
}