Class SubLine
- java.lang.Object
-
- org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane<Euclidean2D,Euclidean1D>
-
- org.apache.commons.math3.geometry.euclidean.twod.SubLine
-
- All Implemented Interfaces:
SubHyperplane<Euclidean2D>
public class SubLine extends AbstractSubHyperplane<Euclidean2D,Euclidean1D>
This class represents a sub-hyperplane forLine
.- Since:
- 3.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.commons.math3.geometry.partitioning.SubHyperplane
SubHyperplane.SplitSubHyperplane<U extends Space>
-
-
Field Summary
Fields Modifier and Type Field Description private static double
DEFAULT_TOLERANCE
Default value for tolerance.
-
Constructor Summary
Constructors Constructor Description SubLine(Segment segment)
Create a sub-line from a segment.SubLine(Vector2D start, Vector2D end)
Deprecated.as of 3.3, replaced withSubLine(Vector2D, Vector2D, double)
SubLine(Vector2D start, Vector2D end, double tolerance)
Create a sub-line from two endpoints.SubLine(Hyperplane<Euclidean2D> hyperplane, Region<Euclidean1D> remainingRegion)
Simple constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static IntervalsSet
buildIntervalSet(Vector2D start, Vector2D end, double tolerance)
Build an interval set from two points.protected AbstractSubHyperplane<Euclidean2D,Euclidean1D>
buildNew(Hyperplane<Euclidean2D> hyperplane, Region<Euclidean1D> remainingRegion)
Build a sub-hyperplane from an hyperplane and a region.java.util.List<Segment>
getSegments()
Get the endpoints of the sub-line.Vector2D
intersection(SubLine subLine, boolean includeEndPoints)
Get the intersection of the instance and another sub-line.SubHyperplane.SplitSubHyperplane<Euclidean2D>
split(Hyperplane<Euclidean2D> hyperplane)
Split the instance in two parts by an hyperplane.-
Methods inherited from class org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane
applyTransform, copySelf, getHyperplane, getRemainingRegion, getSize, isEmpty, reunite, side
-
-
-
-
Field Detail
-
DEFAULT_TOLERANCE
private static final double DEFAULT_TOLERANCE
Default value for tolerance.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SubLine
public SubLine(Hyperplane<Euclidean2D> hyperplane, Region<Euclidean1D> remainingRegion)
Simple constructor.- Parameters:
hyperplane
- underlying hyperplaneremainingRegion
- remaining region of the hyperplane
-
SubLine
public SubLine(Vector2D start, Vector2D end, double tolerance)
Create a sub-line from two endpoints.- Parameters:
start
- start pointend
- end pointtolerance
- tolerance below which points are considered identical- Since:
- 3.3
-
SubLine
@Deprecated public SubLine(Vector2D start, Vector2D end)
Deprecated.as of 3.3, replaced withSubLine(Vector2D, Vector2D, double)
Create a sub-line from two endpoints.- Parameters:
start
- start pointend
- end point
-
SubLine
public SubLine(Segment segment)
Create a sub-line from a segment.- Parameters:
segment
- single segment forming the sub-line
-
-
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 Vector2D 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(Vector2D start, Vector2D end, double tolerance)
Build an interval set from two points.- Parameters:
start
- start pointend
- end pointtolerance
- tolerance below which points are considered identical- Returns:
- an interval set
-
buildNew
protected AbstractSubHyperplane<Euclidean2D,Euclidean1D> buildNew(Hyperplane<Euclidean2D> hyperplane, Region<Euclidean1D> remainingRegion)
Build a sub-hyperplane from an hyperplane and a region.- Specified by:
buildNew
in classAbstractSubHyperplane<Euclidean2D,Euclidean1D>
- Parameters:
hyperplane
- underlying hyperplaneremainingRegion
- remaining region of the hyperplane- Returns:
- a new sub-hyperplane
-
split
public SubHyperplane.SplitSubHyperplane<Euclidean2D> split(Hyperplane<Euclidean2D> hyperplane)
Split the instance in two parts by an hyperplane.- Specified by:
split
in interfaceSubHyperplane<Euclidean2D>
- Specified by:
split
in classAbstractSubHyperplane<Euclidean2D,Euclidean1D>
- Parameters:
hyperplane
- splitting hyperplane- Returns:
- an object containing both the part of the instance on the plus side of the hyperplane and the part of the instance on the minus side of the hyperplane
-
-