public final class GeometryUtils
extends java.lang.Object
| Constructor and Description |
|---|
GeometryUtils() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
public static java.awt.Rectangle getContainingRect(java.util.List<java.awt.Point> points)
points - points to processpublic static java.awt.Rectangle getContainingRect(java.awt.Point... points)
points - points to processpublic static java.awt.Rectangle getContainingRect(java.awt.Rectangle... rects)
rects - rectangles to processpublic static java.awt.Rectangle getContainingRect(java.awt.Rectangle r1,
java.awt.Rectangle r2)
r1 - first rectangler2 - second rectanglepublic static java.awt.Rectangle validateRect(java.awt.Rectangle rect)
rect - rectangle to validatepublic static java.awt.Point middle(java.awt.Rectangle rectangle)
rectangle - rectangle to processpublic static java.awt.Point middle(java.awt.Point p1,
java.awt.Point p2)
p1 - first pointp2 - second pointpublic 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 coordinatepublic static java.awt.Rectangle expand(java.awt.Rectangle rect,
int expansion)
rect - rectangle to expandexpansion - expansionpublic 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 expansionpublic static java.awt.Point modify(java.awt.Point point,
int xMod,
int yMod)
point - point to modifyxMod - X coordinate modifieryMod - Y coordinate modifierpublic static double getAngle(java.awt.Point p1,
java.awt.Point p2)
p1 - first line pointp2 - second line pointpublic 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 coordinatepublic static java.awt.Point findMiddleLineIntersection(java.awt.Rectangle rect,
java.awt.Point outer)
rect - rectangle to processouter - outer point to processpublic static double toRadians(double angle)
angle - angle to convertpublic static double toDegrees(double angle)
angle - angle to convert