distance static method

double distance(
  1. double aX,
  2. double aY,
  3. double bX,
  4. double bY,
)

@param aX point A x coordinate @param aY point A y coordinate @param bX point B x coordinate @param bY point B y coordinate @return Euclidean distance between points A and B

Implementation

static double distance(double aX, double aY, double bX, double bY) {
  final xDiff = aX - bX;
  final yDiff = aY - bY;
  return math.sqrt(xDiff * xDiff + yDiff * yDiff);
}