using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; namespace Io.Github.Kerwinxu.LibShapes.Core { /// /// 选择策略,主要是两种, /// public class SelectStrategy { /// /// 靠近在这个范围内就算选择了。 /// private static float tolerance = 0.5f; /// /// 两个点是否距离足够近 /// /// /// /// public static bool isNear(PointF p1, PointF p2) { return Utils.DistanceCalculation.distance(p1, p2) <= tolerance; } /// /// 一个点跟一个线段是否靠的非常近。 /// /// /// /// /// public static bool isNear(PointF p0, PointF p1, PointF p2) { return Utils.DistanceCalculation.pointToLine(p0, p1, p2) <= tolerance; } } }