distance method

double distance(
  1. Coordinate c
)

Computes the 2-dimensional Euclidean distance to another location. The Z-ordinate is ignored.

@param c a point @return the 2-dimensional Euclidean distance between the locations

Implementation

double distance(Coordinate c) {
  double dx = x - c.x;
  double dy = y - c.y;
  return math.sqrt(dx * dx + dy * dy);
}