Top Description Fields Constructors Methods
org.apache.commons.math3.geometry.euclidean.threed

public Class SubLine

extends Object
Class Inheritance
Imports
java.util.ArrayList, .List, org.apache.commons.math3.exception.MathIllegalArgumentException, org.apache.commons.math3.geometry.Point, org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D, .Interval, .IntervalsSet, .Vector1D, org.apache.commons.math3.geometry.partitioning.Region.Location

This class represents a subset of a Line.
Since
3.0

Field Summary

Modifier and TypeField and Description
private static final double
DEFAULT_TOLERANCE

Default value for tolerance.

private final Line
line

Underlying line.

private final IntervalsSet
remainingRegion

Remaining region of the hyperplane.

Constructor Summary

AccessConstructor and Description
public
SubLine(final Line
underlying line
line
,
final IntervalsSet
remaining region of the line
remainingRegion
)

Simple constructor.

public
SubLine(final Vector3D
start point
start
,
final Vector3D
end point
end
,
final double
tolerance below which points are considered identical
tolerance
)

Create a sub-line from two endpoints.

public
SubLine(final Vector3D
start point
start
,
final Vector3D
end point
end
)
Deprecated as of 3.3, replaced with SubLine(Vector3D, Vector3D, double)

Create a sub-line from two endpoints.

public
SubLine(final Segment
single segment forming the sub-line
segment
)

Create a sub-line from a segment.

Method Summary

Modifier and TypeMethod and Description
private static IntervalsSet

Returns:

an interval set
buildIntervalSet
(final Vector3D
start point
start
,
final Vector3D
end point
end
,
final double
tolerance below which points are considered identical
tolerance
)

Build an interval set from two points.

public List<Segment>

Returns:

list of segments endpoints
getSegments
()

Get the endpoints of the sub-line.

public Vector3D

Returns:

the intersection point if there is one, null if the sub-lines don't intersect
intersection
(final SubLine
other sub-line which may intersect instance
subLine
,
final boolean
if true, endpoints are considered to belong to instance (i.e. they are closed sets) and may be returned, otherwise endpoints are considered to not belong to instance (i.e. they are open sets) and intersection occurring on endpoints lead to null being returned
includeEndPoints
)

Get the intersection of the instance and another sub-line.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_TOLERANCEback to summary
private static final double DEFAULT_TOLERANCE

Default value for tolerance.

lineback to summary
private final Line line

Underlying line.

remainingRegionback to summary
private final IntervalsSet remainingRegion

Remaining region of the hyperplane.

Constructor Detail

SubLineback to summary
public SubLine(final Line line, final IntervalsSet remainingRegion)

Simple constructor.

Parameters
line:Line

underlying line

remainingRegion:IntervalsSet

remaining region of the line

SubLineback to summary
public SubLine(final Vector3D start, final Vector3D end, final double tolerance) throws MathIllegalArgumentException

Create a sub-line from two endpoints.

Parameters
start:Vector3D

start point

end:Vector3D

end point

tolerance:double

tolerance below which points are considered identical

Exceptions
MathIllegalArgumentException:
if the points are equal
Since
3.3
SubLineback to summary
public SubLine(final Vector3D start, final Vector3D end) throws MathIllegalArgumentException

Deprecated

as of 3.3, replaced with SubLine(Vector3D, Vector3D, double)

Create a sub-line from two endpoints.

Parameters
start:Vector3D

start point

end:Vector3D

end point

Exceptions
MathIllegalArgumentException:
if the points are equal
SubLineback to summary
public SubLine(final Segment segment) throws MathIllegalArgumentException

Create a sub-line from a segment.

Parameters
segment:Segment

single segment forming the sub-line

Exceptions
MathIllegalArgumentException:
if the segment endpoints are equal

Method Detail

buildIntervalSetback to summary
private static IntervalsSet buildIntervalSet(final Vector3D start, final Vector3D end, final double tolerance) throws MathIllegalArgumentException

Build an interval set from two points.

Parameters
start:Vector3D

start point

end:Vector3D

end point

tolerance:double

tolerance below which points are considered identical

Returns:IntervalsSet

an interval set

Exceptions
MathIllegalArgumentException:
if the points are equal
getSegmentsback to summary
public List<Segment> getSegments()

Get the endpoints of the sub-line.

A subline may be any arbitrary number of disjoints segments, so the endpoints are provided as a list of endpoint pairs. Each element of the list represents one segment, and each segment contains a start point at index 0 and an end point at index 1. If the sub-line is unbounded in the negative infinity direction, the start point of the first segment will have infinite coordinates. If the sub-line is unbounded in the positive infinity direction, the end point of the last segment will have infinite coordinates. So a sub-line covering the whole line will contain just one row and both elements of this row will have infinite coordinates. If the sub-line is empty, the returned list will contain 0 segments.

Returns:List<Segment>

list of segments endpoints

intersectionback to summary
public Vector3D intersection(final SubLine subLine, final boolean includeEndPoints)

Get the intersection of the instance and another sub-line.

This method is related to the intersection method in the Line class, but in addition to compute the point along infinite lines, it also checks the point lies on both sub-line ranges.

Parameters
subLine:SubLine

other sub-line which may intersect instance

includeEndPoints:boolean

if true, endpoints are considered to belong to instance (i.e. they are closed sets) and may be returned, otherwise endpoints are considered to not belong to instance (i.e. they are open sets) and intersection occurring on endpoints lead to null being returned

Returns:Vector3D

the intersection point if there is one, null if the sub-lines don't intersect