public double sqrDistance(Point2D pt2D)
	{
		double dx = 0;
		double dy = 0;
		double nn;

		nn = xmin - pt2D.x;
		if (nn > dx)
			dx = nn;

		nn = ymin - pt2D.y;
		if (nn > dy)
			dy = nn;

		nn = pt2D.x - xmax;
		if (nn > dx)
			dx = nn;

		nn = pt2D.y - ymax;
		if (nn > dy)
			dy = nn;

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