public final class Lines extends Object
Line
and LineSubset
instances.Modifier and Type | Method and Description |
---|---|
static Line |
fromPointAndAngle(Vector2D pt,
double angle,
Precision.DoubleEquivalence precision)
Create a line from a point lying on the line and an angle relative to the abscissa (x) axis.
|
static Line |
fromPointAndDirection(Vector2D pt,
Vector2D dir,
Precision.DoubleEquivalence precision)
Create a line from a point and direction.
|
static Line |
fromPoints(Vector2D p1,
Vector2D p2,
Precision.DoubleEquivalence precision)
Create a line from two points lying on the line.
|
static Ray |
rayFromLocation(Line line,
double startLocation)
Construct a ray starting at the given 1D location on
line and continuing in the
direction of the line to infinity. |
static Ray |
rayFromPoint(Line line,
Vector2D startPoint)
Construct a ray starting at the given point and continuing to infinity in the direction
of
line . |
static Ray |
rayFromPointAndDirection(Vector2D startPoint,
Vector2D direction,
Precision.DoubleEquivalence precision)
Construct a ray from a start point and a direction.
|
static ReverseRay |
reverseRayFromLocation(Line line,
double endLocation)
Construct a reverse ray starting at infinity and continuing in the direction of
line
to the given 1D end location. |
static ReverseRay |
reverseRayFromPoint(Line line,
Vector2D endPoint)
Construct a reverse ray starting at infinity and continuing in the direction of
line
to the given end point. |
static ReverseRay |
reverseRayFromPointAndDirection(Vector2D endPoint,
Vector2D lineDirection,
Precision.DoubleEquivalence precision)
Construct a reverse ray from an end point and a line direction.
|
static Segment |
segmentFromLocations(Line line,
double a,
double b)
Construct a new line segment from a pair of 1D locations on a line.
|
static Segment |
segmentFromPoints(Line line,
Vector2D a,
Vector2D b)
Construct a new line segment from a line and a pair of points.
|
static Segment |
segmentFromPoints(Vector2D startPoint,
Vector2D endPoint,
Precision.DoubleEquivalence precision)
Construct a new line segment from two points.
|
static LineConvexSubset |
span(Line line)
Create a
LineConvexSubset spanning the entire line. |
static LineConvexSubset |
subsetFromInterval(Line line,
double a,
double b)
Create a line subset from a line and a 1D interval on the line.
|
static LineConvexSubset |
subsetFromInterval(Line line,
Interval interval)
Create a line subset from a line and a 1D interval on the line.
|
public static Line fromPoints(Vector2D p1, Vector2D p2, Precision.DoubleEquivalence precision)
p1
to p2
.p1
- first pointp2
- second pointprecision
- precision context used to compare floating point valuesp1
and p2
and pointing in the direction
from p1
to p2
IllegalArgumentException
- If the vector between p1
and p2
has zero length,
as evaluated by the given precision contextpublic static Line fromPointAndDirection(Vector2D pt, Vector2D dir, Precision.DoubleEquivalence precision)
pt
- point belonging to the linedir
- the direction of the lineprecision
- precision context used to compare floating point valuespt
and pointing in direction dir
IllegalArgumentException
- If dir
has zero length, as evaluated by the
given precision contextpublic static Line fromPointAndAngle(Vector2D pt, double angle, Precision.DoubleEquivalence precision)
pt
- point belonging to the lineangle
- angle of the line with respect to abscissa (x) axis, in radiansprecision
- precision context used to compare floating point valuespt
and forming the given angle with the
abscissa (x) axis.public static Ray rayFromPointAndDirection(Vector2D startPoint, Vector2D direction, Precision.DoubleEquivalence precision)
startPoint
- ray start pointdirection
- ray directionprecision
- precision context used for floating point comparisonsIllegalArgumentException
- If direction
has zero length, as evaluated by the
given precision contextfromPointAndDirection(Vector2D, Vector2D, Precision.DoubleEquivalence)
public static Ray rayFromPoint(Line line, Vector2D startPoint)
line
. The given point is projected onto the line.line
- line for the raystartPoint
- start point for the rayline
IllegalArgumentException
- if any coordinate in startPoint
is NaN or infinitepublic static Ray rayFromLocation(Line line, double startLocation)
line
and continuing in the
direction of the line to infinity.line
- line for the raystartLocation
- 1D location of the ray start pointline
IllegalArgumentException
- if startLocation
is NaN or infinitepublic static ReverseRay reverseRayFromPointAndDirection(Vector2D endPoint, Vector2D lineDirection, Precision.DoubleEquivalence precision)
endPoint
- instance end pointlineDirection
- line directionprecision
- precision context used for floating point comparisonsIllegalArgumentException
- If lineDirection
has zero length, as evaluated by the
given precision contextfromPointAndDirection(Vector2D, Vector2D, Precision.DoubleEquivalence)
public static ReverseRay reverseRayFromPoint(Line line, Vector2D endPoint)
line
to the given end point. The point is projected onto the line.line
- line for the instanceendPoint
- end point for the instanceendPoint
IllegalArgumentException
- if any coordinate in endPoint
is NaN or infinitepublic static ReverseRay reverseRayFromLocation(Line line, double endLocation)
line
to the given 1D end location.line
- line for the instanceendLocation
- 1D location of the instance end pointline
to the given 1D end locationIllegalArgumentException
- if endLocation
is NaN or infinitepublic static Segment segmentFromPoints(Vector2D startPoint, Vector2D endPoint, Precision.DoubleEquivalence precision)
startPoint
to endPoint
.startPoint
- segment start pointendPoint
- segment end pointprecision
- precision context to use for floating point comparisonsIllegalArgumentException
- If the vector between startPoint
and endPoint
has zero length,
as evaluated by the given precision contextpublic static Segment segmentFromPoints(Line line, Vector2D a, Vector2D b)
a
and b
. The points may
be given in any order.line
- line forming the base of the segmenta
- first pointb
- second pointa
and b
on the given lineIllegalArgumentException
- if either point contains NaN or infinite coordinate valuespublic static Segment segmentFromLocations(Line line, double a, double b)
line
- line forming the base of the segmenta
- first 1D location on the lineb
- second 1D location on the linea
and b
on
the given lineIllegalArgumentException
- if either of the locations is NaN or infinitepublic static LineConvexSubset span(Line line)
LineConvexSubset
spanning the entire line. In other words, the returned
subset is infinite and contains all points on the given line.line
- the line to spanpublic static LineConvexSubset subsetFromInterval(Line line, Interval interval)
line
- the line containing the subsetinterval
- 1D interval on the linepublic static LineConvexSubset subsetFromInterval(Line line, double a, double b)
Lines.subsetFromInterval(line, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY)
will return
an instance representing the full span of the line.line
- the line containing the subseta
- first 1D location on the lineb
- second 1D location on the lineIllegalArgumentException
- if either double value is NaN or both are infinite with the same sign
(eg, both positive infinity or both negative infinity)Copyright © 2016–2021 The Apache Software Foundation. All rights reserved.