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 Vector2Dclosest(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 doubleclosestAbscissa(double abscissa)Get the closest value in the subspace region to the given abscissa.abstract Vector2DgetEndPoint()Get the end point for the subset.IntervalgetInterval()Get the 1D interval for the region.abstract Vector2DgetStartPoint()Get the start point for the subset.abstract doublegetSubspaceEnd()Get the 1D end location of the subset orDouble.POSITIVE_INFINITYif no end location exists.IntervalgetSubspaceRegion()Get the embedded subspace region.abstract doublegetSubspaceStart()Get the 1D start location of the subset orDouble.NEGATIVE_INFINITYif no start location exists.booleanisEmpty()Return true if this instance does not contain any points.abstract LineConvexSubsetreverse()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 LineConvexSubsettransform(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:
toConvexin interfaceHyperplaneSubset<Vector2D>- Specified by:
toConvexin 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:
isEmptyin 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_INFINITYif no start location exists.- Returns:
- the 1D start location of the subset or
Double.NEGATIVE_INFINITYif 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_INFINITYif no end location exists.- Returns:
- the 1D end location of the subset or
Double.POSITIVE_INFINITYif no end location exists
-
getSubspaceRegion
public Interval getSubspaceRegion()
Get the embedded subspace region.- Specified by:
getSubspaceRegionin interfaceRegionEmbedding<Vector2D,Vector1D>- Specified by:
getSubspaceRegionin 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:
splitin interfaceHyperplaneConvexSubset<Vector2D>- Specified by:
splitin 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:
closestin 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:
transformin interfaceHyperplaneConvexSubset<Vector2D>- Specified by:
transformin 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:
reversein 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
-
-