public static bool IsOnLine(Point2d p1, Point2d p2, double x, double y, double w) { var s1 = p1.Distance(x, y); var s2 = p2.Distance(x, y); var s3 = p1.Distance(p2); var d = (s3 * s3 + s1 * s1 - s2 * s2) / (2 * s3); if (d >= 0 && d <= s3) { var hh = s1 * s1 - d * d; if (hh < w * w) { return(true); } } return(false); }
public static bool IsOnCircle(Point2d p1, Point2d center, double radius, double w) { var distance = p1.Distance(center); if (distance > (radius + w)) { return(false); } else { return(true); } }