distance method

  1. @override
double? distance(
  1. Point from,
  2. Point to
)
override

Computes the 2D distance between from and to positions. This implementation ignores all Point.altitude values. from and to must have geometry-based coordinates; if this is not the case, the function returns null. See also DistanceCalculator3D.

Implementation

@override
double? distance(Point from, Point to) {
  if (!from.isGeometry || !to.isGeometry) return null;
  var dx = to.x! - from.x!;
  var dy = to.y! - from.y!;
  return sqrt(dx * dx + dy * dy);
}