Class Ray3D
- java.lang.Object
-
- org.apache.commons.geometry.euclidean.threed.line.LineSubset3D
-
- org.apache.commons.geometry.euclidean.threed.line.LineConvexSubset3D
-
- org.apache.commons.geometry.euclidean.threed.line.Ray3D
-
- All Implemented Interfaces:
Embedding<Vector3D,Vector1D>,RegionEmbedding<Vector3D,Vector1D>,Sized
public final class Ray3D extends LineConvexSubset3D
Class representing a ray in 3D 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:
ReverseRay3D,Lines3D, Ray
-
-
Field Summary
Fields Modifier and Type Field Description private doublestartThe start abscissa value for the ray.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) booleancontainsAbscissa(double abscissa)Return true if the given abscissa value is contained in the line subset (ie, in the subspace region or one of its 1D boundaries).Bounds3DgetBounds()Get the 3D bounding box of the line subset or null if the subset is empty or infinite.Vector3DgetCentroid()Get the centroid, or geometric center, of the line subset or null if the subset is empty or infinite.Vector3DgetDirection()Get the direction of the ray.Vector3DgetEndPoint()Get the end point for the line subset.doublegetSize()Get the size of the instance.Vector3DgetStartPoint()Get the start point for the line subset.doublegetSubspaceEnd()Get the 1D end location of the line subset orDouble.POSITIVE_INFINITYif no end location exists.doublegetSubspaceStart()Get the 1D start location of the line subset orDouble.NEGATIVE_INFINITYif no start location exists.booleanisFinite()Return true if the size of the instance is finite.booleanisInfinite()Return true if the size of the instance is infinite.java.lang.StringtoString()Ray3Dtransform(Transform<Vector3D> transform)Transform this instance.-
Methods inherited from class org.apache.commons.geometry.euclidean.threed.line.LineConvexSubset3D
contains, getInterval, getSubspaceRegion
-
Methods inherited from class org.apache.commons.geometry.euclidean.threed.line.LineSubset3D
getLine, 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
-
-
-
-
Constructor Detail
-
Ray3D
Ray3D(Line3D line, Vector3D startPoint)
Construct a ray from a line and a start point. The start point is projected onto the line. No validation is performed.- Parameters:
line- line for the raystartPoint- start point for the ray
-
Ray3D
Ray3D(Line3D line, double start)
Construct a ray from a line and a 1D start location. No validation is performed.- Parameters:
line- line for the raystart- 1D start location
-
-
Method Detail
-
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
-
getStartPoint
public Vector3D getStartPoint()
Description copied from class:LineConvexSubset3DGet the start point for the line subset.- Specified by:
getStartPointin classLineConvexSubset3D- Returns:
- the start point for the line subset, or null if no start point exists
-
getSubspaceStart
public double getSubspaceStart()
Get the 1D start location of the line subset orDouble.NEGATIVE_INFINITYif no start location exists.- Specified by:
getSubspaceStartin classLineConvexSubset3D- Returns:
- the 1D start location of the line subset or
Double.NEGATIVE_INFINITYif no start location exists.
-
getEndPoint
public Vector3D getEndPoint()
Get the end point for the line subset.This method always returns
null.- Specified by:
getEndPointin classLineConvexSubset3D- Returns:
- the end point for the line subset, or null if no end point exists.
-
getSubspaceEnd
public double getSubspaceEnd()
Get the 1D end location of the line subset orDouble.POSITIVE_INFINITYif no end location exists.This method always returns
Double.POSITIVE_INFINITY.- Specified by:
getSubspaceEndin classLineConvexSubset3D- Returns:
- the 1D end location of the line subset or
Double.POSITIVE_INFINITYif no end location exists
-
getCentroid
public Vector3D getCentroid()
Get the centroid, or geometric center, of the line subset or null if the subset is empty or infinite.This method always returns
null.- Specified by:
getCentroidin classLineSubset3D- Returns:
- the centroid of the line subset, or null if the subset is empty or infinite
-
getBounds
public Bounds3D getBounds()
Get the 3D bounding box of the line subset or null if the subset is empty or infinite.This method always returns
null.- Specified by:
getBoundsin classLineSubset3D- Returns:
- the 3D bounding box the line subset or null if the subset is empty or infinite
-
getDirection
public Vector3D getDirection()
Get the direction of the ray. This is a convenience method forray.getLine().getDirection().- Returns:
- the direction of the ray
-
transform
public Ray3D transform(Transform<Vector3D> transform)
Transform this instance.- Specified by:
transformin classLineConvexSubset3D- Parameters:
transform- the transform to apply- Returns:
- a new, transformed instance
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
containsAbscissa
boolean containsAbscissa(double abscissa)
Return true if the given abscissa value is contained in the line subset (ie, in the subspace region or one of its 1D boundaries).- Specified by:
containsAbscissain classLineConvexSubset3D- Parameters:
abscissa- abscissa to check- Returns:
- true if
abscissalies on the inside or boundary of the subspace region
-
-