Class Ray
java.lang.Object
org.apache.commons.geometry.euclidean.twod.LineSubset
org.apache.commons.geometry.euclidean.twod.LineConvexSubset
org.apache.commons.geometry.euclidean.twod.Ray
- All Implemented Interfaces:
Embedding<Vector2D,
,Vector1D> HyperplaneConvexSubset<Vector2D>
,HyperplaneSubset<Vector2D>
,Splittable<Vector2D,
,HyperplaneSubset<Vector2D>> RegionEmbedding<Vector2D,
,Vector1D> Sized
Class representing a ray in 2D Euclidean space. A ray is a portion of a line consisting of
a single start point and extending to infinity along the direction of the line.
Instances of this class are guaranteed to be immutable.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) RegionLocation
classifyAbscissa
(double abscissa) Classify the given line abscissa value with respect to the subspace region.(package private) double
closestAbscissa
(double abscissa) Get the closest value in the subspace region to the given abscissa.Get aBounds2D
object defining an axis-aligned bounding box containing all vertices for this subset.Get the centroid, or geometric center, of the hyperplane subset or null if no centroid exists or one exists but is not unique.Get the direction of the ray.Get the end point for the subset.double
getSize()
Get the size of the instance.Get the start point for the subset.double
Get the 1D end location of the subset orDouble.POSITIVE_INFINITY
if no end location exists.double
Get the 1D start location of the subset orDouble.NEGATIVE_INFINITY
if no start location exists.boolean
isFinite()
Return true if the size of the instance is finite.boolean
isFull()
Return true if this instance contains all points in the hyperplane.boolean
Return true if the size of the instance is infinite.reverse()
Reverse the orientation of the hyperplane for this instance, returning the result as a new instance.(package private) Split
<LineConvexSubset> splitOnIntersection
(Line splitter, Vector2D intersection) Split this instance using the given splitter line and intersection point.toString()
Return a new hyperplane subset resulting from the application of the given transform.Methods inherited from class org.apache.commons.geometry.euclidean.twod.LineConvexSubset
closest, getInterval, getSubspaceRegion, isEmpty, split, toConvex
Methods inherited from class org.apache.commons.geometry.euclidean.twod.LineSubset
classify, createSplitResult, getHyperplane, getLine, getNonIntersectingSplitResult, getPrecision, intersection, intersection, splitterPlusIsPositiveFacing, toSpace, toSubspace
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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, getHyperplane
-
Field Details
-
startPoint
The start point for the ray.
-
-
Constructor Details
-
Ray
Construct a ray from a line and a start point. Callers are responsible for ensuring that the given point lies on the line. No validation is performed.- Parameters:
line
- line for the raystartPoint
- start point for the ray
-
-
Method Details
-
isFull
public boolean isFull()Return true if this instance contains all points in the hyperplane.This method always returns
false
.- Returns:
- true if this instance contains all points in the hyperplane
-
isInfinite
public boolean isInfinite()Return true if the size of the instance is infinite.This method always returns
true
.- Returns:
- true if the size of the instance is infinite
-
isFinite
public boolean isFinite()Return true if the size of the instance is finite.This method always returns
false
.- Returns:
- true if the size of the instance is finite
-
getSize
public double getSize()Get the size of the instance.This method always returns
Double.POSITIVE_INFINITY
.- Returns:
- the size of the instance
-
getCentroid
Get the centroid, or geometric center, of the hyperplane subset or null if no centroid exists or one exists but is not unique. A centroid will not exist for empty or infinite subsets.The centroid of a geometric object is defined as the mean position of all points in the object, including interior points, vertices, and other points lying on the boundary. If a physical object has a uniform density, then its center of mass is the same as its geometric centroid.
This method always returns
null
.- Returns:
- the centroid of the hyperplane subset or null if no unique centroid exists
- See Also:
-
getStartPoint
Description copied from class:LineConvexSubset
Get the start point for the subset.- Specified by:
getStartPoint
in classLineConvexSubset
- Returns:
- the start point for the subset, or null if no start point exists
-
getSubspaceStart
public double getSubspaceStart()Get the 1D start location of the subset orDouble.NEGATIVE_INFINITY
if no start location exists.- Specified by:
getSubspaceStart
in classLineConvexSubset
- Returns:
- the 1D start location of the subset or
Double.NEGATIVE_INFINITY
if no start location exists.
-
getEndPoint
Get the end point for the subset.This method always returns
null
.- Specified by:
getEndPoint
in classLineConvexSubset
- Returns:
- the end point for the subset, or null if no end point exists.
-
getSubspaceEnd
public double getSubspaceEnd()Get the 1D end location of the subset orDouble.POSITIVE_INFINITY
if no end location exists.This method always returns
Double.POSITIVE_INFINITY
.- Specified by:
getSubspaceEnd
in classLineConvexSubset
- Returns:
- the 1D end location of the subset or
Double.POSITIVE_INFINITY
if no end location exists
-
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.This method always returns
null
.- Specified by:
getBounds
in classLineSubset
- Returns:
- the bounding box for this instance or null if no valid bounds could be determined
-
getDirection
Get the direction of the ray. This is a convenience method forray.getLine().getDirection()
.- Returns:
- the direction of the ray
-
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>
- Specified by:
transform
in classLineConvexSubset
- Parameters:
transform
- the transform instance to apply- Returns:
- new transformed hyperplane subset
-
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>
- Specified by:
reverse
in classLineConvexSubset
- Returns:
- a hyperplane convex subset representing the same region but with the opposite orientation.
-
toString
-
classifyAbscissa
Classify the given line abscissa value with respect to the subspace region.- Specified by:
classifyAbscissa
in classLineSubset
- Parameters:
abscissa
- the abscissa value to classify- Returns:
- the region location of the line abscissa value
-
closestAbscissa
double closestAbscissa(double abscissa) Get the closest value in the subspace region to the given abscissa.- Specified by:
closestAbscissa
in classLineConvexSubset
- Parameters:
abscissa
- input abscissa- Returns:
- the closest value in the subspace region to the given abscissa
-
splitOnIntersection
Split this instance using the given splitter line and intersection point.- Specified by:
splitOnIntersection
in classLineConvexSubset
- 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
-