public final class Shapes2D extends Static
transform(…)
methods in this class work in the same way than the methods of the same signature
in Envelopes
, except that they work on Rectangle2D
objects instead than Envelope
.
In particular, the same treatment for curvatures and poles is applied.Defined in the sis-referencing
module
Modifier and Type | Method and Description |
---|---|
static Ellipse2D |
circle(Point2D P1,
Point2D P2,
Point2D P3)
Returns a circle passing by the 3 given points.
|
static Point2D |
colinearPoint(Line2D line,
Point2D point,
double distance)
Returns a point on the given
line segment located at the given distance from that line. |
static Point2D |
intersectionPoint(Line2D a,
Line2D b)
Returns the intersection point between two line segments.
|
static Point2D |
nearestColinearPoint(Line2D segment,
Point2D point)
Returns the point on the given
line segment which is closest to the given point . |
static Rectangle2D |
transform(CoordinateOperation operation,
Rectangle2D envelope,
Rectangle2D destination)
Transforms a rectangular envelope using the given coordinate operation.
|
static Rectangle2D |
transform(MathTransform2D transform,
Rectangle2D envelope,
Rectangle2D destination)
Transforms a rectangular envelope using the given math transform.
|
public static Point2D intersectionPoint(Line2D a, Line2D b)
null
.a
- the first line segment.b
- the second line segment.null
if none.public static Point2D 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 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
.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 Ellipse2D circle(Point2D P1, Point2D P2, Point2D P3)
P1
- the first point.P2
- the second point.P3
- the third point.public static Rectangle2D transform(MathTransform2D transform, Rectangle2D envelope, Rectangle2D destination) throws TransformException
Note that this method can not handle the case where the rectangle contains the North or South pole,
or when it cross the ±180° longitude, because MathTransform
does not carry sufficient informations.
For a more robust rectangle transformation, use transform(CoordinateOperation, Rectangle2D, Rectangle2D)
instead.
transform
- the transform to use. Source and target dimension must be 2.envelope
- the rectangle to transform (may be null
).destination
- the destination rectangle (may be envelope
).
If null
, a new rectangle will be created and returned.destination
, or a new rectangle if destination
was non-null and envelope
was null.TransformException
- if a transform failed.transform(CoordinateOperation, Rectangle2D, Rectangle2D)
,
Envelopes.transform(MathTransform, Envelope)
public static Rectangle2D transform(CoordinateOperation operation, Rectangle2D envelope, Rectangle2D destination) throws TransformException
This method can handle the case where the rectangle contains the North or South pole, or when it cross the ±180° longitude.
operation
- the operation to use. Source and target dimension must be 2.envelope
- the rectangle to transform (may be null
).destination
- the destination rectangle (may be envelope
).
If null
, a new rectangle will be created and returned.destination
, or a new rectangle if destination
was non-null and envelope
was null.TransformException
- if a transform failed.transform(MathTransform2D, Rectangle2D, Rectangle2D)
,
Envelopes.transform(CoordinateOperation, Envelope)
Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.