public static Point2double ReflectPoint(this Line2double l, Point2double p) { var m = l.Slope(); var c = l.YIntercept(); var d = (p.X + (p.Y - c) * m) / (1 + m * m); var x = 2 * d - p.X; var y = 2 * d * m - p.Y + 2 * c; return(new(x, y)); }
public static double YIntercept(this Line2double l) => l.P1.Y - l.Slope() * l.P1.X;