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

public Class SubLine

extends AbstractSubHyperplane<Euclidean2D, Euclidean1D>
Class Inheritance
Imports
java.util.ArrayList, .List, org.apache.commons.math3.geometry.Point, org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D, .Interval, .IntervalsSet, .OrientedPoint, .Vector1D, org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane, .BSPTree, .Hyperplane, .Region, .Region.Location, .SubHyperplane, org.apache.commons.math3.util.FastMath

This class represents a sub-hyperplane for Line.
Since
3.0

Field Summary

Modifier and TypeField and Description
private static final double
DEFAULT_TOLERANCE

Default value for tolerance.

Constructor Summary

AccessConstructor and Description
public
SubLine(final Hyperplane<Euclidean2D>
underlying hyperplane
hyperplane
,
final Region<Euclidean1D>
remaining region of the hyperplane
remainingRegion
)

Simple constructor.

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

Create a sub-line from two endpoints.

public
SubLine(final Vector2D
start point
start
,
final Vector2D
end point
end
)
Deprecated as of 3.3, replaced with SubLine(Vector2D, Vector2D, 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 Vector2D
start point
start
,
final Vector2D
end point
end
,
final double
tolerance below which points are considered identical
tolerance
)

Build an interval set from two points.

protected AbstractSubHyperplane<Euclidean2D, Euclidean1D>
buildNew(final Hyperplane<Euclidean2D>
underlying hyperplane
hyperplane
,
final Region<Euclidean1D>
remaining region of the hyperplane
remainingRegion
)

Implements abstract org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane.buildNew.

Build a sub-hyperplane from an hyperplane and a region.

public List<Segment>

Returns:

list of segments endpoints
getSegments
()

Get the endpoints of the sub-line.

public Vector2D

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.

public SubHyperplane.SplitSubHyperplane<Euclidean2D>
split(final Hyperplane<Euclidean2D>
splitting hyperplane
hyperplane
)

Implements abstract org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane.split.

Implements org.apache.commons.math3.geometry.partitioning.SubHyperplane.split.

Split the instance in two parts by an hyperplane.

Inherited from org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane:
applyTransformcopySelfgetHyperplanegetRemainingRegiongetSizeisEmptyreuniteside

Field Detail

DEFAULT_TOLERANCEback to summary
private static final double DEFAULT_TOLERANCE

Default value for tolerance.

Constructor Detail

SubLineback to summary
public SubLine(final Hyperplane<Euclidean2D> hyperplane, final Region<Euclidean1D> remainingRegion)

Simple constructor.

Parameters
hyperplane:Hyperplane<Euclidean2D>

underlying hyperplane

remainingRegion:Region<Euclidean1D>

remaining region of the hyperplane

SubLineback to summary
public SubLine(final Vector2D start, final Vector2D end, final double tolerance)

Create a sub-line from two endpoints.

Parameters
start:Vector2D

start point

end:Vector2D

end point

tolerance:double

tolerance below which points are considered identical

Since
3.3
SubLineback to summary
public SubLine(final Vector2D start, final Vector2D end)

Deprecated

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

Create a sub-line from two endpoints.

Parameters
start:Vector2D

start point

end:Vector2D

end point

Annotations
@Deprecated
SubLineback to summary
public SubLine(final Segment segment)

Create a sub-line from a segment.

Parameters
segment:Segment

single segment forming the sub-line

Method Detail

buildIntervalSetback to summary
private static IntervalsSet buildIntervalSet(final Vector2D start, final Vector2D end, final double tolerance)

Build an interval set from two points.

Parameters
start:Vector2D

start point

end:Vector2D

end point

tolerance:double

tolerance below which points are considered identical

Returns:IntervalsSet

an interval set

buildNewback to summary
protected AbstractSubHyperplane<Euclidean2D, Euclidean1D> buildNew(final Hyperplane<Euclidean2D> hyperplane, final Region<Euclidean1D> remainingRegion)

Implements abstract org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane.buildNew.

Doc from org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane.buildNew.

Build a sub-hyperplane from an hyperplane and a region.

Parameters
hyperplane:Hyperplane<Euclidean2D>

underlying hyperplane

remainingRegion:Region<Euclidean1D>

remaining region of the hyperplane

Returns:AbstractSubHyperplane<Euclidean2D, Euclidean1D>

a new sub-hyperplane

Annotations
@Override
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 Vector2D 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:Vector2D

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

splitback to summary
public SubHyperplane.SplitSubHyperplane<Euclidean2D> split(final Hyperplane<Euclidean2D> hyperplane)

Implements abstract org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane.split.

Implements org.apache.commons.math3.geometry.partitioning.SubHyperplane.split.

Doc from org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane.split.

Split the instance in two parts by an hyperplane.

Parameters
hyperplane:Hyperplane<Euclidean2D>

Doc from org.apache.commons.math3.geometry.partitioning.SubHyperplane.split.

splitting hyperplane

Returns:SubHyperplane.SplitSubHyperplane<Euclidean2D>

Doc from org.apache.commons.math3.geometry.partitioning.SubHyperplane.split.

an object containing both the part of the instance on the plus side of the hyperplane and the part of the instance on the minus side of the hyperplane

Annotations
@Override