distanceFromAPoint method

double distanceFromAPoint(
  1. Point point
)

get the distance from a points to this line

Implementation

double distanceFromAPoint(Point point) {
  final distance =
      ((b.x - a.x) * (a.y - point.y) - (a.x - point.x) * (b.y - a.y)).abs() /
          sqrt(pow((b.x - a.x), 2) + pow((b.y - a.y), 2));

  return distance;
}