public final class GeometryUtil
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
GeometryUtil.AbsoluteVolumeVisitor |
static interface |
GeometryUtil.AllPlaneVisitor |
static interface |
GeometryUtil.LineVisitor |
static interface |
GeometryUtil.PlaneVisitor |
static interface |
GeometryUtil.VolumeVisitor |
Modifier and Type | Method and Description |
---|---|
static float[][] |
getDistancesToCentre(float radius)
Create a 2D matrix of the relative distances of all the points on the face of a square in which a circle of a
specified radius would exactly fit in an integer coordinate space to the centre at 0,0.
|
static java.util.List<java.awt.Point> |
getFilledCircleCoordinates(float radius)
Create a list of the relative coordinates of all the points on the face of a filled circular disk in an integer
coordinate space with the centre at 0,0.
|
static void |
visitAllOfFilledCircle(float radius,
GeometryUtil.AllPlaneVisitor visitor)
Visit all the points on the face of a filled circular disk in an integer coordinate space with the centre at 0,0.
|
static boolean |
visitCircle(int radius,
GeometryUtil.PlaneVisitor visitor)
Visit all the points along the outline of a circle in an integer
coordinate space with the centre at 0,0.
|
static boolean |
visitFilledAbsoluteSphere(double x,
double y,
double z,
float radius,
GeometryUtil.AbsoluteVolumeVisitor visitor)
Visit all the points in integer coordinate space inside a spherical volume in a floating point coordinate space
with a specified center.
|
static boolean |
visitFilledCircle(int radius,
GeometryUtil.PlaneVisitor visitor)
Visit all the points on the face of a filled circular disk in an integer
coordinate space with the centre at 0,0.
|
static boolean |
visitFilledSphere(int radius,
GeometryUtil.VolumeVisitor visitor)
Visit all the points inside a spherical volume in an integer coordinate
space with the centre at 0,0,0.
|
static boolean |
visitLine(int x1,
int y1,
int x2,
int y2,
GeometryUtil.LineVisitor visitor)
Visit all the points along a straight line on a 2D plane.
|
static boolean |
visitLine(int x1,
int y1,
int x2,
int y2,
int every,
GeometryUtil.LineVisitor visitor)
Visit all the points along a straight line on a 2D plane.
|
public static boolean visitCircle(int radius, GeometryUtil.PlaneVisitor visitor)
false
.radius
- The radius of the circle to visit.visitor
- The visitor to invoke for each point.true
if the visitor returned true for each point
(and therefore every point was visited). false
if the
visitor returned false
for some point and the process
was aborted.public static boolean visitFilledCircle(int radius, GeometryUtil.PlaneVisitor visitor)
false
.radius
- The radius of the circle to visit.visitor
- The visitor to invoke for each point.true
if the visitor returned true for each point
(and therefore every point was visited). false
if the
visitor returned false
for some point and the process
was aborted.public static void visitAllOfFilledCircle(float radius, GeometryUtil.AllPlaneVisitor visitor)
radius
- The radius of the circle to visit.visitor
- The visitor to invoke for each point.public static java.util.List<java.awt.Point> getFilledCircleCoordinates(float radius)
radius
- The radius of the circle.public static float[][] getDistancesToCentre(float radius)
radius
- The radius of the circle that should fit in the square.public static boolean visitFilledSphere(int radius, GeometryUtil.VolumeVisitor visitor)
false
.radius
- The radius of the sphere to visit.visitor
- The visitor to invoke for each point.true
if the visitor returned true for each point
(and therefore every point was visited). false
if the
visitor returned false
for some point and the process
was aborted.public static boolean visitFilledAbsoluteSphere(double x, double y, double z, float radius, GeometryUtil.AbsoluteVolumeVisitor visitor)
false
.x
- The X coordinate of the center of the spherey
- The Y coordinate of the center of the spherez
- The Z coordinate of the center of the sphereradius
- The radius of the sphere to visit.visitor
- The visitor to invoke for each point.true
if the visitor returned true for each point (and therefore every point was visited).
false
if the visitor returned false
for some point and the process was aborted.public static boolean visitLine(int x1, int y1, int x2, int y2, GeometryUtil.LineVisitor visitor)
false
.x1
- The X coordinate of the start of the line.y1
- The Y coordinate of the start of the line.x2
- The X coordinate of the end of the line.y2
- The Y coordinate of the end of the line.visitor
- The visitor to invoke for each point.true
if the visitor returned true for each point
(and therefore every point was visited). false
if the
visitor returned false
for some point and the process
was aborted.public static boolean visitLine(int x1, int y1, int x2, int y2, int every, GeometryUtil.LineVisitor visitor)
false
. Points on
the line can optionally be skipped by specifying the every
parameter larger than one.x1
- The X coordinate of the start of the line.y1
- The Y coordinate of the start of the line.x2
- The X coordinate of the end of the line.y2
- The Y coordinate of the end of the line.every
- The interval between performances of the specified task.visitor
- The visitor to invoke for each point.true
if the visitor returned true for each point
(and therefore every point was visited). false
if the
visitor returned false
for some point and the process
was aborted.