|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectStatic
ShapeUtilities
public final class ShapeUtilities
Static methods operating on shapes from the java.awt.geom package.
| referencing/geotk-referencing (download) | View source code for this class |
| Method Summary | |
|---|---|
static Point2D.Double |
circleCentre(double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
Same as fitCircle(Point2D, Point2D, Point2D)
but using only primitive type arguments. |
static Point2D.Double |
colinearPoint(double x1,
double y1,
double x2,
double y2,
double x,
double y,
double distance)
Same as colinearPoint(Line2D, Point2D, double)
but using only primitive type arguments. |
static Point2D.Double |
colinearPoint(Line2D line,
Point2D point,
double distance)
Returns a point on the given line segment located at the given distance
from that line. |
static Line2D.Double |
cubicCurveExtremum(double x1,
double y1,
double dy1,
double x2,
double y2,
double dy2)
Same as cubicCurveExtremum(Point2D, double, Point2D, double)
but using only primitive type arguments. |
static Line2D.Double |
cubicCurveExtremum(Point2D P1,
double dy1,
Point2D P2,
double dy2)
Finds the extremum of the unique cubic curve which fit the two given points and derivatives. |
static Ellipse2D.Double |
fitCircle(Point2D P1,
Point2D P2,
Point2D P3)
Returns a circle passing by the 3 given points. |
static QuadCurve2D.Double |
fitParabol(double x0,
double y0,
double x1,
double y1,
double x2,
double y2,
boolean horizontal)
Same as fitParabol(Point2D, Point2D, Point2D, boolean)
but using only primitive type arguments. |
static QuadCurve2D.Double |
fitParabol(Point2D P0,
Point2D P1,
Point2D P2,
boolean horizontal)
Returns a quadratic curve passing by the 3 given points. |
static double |
getFlatness(Shape shape)
Returns a suggested value for the flatness argument in
Shape.getPathIterator(AffineTransform,double) for the specified shape. |
static Point2D.Double |
intersectionPoint(double ax1,
double ay1,
double ax2,
double ay2,
double bx1,
double by1,
double bx2,
double by2)
Same as intersectionPoint(Line2D, Line2D)
but using only primitive type arguments. |
static Point2D.Double |
intersectionPoint(Line2D a,
Line2D b)
Returns the intersection point between two line segments. |
static Point2D.Double |
nearestColinearPoint(double x1,
double y1,
double x2,
double y2,
double x,
double y)
Same as nearestColinearPoint(Line2D, Point2D)
but using only primitive type arguments. |
static Point2D.Double |
nearestColinearPoint(Line2D segment,
Point2D point)
Returns the point on the given line segment which is closest to the given
point. |
static Point2D.Double |
parabolicControlPoint(double x0,
double y0,
double x1,
double y1,
double x2,
double y2,
boolean horizontal)
Same as parabolicControlPoint(Point2D, Point2D, Point2D, boolean)
but using only primitive type arguments. |
static Point2D |
parabolicControlPoint(double x0,
double y0,
double x1,
double y1,
double x2,
double y2,
boolean horizontal,
Point2D dest)
Deprecated. The dest argument has been removed for consistency with other methods
in this class. |
static Point2D.Double |
parabolicControlPoint(Point2D P0,
Point2D P1,
Point2D P2,
boolean horizontal)
Returns the control point of a quadratic curve passing by the 3 given points. |
static Shape |
toPrimitive(Shape path)
Attempts to replace an arbitrary shape by one of the standard Java2D constructs. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Point2D.Double intersectionPoint(Line2D a,
Line2D b)
null.
a - The first line segment.b - The second line segment.
null if none.
public static Point2D.Double intersectionPoint(double ax1,
double ay1,
double ax2,
double ay2,
double bx1,
double by1,
double bx2,
double by2)
intersectionPoint(Line2D, Line2D)
but using only primitive type arguments.
ax1 - x value of the first point on the first line.ay1 - y value of the first point on the first line.ax2 - x value of the last point on the first line.ay2 - y value of the last point on the first line.bx1 - x value of the first point on the second line.by1 - y value of the first point on the second line.bx2 - x value of the last point on the second line.by2 - y value of the last point on the second line.
null if none.
public static Point2D.Double nearestColinearPoint(Line2D segment,
Point2D point)
line segment which is closest to the given
point. Let result be the returned point. This method guarantees
(except for rounding errors) that:
result is a point on the line segment. It is located between
the P1 and P2 ending points
of that line segment.result point and the given point is
the shortest distance among the set of points meeting the previous condition.
This distance can be obtained with point.distance(result).
segment - The line on which to search for a point.point - A point close to the given line.
colinearPoint(Line2D, Point2D, double)
public static Point2D.Double nearestColinearPoint(double x1,
double y1,
double x2,
double y2,
double x,
double y)
nearestColinearPoint(Line2D, Point2D)
but using only primitive type arguments.
x1 - x value of the first point on the line.y1 - y value of the first point on the line.x2 - x value of the last point on the line.y2 - y value of the last point on the line.x - x value of a point close to the given line.y - y value of a point close to the given line.
colinearPoint(double,double , double,double , double,double , double)
public static Point2D.Double colinearPoint(Line2D line,
Point2D point,
double distance)
line segment located at the given distance
from that line. Let result be the returned point. If result is not null,
then this method guarantees (except for rounding error) that:
result is a point on the line segment. It is located between
the P1 and P2 ending points
of that line segment.result and the given point is exactly
equal to distance.
If no result point meets those conditions, then this method returns null.
If two result points meet those conditions, then this method returns the point
which is the closest to line.getP1().
line - The line on which to search for a point.point - A point close to the given line.distance - The distance between the given point and the point to be returned.
nearestColinearPoint(Line2D, Point2D)
public static Point2D.Double colinearPoint(double x1,
double y1,
double x2,
double y2,
double x,
double y,
double distance)
colinearPoint(Line2D, Point2D, double)
but using only primitive type arguments.
x1 - x value of the first point on the line.y1 - y value of the first point on the line.x2 - x value of the last point on the line.y2 - y value of the last point on the line.x - x value of a point close to the given line.y - y value of a point close to the given line.distance - The distance between the given point and the point to be returned.
nearestColinearPoint(double,double , double,double , double,double)
public static QuadCurve2D.Double fitParabol(Point2D P0,
Point2D P1,
Point2D P2,
boolean horizontal)
y=ax²+bx+c but where the x axis is not necessarily
horizontal. The orientation of the x axis in the above equation is determined
by the horizontal parameter:
true means that the x axis must be horizontal.
The quadratic curve will then look like an ordinary parabolic curve as we see
in mathematic school book.false means that the x axis must be parallel to the
line segment joining the P0 and P2 ending points.
Note that if P0.y == P2.y, then both horizontal values produce the same
result.
P0 - The starting point of the quadratic curve.P1 - A point by which the quadratic curve must pass by.P2 - The ending point of the quadratic curve.horizontal - If true, the x axis is considered horizontal while
computing the y=ax²+bx+c equation terms. If false, it is considered
parallel to the line joining the P0 and P2 points.
P0 and
ends at P2. If two points are too close or if the three points are colinear,
then this method returns null.
public static QuadCurve2D.Double fitParabol(double x0,
double y0,
double x1,
double y1,
double x2,
double y2,
boolean horizontal)
fitParabol(Point2D, Point2D, Point2D, boolean)
but using only primitive type arguments.
x0 - x value of the starting point.y0 - y value of the starting point.x1 - x value of a passing point.y1 - y value of a passing point.x2 - x value of the ending point.y2 - y value of the ending point.horizontal - If true, the x axis is considered horizontal while
computing the y=ax²+bx+c equation terms. If false, it is considered
parallel to the line joining the P0 and P2 points.
(x0,y0)
and ends at (x2,y2). If two points are too close or if the three points are
colinear, then this method returns null.
public static Point2D.Double parabolicControlPoint(Point2D P0,
Point2D P1,
Point2D P2,
boolean horizontal)
y=ax²+bx+c but where the x axis
is not necessarily horizontal. The orientation of the x axis in the above equation
is determined by the horizontal parameter:
true means that the x axis must be horizontal.
The quadratic curve will then look like an ordinary parabolic curve as we see
in mathematic school book.false means that the x axis must be parallel to the
line segment joining the P0 and P2 ending points.
Note that if P0.y == P2.y, then both horizontal values produce the same result.
P0 - The starting point of the quadratic curve.P1 - A point by which the quadratic curve must pass by.P2 - The ending point of the quadratic curve.horizontal - If true, the x axis is considered horizontal while
computing the y=ax²+bx+c equation terms. If false, it is considered
parallel to the line joining the P0 and P2 points.
P0 and ends at P2. If two points are too
close or if the three points are colinear, then this method returns null.
public static Point2D.Double parabolicControlPoint(double x0,
double y0,
double x1,
double y1,
double x2,
double y2,
boolean horizontal)
parabolicControlPoint(Point2D, Point2D, Point2D, boolean)
but using only primitive type arguments.
x0 - x value of the starting point.y0 - y value of the starting point.x1 - x value of a passing point.y1 - y value of a passing point.x2 - x value of the ending point.y2 - y value of the ending point.horizontal - If true, the x axis is considered horizontal while
computing the y=ax²+bx+c equation terms. If false, it is considered
parallel to the line joining the P0 and P2 points.
(x0,y0) and ends at (x2,y2). If two points are too
close or if the three points are colinear, then this method returns null.
@Deprecated
public static Point2D parabolicControlPoint(double x0,
double y0,
double x1,
double y1,
double x2,
double y2,
boolean horizontal,
Point2D dest)
dest argument has been removed for consistency with other methods
in this class.
public static Ellipse2D.Double fitCircle(Point2D P1,
Point2D P2,
Point2D P3)
P1 - The first point.P2 - The second point.P3 - The third point.
public static Point2D.Double circleCentre(double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
fitCircle(Point2D, Point2D, Point2D)
but using only primitive type arguments.
x1 - x value of the first point.y1 - y value of the first point.x2 - x value of the second point.y2 - y value of the second point.x3 - x value of the third point.y3 - y value of the third point.
public static Line2D.Double cubicCurveExtremum(Point2D P1,
double dy1,
Point2D P2,
double dy2)
Line2D construct in
no particular order. The length of the returned line is the distance separating the two
extremum (often a useful information for determining if a quadratic equation would be a
sufficient approximation).
The line returned by this method may contains NaN values if the
given geometry is actually a line segment (dy1 = dy2 = slope from P1 to
P2).
P1 - The first point.dy1 - The ∂x/∂y value at the first point.P2 - The second point.dy2 - The ∂x/∂y value at the second point.
public static Line2D.Double cubicCurveExtremum(double x1,
double y1,
double dy1,
double x2,
double y2,
double dy2)
cubicCurveExtremum(Point2D, double, Point2D, double)
but using only primitive type arguments.
x1 - The x ordinate of the first point.y1 - The y ordinate of the first point.dy1 - The ∂x/∂y value at the first point.x2 - The x ordinate of the second point.y2 - The y ordinate of the second point.dy2 - The ∂x/∂y value at the second point.
public static Shape toPrimitive(Shape path)
path is a Path2D containing only a single
line or a quadratic curve, then this method replaces it by a Line2D or
QuadCurve2D object respectively.
path - The shape to replace by a simpler Java2D construct. This is generally
an instance of Path2D, but doesn't have to.
path if no better construct is proposed.public static double getFlatness(Shape shape)
flatness argument in
Shape.getPathIterator(AffineTransform,double) for the specified shape.
shape - The shape for which to compute a flatness factor.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||