|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.levigo.util.swing.Rectangles
public class Rectangles
A few utility methods related to Rectangle
s, Rectangle2D
s and
RectangularShape
s.
Method Summary | |
---|---|
static double |
area(Rectangle2D r)
|
static Rectangle2D |
dilate(Rectangle2D r,
double marginX,
double marginY)
Return a new rectangle which covers the area of the given rectangle with an additional margin on the sides. |
static Rectangle |
dilate(Rectangle r,
int marginX,
int marginY)
Return a new rectangle which covers the area of the given rectangle with an additional margin on the sides. |
static double |
distance(Rectangle2D r,
Point2D p)
Calculate the shortest distance from the point to any point within the given rectangle. |
static Rectangle |
enlargeToGrid(Rectangle2D r)
Create a rectangle with the same area as the given input rectangle but with all of its edges snapped (rounded) to the integer grid. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Rectangle enlargeToGrid(Rectangle2D r)
enlargeToGrid(r).contains(r) == true
holds. This can be depicted as the edges
being stretched in an outward direction.
r
-
public static double distance(Rectangle2D r, Point2D p)
r
- the rectanglep
- the point
public static Rectangle dilate(Rectangle r, int marginX, int marginY)
r
- marginX
- public static Rectangle2D dilate(Rectangle2D r, double marginX, double marginY)
r
- marginX
- public static double area(Rectangle2D r)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |