private static bool HitTestForGuideLine(IList<GuideLine> guides, double x, double y, double treshold, out GuideLine hitGuide) { var point = new GuidePoint(x, y); foreach (var guide in guides) { var nearest = GuideHelpers.NearestPointOnLine(guide.Point0, guide.Point1, point); var distance = GuideHelpers.Distance(nearest, point); if (distance < treshold) { hitGuide = guide; return true; } } hitGuide = null; return false; }
private static bool HitTestForGuideLine(IList <GuideLine> guides, double x, double y, double treshold, out GuideLine hitGuide) { var point = new GuidePoint(x, y); foreach (var guide in guides) { var nearest = GuideHelpers.NearestPointOnLine(guide.Point0, guide.Point1, point); var distance = GuideHelpers.Distance(nearest, point); if (distance < treshold) { hitGuide = guide; return(true); } } hitGuide = null; return(false); }