public class Utils2D extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static double |
area2(java.awt.geom.Point2D a,
java.awt.geom.Point2D b,
java.awt.geom.Point2D c)
Calculates twice the area of a triangle for points specified in
counter-clockwise order (if the points are specified in clockwise order
the result will be negative).
|
static double |
calculateTheta(java.awt.geom.Line2D line)
Returns the angle of rotation (in radians) for the specified line.
|
static java.awt.geom.Point2D |
centerPoint(java.awt.geom.Point2D pt0,
java.awt.geom.Point2D pt1,
java.awt.geom.Point2D pt2,
java.awt.geom.Point2D pt3)
Returns the point in the center of the four supplied points.
|
static java.awt.geom.Line2D |
createPerpendicularLine(java.awt.geom.Line2D line,
double b,
double size,
java.awt.geom.Point2D opposingPoint)
Creates and returns a line that is perpendicular to the specified line.
|
static java.awt.geom.Line2D |
createPerpendicularLine(java.awt.geom.Line2D line,
java.awt.geom.Point2D pt1,
double size,
java.awt.geom.Point2D opposingPoint)
Creates and returns a line that is perpendicular to the specified
line.
|
static java.awt.Dimension |
findDimension(java.awt.geom.Point2D[] pts)
Returns the dimensions of the smallest rectangle that could contain
the supplied points.
|
static double |
length(java.awt.geom.Line2D line)
Returns the length of the line.
|
static boolean |
spans(double value,
double bound1,
double bound2)
Returns
true if the specified value is spanned by the
two bounds, and false otherwise. |
public static boolean spans(double value, double bound1, double bound2)
true if the specified value is spanned by the
two bounds, and false otherwise.value - the value.bound1 - the first boundary.bound2 - the second boundary.public static double area2(java.awt.geom.Point2D a, java.awt.geom.Point2D b, java.awt.geom.Point2D c)
a - the first point (null not permitted).b - the second point (null not permitted).c - the third point (null not permitted).public static java.awt.geom.Point2D centerPoint(java.awt.geom.Point2D pt0, java.awt.geom.Point2D pt1, java.awt.geom.Point2D pt2, java.awt.geom.Point2D pt3)
pt0 - point 0 (null not permitted).pt1 - point 1 (null not permitted).pt2 - point 2 (null not permitted).pt3 - point 3 (null not permitted).null).public static java.awt.Dimension findDimension(java.awt.geom.Point2D[] pts)
pts - an array of points (null not permitted).public static java.awt.geom.Line2D createPerpendicularLine(java.awt.geom.Line2D line, double b, double size, java.awt.geom.Point2D opposingPoint)
line - the reference line (null not permitted).b - the base point, expressed as a percentage along the length of
the reference line.size - the size or length of the perpendicular line.opposingPoint - an opposing point, to define which side of the
reference line the perpendicular line will extend (null
not permitted).public static java.awt.geom.Line2D createPerpendicularLine(java.awt.geom.Line2D line, java.awt.geom.Point2D pt1, double size, java.awt.geom.Point2D opposingPoint)
line - the reference line (null not permitted).pt1 - a point on the reference line (null not
permitted).size - the length of the new line.opposingPoint - an opposing point, to define which side of the
reference line the perpendicular line will extend (null
not permitted).public static double calculateTheta(java.awt.geom.Line2D line)
line - the line (null not permitted).public static double length(java.awt.geom.Line2D line)
line - the line (null not permitted).