pointToLineDistanceM static method

double pointToLineDistanceM(
  1. LatLng p,
  2. LatLng a,
  3. LatLng b
)

Calculates the perpendicular distance in meters from point p to line segment a, b.

Implementation

static double pointToLineDistanceM(LatLng p, LatLng a, LatLng b) {
  LatLng nearest = nearestPointOnSegment(p, a, b);
  return haversineDistance(p, nearest);
}