/** * Computes and returns the point inside the bounds of the rectangle that's closest to the * given point. */ public static Point closestInteriorPoint (IRectangle r, IPoint p) { return closestInteriorPoint(r, p, new Point()); }
/** * Returns the Euclidean distance between the given point and the nearest point inside the * bounds of the given rectangle. If the supplied point is inside the rectangle, the distance * will be zero. */ public static float pointRectDistance (IRectangle r, IPoint p) { return FloatMath.sqrt(pointRectDistanceSq(r, p)); } }
/** * Computes and returns the point inside the bounds of the rectangle that's closest to the * given point. */ public static Point closestInteriorPoint (IRectangle r, IPoint p) { return closestInteriorPoint(r, p, new Point()); }
/** * Returns the Euclidean distance between the given point and the nearest point inside the * bounds of the given rectangle. If the supplied point is inside the rectangle, the distance * will be zero. */ public static float pointRectDistance (IRectangle r, IPoint p) { return FloatMath.sqrt(pointRectDistanceSq(r, p)); } }
/** * Returns the squared Euclidean distance between the given point and the nearest point inside * the bounds of the given rectangle. If the supplied point is inside the rectangle, the * distance will be zero. */ public static float pointRectDistanceSq (IRectangle r, IPoint p) { Point p2 = closestInteriorPoint(r, p); return Points.distanceSq(p.x(), p.y(), p2.x, p2.y); }
/** * Returns the squared Euclidean distance between the given point and the nearest point inside * the bounds of the given rectangle. If the supplied point is inside the rectangle, the * distance will be zero. */ public static float pointRectDistanceSq (IRectangle r, IPoint p) { Point p2 = closestInteriorPoint(r, p); return Points.distanceSq(p.x(), p.y(), p2.x, p2.y); }