perpendicularFoot method

Coord perpendicularFoot(
  1. Coord point
)

Value of the perpendicular foot from a point on the line. i.e the intersection of the perpendicular

Using Eqn:- (x - x1) / a = (y - y1) / b = -(ax1 + by1 + c) / (a^2 + b^2)

Implementation

Coord perpendicularFoot(Coord point) {
  final numerator = -evaluate(point);
  final denominator = (slope.a.sq + slope.b.sq);
  return (
    ((numerator * slope.a) / denominator) + point.$1,
    ((numerator * slope.b) / denominator) + point.$2
  );
}