|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.alee.utils.GeometryUtils
public final class GeometryUtils
This class provides a set of utilities to work with points and various shapes.
Constructor Summary | |
---|---|
GeometryUtils()
|
Method Summary | |
---|---|
static java.awt.Rectangle |
expand(java.awt.Rectangle rect,
int expansion)
Returns rectangle expanded in four directions for the specified value. |
static java.awt.Rectangle |
expand(java.awt.Rectangle rect,
int top,
int left,
int bottom,
int right)
Returns rectangle expanded in four directions for the specified values. |
static java.awt.Point |
findMiddleLineIntersection(java.awt.Rectangle rect,
java.awt.Point outer)
Returns intersection point of the rectangle and the line goin from the middle of that rectangle to the outer point. |
static double |
getAngle(int x1,
int y1,
int x2,
int y2)
Returns angle between the line specified by points and y=0 line. |
static double |
getAngle(java.awt.Point p1,
java.awt.Point p2)
Returns angle between the line specified by points and y=0 line. |
static java.awt.Rectangle |
getContainingRect(java.util.List<java.awt.Point> points)
Returns rectangle containing all specified points. |
static java.awt.Rectangle |
getContainingRect(java.awt.Point... points)
Returns rectangle containing all specified points. |
static java.awt.Rectangle |
getContainingRect(java.awt.Rectangle... rects)
Returns rectangle containing all specified rectangles. |
static java.awt.Rectangle |
getContainingRect(java.awt.Rectangle r1,
java.awt.Rectangle r2)
Returns rectangle containing two others. |
static java.awt.Point |
middle(int x1,
int y1,
int x2,
int y2)
Returns middle point between the specified points. |
static java.awt.Point |
middle(java.awt.Point p1,
java.awt.Point p2)
Returns middle point between the specified points. |
static java.awt.Point |
middle(java.awt.Rectangle rectangle)
Returns middle point for the specified rectangle. |
static java.awt.Point |
modify(java.awt.Point point,
int xMod,
int yMod)
Returns modified point. |
static double |
toDegrees(double angle)
Returns angle converted into degrees. |
static double |
toRadians(double angle)
Returns angle converted into radians. |
static java.awt.Rectangle |
validateRect(java.awt.Rectangle rect)
Returns valid rectangle with non-negative width and height. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GeometryUtils()
Method Detail |
---|
public static java.awt.Rectangle getContainingRect(java.util.List<java.awt.Point> points)
points
- points to process
public static java.awt.Rectangle getContainingRect(java.awt.Point... points)
points
- points to process
public static java.awt.Rectangle getContainingRect(java.awt.Rectangle... rects)
rects
- rectangles to process
public static java.awt.Rectangle getContainingRect(java.awt.Rectangle r1, java.awt.Rectangle r2)
r1
- first rectangler2
- second rectangle
public static java.awt.Rectangle validateRect(java.awt.Rectangle rect)
rect
- rectangle to validate
public static java.awt.Point middle(java.awt.Rectangle rectangle)
rectangle
- rectangle to process
public static java.awt.Point middle(java.awt.Point p1, java.awt.Point p2)
p1
- first pointp2
- second point
public static java.awt.Point middle(int x1, int y1, int x2, int y2)
x1
- first point X coordinatey1
- first point Y coordinatex2
- second point X coordinatey2
- second point Y coordinate
public static java.awt.Rectangle expand(java.awt.Rectangle rect, int expansion)
rect
- rectangle to expandexpansion
- expansion
public static java.awt.Rectangle expand(java.awt.Rectangle rect, int top, int left, int bottom, int right)
rect
- rectangle to expandtop
- top expansionleft
- left expansionbottom
- bottom expansionright
- right expansion
public static java.awt.Point modify(java.awt.Point point, int xMod, int yMod)
point
- point to modifyxMod
- X coordinate modifieryMod
- Y coordinate modifier
public static double getAngle(java.awt.Point p1, java.awt.Point p2)
p1
- first line pointp2
- second line point
public static double getAngle(int x1, int y1, int x2, int y2)
x1
- first point X coordinatey1
- first point Y coordinatex2
- second point X coordinatey2
- second point Y coordinate
public static java.awt.Point findMiddleLineIntersection(java.awt.Rectangle rect, java.awt.Point outer)
rect
- rectangle to processouter
- outer point to process
public static double toRadians(double angle)
angle
- angle to convert
public static double toDegrees(double angle)
angle
- angle to convert
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |