code: public double sqrDistance(double xmin_, double ymin_, double xmax_, double ymax_)
  	{
  		double dx = 0;
  		double dy = 0;
  		double nn;
  
  		nn = xmin - xmax_;
  		if (nn > dx)
  			dx = nn;
  
  		nn = ymin - ymax_;
  		if (nn > dy)
  			dy = nn;
  
  		nn = xmin_ - xmax;
  		if (nn > dx)
  			dx = nn;
  
  		nn = 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 xmin_
  @param ymin_
  @param xmax_
  @param ymax_
  @return Returns the squared distance.