Class SubLine
- java.lang.Object
-
- org.apache.commons.math3.geometry.euclidean.threed.SubLine
-
public class SubLine extends java.lang.Object
This class represents a subset of aLine
.- Since:
- 3.0
-
-
Field Summary
Fields Modifier and Type Field Description private static double
DEFAULT_TOLERANCE
Default value for tolerance.private Line
line
Underlying line.private IntervalsSet
remainingRegion
Remaining region of the hyperplane.
-
Constructor Summary
Constructors Constructor Description SubLine(Line line, IntervalsSet remainingRegion)
Simple constructor.SubLine(Segment segment)
Create a sub-line from a segment.SubLine(Vector3D start, Vector3D end)
Deprecated.as of 3.3, replaced withSubLine(Vector3D, Vector3D, double)
SubLine(Vector3D start, Vector3D end, double tolerance)
Create a sub-line from two endpoints.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static IntervalsSet
buildIntervalSet(Vector3D start, Vector3D end, double tolerance)
Build an interval set from two points.java.util.List<Segment>
getSegments()
Get the endpoints of the sub-line.Vector3D
intersection(SubLine subLine, boolean includeEndPoints)
Get the intersection of the instance and another sub-line.
-
-
-
Field Detail
-
DEFAULT_TOLERANCE
private static final double DEFAULT_TOLERANCE
Default value for tolerance.- See Also:
- Constant Field Values
-
line
private final Line line
Underlying line.
-
remainingRegion
private final IntervalsSet remainingRegion
Remaining region of the hyperplane.
-
-
Constructor Detail
-
SubLine
public SubLine(Line line, IntervalsSet remainingRegion)
Simple constructor.- Parameters:
line
- underlying lineremainingRegion
- remaining region of the line
-
SubLine
public SubLine(Vector3D start, Vector3D end, double tolerance) throws MathIllegalArgumentException
Create a sub-line from two endpoints.- Parameters:
start
- start pointend
- end pointtolerance
- tolerance below which points are considered identical- Throws:
MathIllegalArgumentException
- if the points are equal- Since:
- 3.3
-
SubLine
public SubLine(Vector3D start, Vector3D end) throws MathIllegalArgumentException
Deprecated.as of 3.3, replaced withSubLine(Vector3D, Vector3D, double)
Create a sub-line from two endpoints.- Parameters:
start
- start pointend
- end point- Throws:
MathIllegalArgumentException
- if the points are equal
-
SubLine
public SubLine(Segment segment) throws MathIllegalArgumentException
Create a sub-line from a segment.- Parameters:
segment
- single segment forming the sub-line- Throws:
MathIllegalArgumentException
- if the segment endpoints are equal
-
-
Method Detail
-
getSegments
public java.util.List<Segment> getSegments()
Get the endpoints of the sub-line.A subline may be any arbitrary number of disjoints segments, so the endpoints are provided as a list of endpoint pairs. Each element of the list represents one segment, and each segment contains a start point at index 0 and an end point at index 1. If the sub-line is unbounded in the negative infinity direction, the start point of the first segment will have infinite coordinates. If the sub-line is unbounded in the positive infinity direction, the end point of the last segment will have infinite coordinates. So a sub-line covering the whole line will contain just one row and both elements of this row will have infinite coordinates. If the sub-line is empty, the returned list will contain 0 segments.
- Returns:
- list of segments endpoints
-
intersection
public Vector3D intersection(SubLine subLine, boolean includeEndPoints)
Get the intersection of the instance and another sub-line.This method is related to the
intersection
method in theLine
class, but in addition to compute the point along infinite lines, it also checks the point lies on both sub-line ranges.- Parameters:
subLine
- other sub-line which may intersect instanceincludeEndPoints
- if true, endpoints are considered to belong to instance (i.e. they are closed sets) and may be returned, otherwise endpoints are considered to not belong to instance (i.e. they are open sets) and intersection occurring on endpoints lead to null being returned- Returns:
- the intersection point if there is one, null if the sub-lines don't intersect
-
buildIntervalSet
private static IntervalsSet buildIntervalSet(Vector3D start, Vector3D end, double tolerance) throws MathIllegalArgumentException
Build an interval set from two points.- Parameters:
start
- start pointend
- end pointtolerance
- tolerance below which points are considered identical- Returns:
- an interval set
- Throws:
MathIllegalArgumentException
- if the points are equal
-
-