Class LineSubset
java.lang.Object
org.apache.commons.geometry.euclidean.twod.LineSubset
- All Implemented Interfaces:
Embedding<Vector2D,
,Vector1D> HyperplaneSubset<Vector2D>
,Splittable<Vector2D,
,HyperplaneSubset<Vector2D>> RegionEmbedding<Vector2D,
,Vector1D> Sized
- Direct Known Subclasses:
EmbeddedTreeLineSubset
,LineConvexSubset
public abstract class LineSubset
extends Object
implements HyperplaneSubset<Vector2D>, RegionEmbedding<Vector2D,Vector1D>
Class representing a subset of points on a line in 2D Euclidean space. For example, line segments
and rays are line subsets. Line subsets may be finite or infinite.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClassify a point with respect to the subset region.(package private) abstract RegionLocation
classifyAbscissa
(double abscissa) Classify the given line abscissa value with respect to the subspace region.(package private) <T extends LineSubset>
Split<T> createSplitResult
(Line splitter, T low, T high) Create a split result for the given splitter line, given the low and high split portion of this instance.abstract Bounds2D
Get aBounds2D
object defining an axis-aligned bounding box containing all vertices for this subset.Get the hyperplane containing this instance.getLine()
Get the line containing this subset.(package private) <T extends LineSubset>
Split<T> getNonIntersectingSplitResult
(Line splitter, T subset) Get a split result for cases where no intersection exists between the splitting line and the line underlying the given line subset.org.apache.commons.numbers.core.Precision.DoubleEquivalence
Return the object used to perform floating point comparisons, which is the same object used by the underlyingLine
).abstract HyperplaneBoundedRegion
<Vector1D> Get the embedded subspace region.intersection
(Line inputLine) Get the unique intersection of this subset with the given line.intersection
(LineSubset subset) Get the unique intersection of this instance with the given line subset.(package private) boolean
splitterPlusIsPositiveFacing
(Line splitterLine) Return true if the plus side of the given splitter line is facing in the positive direction of this line.abstract List
<LineConvexSubset> toConvex()
Convert this instance into a list of convex child subsets representing the same region.Transform a subspace point into a space point.toSubspace
(Vector2D pt) Transform a space point into a subspace point.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.commons.geometry.core.Embedding
toSpace, toSubspace
Methods inherited from interface org.apache.commons.geometry.core.partitioning.HyperplaneSubset
closest, contains, getCentroid, isEmpty, isFull, transform
Methods inherited from interface org.apache.commons.geometry.core.Sized
getSize, isFinite, isInfinite
Methods inherited from interface org.apache.commons.geometry.core.partitioning.Splittable
split
-
Field Details
-
line
The line containing this instance.
-
-
Constructor Details
-
LineSubset
LineSubset(Line line) Construct a new instance based on the given line.- Parameters:
line
- line forming the base of the instance
-
-
Method Details
-
getLine
Get the line containing this subset. This method is an alias forgetHyperplane()
.- Returns:
- the line containing this subset
- See Also:
-
getHyperplane
Get the hyperplane containing this instance.- Specified by:
getHyperplane
in interfaceHyperplaneSubset<Vector2D>
- Returns:
- the hyperplane containing this instance
-
toSubspace
Transform a space point into a subspace point.- Specified by:
toSubspace
in interfaceEmbedding<Vector2D,
Vector1D> - Parameters:
pt
- n-dimension point of the space- Returns:
- lower-dimension point of the subspace corresponding to the specified space point
- See Also:
-
getBounds
Get aBounds2D
object defining an axis-aligned bounding box containing all vertices for this subset. Null is returned if the subset is infinite or does not contain any vertices.- Returns:
- the bounding box for this instance or null if no valid bounds could be determined
-
getSubspaceRegion
Get the embedded subspace region.- Specified by:
getSubspaceRegion
in interfaceRegionEmbedding<Vector2D,
Vector1D> - Returns:
- the embedded subspace region
-
toSpace
Transform a subspace point into a space point. -
toConvex
Convert this instance into a list of convex child subsets representing the same region. Implementations are not required to return an optimal convex subdivision of the current instance. They are free to return whatever subdivision is readily available.- Specified by:
toConvex
in interfaceHyperplaneSubset<Vector2D>
- Returns:
- a list of hyperplane convex subsets representing the same subspace region as this instance
-
classify
Classify a point with respect to the subset region. The point is classified as follows:- Specified by:
classify
in interfaceHyperplaneSubset<Vector2D>
- Parameters:
pt
- the point to classify- Returns:
- classification of the point with respect to the hyperplane and subspace region
-
intersection
Get the unique intersection of this subset with the given line. Null is returned if no unique intersection point exists (ie, the lines are parallel or coincident) or the line does not intersect this instance.- Parameters:
inputLine
- line to intersect with this line subset- Returns:
- the unique intersection point between the line and this line subset or null if no such point exists.
- See Also:
-
intersection
Get the unique intersection of this instance with the given line subset. Null is returned if the lines containing the line subsets do not have a unique intersection point (ie, they are parallel or coincident) or the intersection point is unique but is not contained in both line subsets.- Parameters:
subset
- line subset to intersect with- Returns:
- the unique intersection point between this line subset and the argument or null if no such point exists.
- See Also:
-
getPrecision
public org.apache.commons.numbers.core.Precision.DoubleEquivalence getPrecision()Return the object used to perform floating point comparisons, which is the same object used by the underlyingLine
).- Returns:
- precision object used to perform floating point comparisons.
-
classifyAbscissa
Classify the given line abscissa value with respect to the subspace region.- Parameters:
abscissa
- the abscissa value to classify- Returns:
- the region location of the line abscissa value
-
getNonIntersectingSplitResult
Get a split result for cases where no intersection exists between the splitting line and the line underlying the given line subset. This occurs when the two lines are parallel or coincident.- Type Parameters:
T
- Line subset type- Parameters:
splitter
- splitting linesubset
- line subset instance being split- Returns:
- return result of the non-intersecting split operation
-
splitterPlusIsPositiveFacing
Return true if the plus side of the given splitter line is facing in the positive direction of this line.- Parameters:
splitterLine
- line splitting this instance- Returns:
- true if the plus side of the given line is facing in the positive direction of this line
-
createSplitResult
Create a split result for the given splitter line, given the low and high split portion of this instance. The arguments are assigned to the split result's minus and plus properties based on the relative orientation of the splitter line.- Type Parameters:
T
- Line subset type- Parameters:
splitter
- splitter linelow
- portion of the split result closest to negative infinity on this linehigh
- portion of th split result closest to positive infinity on this line- Returns:
- a split result for the given splitter line.
-