maximumDistance static method
Computes the maximum distance between the points defining two envelopes. It is equal to the length of the diagonal of the envelope containing both input envelopes. This is a coarse upper bound on the distance between geometries bounded by the envelopes.
@param env1 an envelope @param env2 an envelope @return the maximum distance between the points defining the envelopes
Implementation
static double maximumDistance(Envelope env1, Envelope env2) {
double minx = math.min(env1.getMinX(), env2.getMinX());
double miny = math.min(env1.getMinY(), env2.getMinY());
double maxx = math.max(env1.getMaxX(), env2.getMaxX());
double maxy = math.max(env1.getMaxY(), env2.getMaxY());
return distance(minx, miny, maxx, maxy);
}