Class Segment3D
- 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.Segment3D
-
- All Implemented Interfaces:
Embedding<Vector3D,Vector1D>
,RegionEmbedding<Vector3D,Vector1D>
,Sized
public final class Segment3D extends LineConvexSubset3D
Class representing a line segment in 3D Euclidean space. A line segment is a portion of a line with finite start and end points.Instances of this class are guaranteed to be immutable.
- See Also:
Lines3D
, Line Segment
-
-
Constructor Summary
Constructors Constructor Description Segment3D(Line3D line, double start, double end)
Construct a new instance from a line and two abscissa locations on the line.Segment3D(Line3D line, Vector3D startPoint, Vector3D endPoint)
Construct a new instance from a line and two points on the line.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) 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).Bounds3D
getBounds()
Get the 3D bounding box of the line subset or null if the subset is empty or infinite.Vector3D
getCentroid()
Get the centroid, or geometric center, of the line subset or null if the subset is empty or infinite.Vector3D
getEndPoint()
Get the end point for the line subset.double
getSize()
Get the size of the instance.Vector3D
getStartPoint()
Get the start point for the line subset.double
getSubspaceEnd()
Get the 1D end location of the line subset orDouble.POSITIVE_INFINITY
if no end location exists.double
getSubspaceStart()
Get the 1D start location of the line subset orDouble.NEGATIVE_INFINITY
if no start location exists.boolean
isFinite()
Return true if the size of the instance is finite.boolean
isInfinite()
Return true if the size of the instance is infinite.java.lang.String
toString()
Segment3D
transform(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
-
Segment3D
Segment3D(Line3D line, Vector3D startPoint, Vector3D endPoint)
Construct a new instance from a line and two points on the line. The points are projected onto the line and must be in order of increasing abscissa. No validation is performed.- Parameters:
line
- line for the segmentstartPoint
- segment start pointendPoint
- segment end point
-
Segment3D
Segment3D(Line3D line, double start, double end)
Construct a new instance from a line and two abscissa locations on the line. The abscissa locations must be in increasing order. No validation is performed.- Parameters:
line
- line for the segmentstart
- abscissa start locationend
- abscissa end location
-
-
Method Detail
-
isInfinite
public boolean isInfinite()
Return true if the size of the instance is infinite.This method always returns
false
.- 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
true
.- Returns:
- true if the size of the instance is finite
-
getStartPoint
public Vector3D getStartPoint()
Get the start point for the line subset.- Specified by:
getStartPoint
in 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_INFINITY
if no start location exists.- Specified by:
getSubspaceStart
in classLineConvexSubset3D
- Returns:
- the 1D start location of the line subset or
Double.NEGATIVE_INFINITY
if no start location exists.
-
getEndPoint
public Vector3D getEndPoint()
Get the end point for the line subset.- Specified by:
getEndPoint
in 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_INFINITY
if no end location exists.- Specified by:
getSubspaceEnd
in classLineConvexSubset3D
- Returns:
- the 1D end location of the line subset or
Double.POSITIVE_INFINITY
if no end location exists
-
getSize
public double getSize()
Get the size of the instance.- Returns:
- the size of the instance
-
getCentroid
public Vector3D getCentroid()
Get the centroid, or geometric center, of the line subset or null if the subset is empty or infinite.- Specified by:
getCentroid
in 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.- Specified by:
getBounds
in classLineSubset3D
- Returns:
- the 3D bounding box the line subset or null if the subset is empty or infinite
-
transform
public Segment3D transform(Transform<Vector3D> transform)
Transform this instance.- Specified by:
transform
in classLineConvexSubset3D
- Parameters:
transform
- the transform to apply- Returns:
- a new, transformed instance
-
toString
public java.lang.String toString()
- Overrides:
toString
in 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:
containsAbscissa
in classLineConvexSubset3D
- Parameters:
abscissa
- abscissa to check- Returns:
- true if
abscissa
lies on the inside or boundary of the subspace region
-
-