Class LineConvexSubset
- java.lang.Object
-
- org.apache.commons.geometry.euclidean.twod.LineSubset
-
- org.apache.commons.geometry.euclidean.twod.LineConvexSubset
-
- All Implemented Interfaces:
Embedding<Vector2D,Vector1D>
,HyperplaneConvexSubset<Vector2D>
,HyperplaneSubset<Vector2D>
,Splittable<Vector2D,HyperplaneSubset<Vector2D>>
,RegionEmbedding<Vector2D,Vector1D>
,Sized
- Direct Known Subclasses:
LineSpanningSubset
,Ray
,ReverseRay
,Segment
public abstract class LineConvexSubset extends LineSubset implements HyperplaneConvexSubset<Vector2D>
Class representing a convex subset of a line in 2D Euclidean space. Instances need not be finite, in which case the start or end point (or both) will be null. Line segments and rays are examples of convex line subsets.- See Also:
Lines
-
-
Constructor Summary
Constructors Constructor Description LineConvexSubset(Line line)
Construct a new instance for the given line.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Vector2D
closest(Vector2D pt)
Return the closest point to the argument that is contained in the subset (ie, not classified asoutside
), or null if no such point exists.(package private) abstract double
closestAbscissa(double abscissa)
Get the closest value in the subspace region to the given abscissa.abstract Vector2D
getEndPoint()
Get the end point for the subset.Interval
getInterval()
Get the 1D interval for the region.abstract Vector2D
getStartPoint()
Get the start point for the subset.abstract double
getSubspaceEnd()
Get the 1D end location of the subset orDouble.POSITIVE_INFINITY
if no end location exists.Interval
getSubspaceRegion()
Get the embedded subspace region.abstract double
getSubspaceStart()
Get the 1D start location of the subset orDouble.NEGATIVE_INFINITY
if no start location exists.boolean
isEmpty()
Return true if this instance does not contain any points.abstract LineConvexSubset
reverse()
Reverse the orientation of the hyperplane for this instance, returning the result as a new instance.Split<LineConvexSubset>
split(Hyperplane<Vector2D> splitter)
Split this instance with the given hyperplane.(package private) abstract Split<LineConvexSubset>
splitOnIntersection(Line splitter, Vector2D intersection)
Split this instance using the given splitter line and intersection point.java.util.List<LineConvexSubset>
toConvex()
Convert this instance into a list of convex child subsets representing the same region.abstract LineConvexSubset
transform(Transform<Vector2D> transform)
Return a new hyperplane subset resulting from the application of the given transform.-
Methods inherited from class org.apache.commons.geometry.euclidean.twod.LineSubset
classify, classifyAbscissa, createSplitResult, getBounds, getHyperplane, getLine, getNonIntersectingSplitResult, getPrecision, intersection, intersection, splitterPlusIsPositiveFacing, toSpace, toSubspace
-
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
classify, contains, getCentroid, getHyperplane, isFull
-
Methods inherited from interface org.apache.commons.geometry.core.Sized
getSize, isFinite, isInfinite
-
-
-
-
Constructor Detail
-
LineConvexSubset
LineConvexSubset(Line line)
Construct a new instance for the given line.- Parameters:
line
- line containing this line subset
-
-
Method Detail
-
toConvex
public java.util.List<LineConvexSubset> 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>
- Specified by:
toConvex
in classLineSubset
- Returns:
- a list of hyperplane convex subsets representing the same subspace region as this instance
-
isEmpty
public boolean isEmpty()
Return true if this instance does not contain any points.This method always returns
false
.- Specified by:
isEmpty
in interfaceHyperplaneSubset<Vector2D>
- Returns:
- true if this instance does not contain any points
-
getStartPoint
public abstract Vector2D getStartPoint()
Get the start point for the subset.- Returns:
- the start point for the subset, or null if no start point exists
-
getSubspaceStart
public abstract double getSubspaceStart()
Get the 1D start location of the subset orDouble.NEGATIVE_INFINITY
if no start location exists.- Returns:
- the 1D start location of the subset or
Double.NEGATIVE_INFINITY
if no start location exists.
-
getEndPoint
public abstract Vector2D getEndPoint()
Get the end point for the subset.- Returns:
- the end point for the subset, or null if no end point exists.
-
getSubspaceEnd
public abstract double getSubspaceEnd()
Get the 1D end location of the subset orDouble.POSITIVE_INFINITY
if no end location exists.- Returns:
- the 1D end location of the subset or
Double.POSITIVE_INFINITY
if no end location exists
-
getSubspaceRegion
public Interval getSubspaceRegion()
Get the embedded subspace region.- Specified by:
getSubspaceRegion
in interfaceRegionEmbedding<Vector2D,Vector1D>
- Specified by:
getSubspaceRegion
in classLineSubset
- Returns:
- the embedded subspace region
-
getInterval
public Interval getInterval()
Get the 1D interval for the region. This method is an alias forgetSubspaceRegion()
.- Returns:
- the 1D interval for the region.
-
split
public Split<LineConvexSubset> split(Hyperplane<Vector2D> splitter)
Split this instance with the given hyperplane.The parts resulting from a split operation with a convex subset are guaranteed to also be convex.
- Specified by:
split
in interfaceHyperplaneConvexSubset<Vector2D>
- Specified by:
split
in interfaceSplittable<Vector2D,HyperplaneSubset<Vector2D>>
- Parameters:
splitter
- the hyperplane to split this object with.- Returns:
- result of the split operation
-
closest
public Vector2D closest(Vector2D pt)
Return the closest point to the argument that is contained in the subset (ie, not classified asoutside
), or null if no such point exists.- Specified by:
closest
in interfaceHyperplaneSubset<Vector2D>
- Parameters:
pt
- the reference point- Returns:
- the closest point to the reference point that is contained in the subset, or null if no such point exists
-
transform
public abstract LineConvexSubset transform(Transform<Vector2D> transform)
Return a new hyperplane subset resulting from the application of the given transform. The current instance is not modified.Hyperplane convex subsets subjected to affine transformations remain convex.
- Specified by:
transform
in interfaceHyperplaneConvexSubset<Vector2D>
- Specified by:
transform
in interfaceHyperplaneSubset<Vector2D>
- Parameters:
transform
- the transform instance to apply- Returns:
- new transformed hyperplane subset
-
reverse
public abstract LineConvexSubset reverse()
Reverse the orientation of the hyperplane for this instance, returning the result as a new instance. The returned subset contains the same points but has a reversed orientation.- Specified by:
reverse
in interfaceHyperplaneConvexSubset<Vector2D>
- Returns:
- a hyperplane convex subset representing the same region but with the opposite orientation.
-
closestAbscissa
abstract double closestAbscissa(double abscissa)
Get the closest value in the subspace region to the given abscissa.- Parameters:
abscissa
- input abscissa- Returns:
- the closest value in the subspace region to the given abscissa
-
splitOnIntersection
abstract Split<LineConvexSubset> splitOnIntersection(Line splitter, Vector2D intersection)
Split this instance using the given splitter line and intersection point.- Parameters:
splitter
- splitter lineintersection
- intersection point between the splitter line and the line for this instance- Returns:
- the result of splitting this instance with the given splitter line and intersection point
-
-