code: public double sqrDistance(Envelope2D other)
  	{
  		double dx = 0;
  		double dy = 0;
  		double nn;
  
  		nn = xmin - other.xmax;
  		if (nn > dx)
  			dx = nn;
  
  		nn = ymin - other.ymax;
  		if (nn > dy)
  			dy = nn;
  
  		nn = other.xmin - xmax;
  		if (nn > dx)
  			dx = nn;
  
  		nn = other.ymin - ymax;
  		if (nn > dy)
  			dy = nn;
  
  		return dx * dx + dy * dy;
  	}
docs: Calculates minimum squared distance from this envelope to the other.
  Returns 0 for empty envelopes.
  @param other The other envelope.
  @return Returns the squared distance