public final class GeometryUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static int |
distance(Point p1,
Point p2)
Returns distance between two points.
|
static Rectangle |
expand(Rectangle rect,
int expansion)
Returns rectangle expanded in four directions for the specified value.
|
static Rectangle |
expand(Rectangle rect,
int top,
int left,
int bottom,
int right)
Returns rectangle expanded in four directions for the specified values.
|
static Point |
findMiddleLineIntersection(Rectangle rect,
Point outer)
Returns intersection point of the rectangle and the line going 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(Point p1,
Point p2)
Returns angle between the line specified by points and y=0 line.
|
static Rectangle |
getContainingRect(List<Point> points)
Returns rectangle containing all specified points.
|
static Rectangle |
getContainingRect(Point... points)
Returns rectangle containing all specified points.
|
static Rectangle |
getContainingRect(Rectangle... rectangles)
Returns rectangle containing all specified rectangles.
|
static Rectangle |
getContainingRect(Rectangle r1,
Rectangle r2)
Returns rectangle containing two others.
|
static Rectangle |
getNonNullContainingRect(List<Point> points)
Returns rectangle containing all specified points.
|
static Rectangle |
getNonNullContainingRect(Point... points)
Returns rectangle containing all specified points.
|
static Rectangle |
getNonNullContainingRect(Rectangle... rectangles)
Returns rectangle containing all specified rectangles.
|
static Rectangle |
getNonNullContainingRect(Rectangle r1,
Rectangle r2)
Returns rectangle containing two others.
|
static Point |
middle(int x1,
int y1,
int x2,
int y2)
Returns middle point between the specified points.
|
static Point |
middle(Point p1,
Point p2)
Returns middle point between the specified points.
|
static Point |
middle(Rectangle rectangle)
Returns middle point for the specified rectangle.
|
static Point |
modify(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.
|
@Nullable public static Rectangle getContainingRect(@Nullable List<Point> points)
points - points to process@Nullable public static Rectangle getContainingRect(@Nullable Point... points)
points - points to process@Nullable public static Rectangle getContainingRect(@Nullable Rectangle... rectangles)
rectangles - rectangles to process@Nullable public static Rectangle getContainingRect(@Nullable Rectangle r1, @Nullable Rectangle r2)
r1 - first rectangler2 - second rectangle@NotNull public static Rectangle getNonNullContainingRect(@NotNull List<Point> points)
points - points to process@NotNull public static Rectangle getNonNullContainingRect(@NotNull Point... points)
points - points to process@NotNull public static Rectangle getNonNullContainingRect(@NotNull Rectangle... rectangles)
rectangles - rectangles to process@NotNull public static Rectangle getNonNullContainingRect(@NotNull Rectangle r1, @NotNull Rectangle r2)
r1 - first rectangler2 - second rectangle@NotNull public static Point middle(@NotNull Rectangle rectangle)
rectangle - rectangle to process@NotNull public static Point middle(@NotNull Point p1, @NotNull Point p2)
p1 - first pointp2 - second point@NotNull public static 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@NotNull public static Rectangle expand(@NotNull Rectangle rect, int expansion)
rect - rectangle to expandexpansion - expansion@NotNull public static Rectangle expand(@NotNull Rectangle rect, int top, int left, int bottom, int right)
rect - rectangle to expandtop - top expansionleft - left expansionbottom - bottom expansionright - right expansion@NotNull public static Point modify(@NotNull Point point, int xMod, int yMod)
point - point to modifyxMod - X coordinate modifieryMod - Y coordinate modifierpublic static double getAngle(@NotNull Point p1, @NotNull 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 coordinate@NotNull public static Point findMiddleLineIntersection(@NotNull Rectangle rect, @NotNull 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 convertCopyright © 2020. All rights reserved.