maxDistance static method

double maxDistance(
  1. double ax1,
  2. double ay1,
  3. double ax2,
  4. double ay2,
  5. double bx1,
  6. double by1,
  7. double bx2,
  8. double by2,
)

Computes the maximum distance between two line segments.

@param ax1 x ordinate of first endpoint of segment 1 @param ay1 y ordinate of first endpoint of segment 1 @param ax2 x ordinate of second endpoint of segment 1 @param ay2 y ordinate of second endpoint of segment 1 @param bx1 x ordinate of first endpoint of segment 2 @param by1 y ordinate of first endpoint of segment 2 @param bx2 x ordinate of second endpoint of segment 2 @param by2 y ordinate of second endpoint of segment 2 @return maximum distance between the segments

Implementation

static double maxDistance(double ax1, double ay1, double ax2, double ay2,
    double bx1, double by1, double bx2, double by2) {
  double dist = distance(ax1, ay1, bx1, by1);
  dist = math.max(dist, distance(ax1, ay1, bx2, by2));
  dist = math.max(dist, distance(ax2, ay2, bx1, by1));
  dist = math.max(dist, distance(ax2, ay2, bx2, by2));
  return dist;
}