Interface BoundarySource2D
-
- All Superinterfaces:
BoundarySource<LineConvexSubset>
,Linecastable2D
- All Known Implementing Classes:
BoundaryList2D
,ConvexArea
,LinePath
,LinePath.SimplifiedLinePath
,Parallelogram
,RegionBSPTree2D
public interface BoundarySource2D extends BoundarySource<LineConvexSubset>, Linecastable2D
Extension of theBoundarySource
interface for Euclidean 2D space.
-
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description default Bounds2D
getBounds()
Get aBounds2D
object defining the axis-aligned box containing all vertices in the boundaries for this instance.default java.util.List<LinecastPoint2D>
linecast(LineConvexSubset subset)
Intersect the given line subset against the boundaries in this instance, returning a list of all intersections in order of increasing position along the line.default LinecastPoint2D
linecastFirst(LineConvexSubset subset)
Intersect the given line subset against the boundaries in this instance, returning the first intersection found when traveling in the direction of the line subset from its start location.static BoundarySource2D
of(java.util.Collection<LineConvexSubset> boundaries)
Return aBoundarySource2D
instance containing the given boundaries.static BoundarySource2D
of(LineConvexSubset... boundaries)
Return aBoundarySource2D
instance containing the given boundaries.default BoundaryList2D
toList()
Return aBoundaryList2D
containing the boundaries in this instance.default RegionBSPTree2D
toTree()
Return a BSP tree constructed from the boundaries contained in this instance.-
Methods inherited from interface org.apache.commons.geometry.core.partitioning.BoundarySource
boundaryStream
-
Methods inherited from interface org.apache.commons.geometry.euclidean.twod.Linecastable2D
linecast, linecastFirst
-
-
-
-
Method Detail
-
toList
default BoundaryList2D toList()
Return aBoundaryList2D
containing the boundaries in this instance.- Returns:
- a
BoundaryList2D
containing the boundaries in this instance
-
toTree
default RegionBSPTree2D toTree()
Return a BSP tree constructed from the boundaries contained in this instance. This is a convenience method for quickly constructing BSP trees and may produce unbalanced trees with unacceptable performance characteristics when used with large numbers of boundaries. In these cases, alternate tree construction approaches should be used, such asRegionBSPTree2D.PartitionedRegionBuilder2D
.- Returns:
- a BSP tree constructed from the boundaries in this instance
- See Also:
RegionBSPTree2D.partitionedRegionBuilder()
-
linecast
default java.util.List<LinecastPoint2D> linecast(LineConvexSubset subset)
Intersect the given line subset against the boundaries in this instance, returning a list of all intersections in order of increasing position along the line. An empty list is returned if no intersections are discovered.- Specified by:
linecast
in interfaceLinecastable2D
- Parameters:
subset
- line subset to intersect- Returns:
- a list of computed intersections in order of increasing position along the line
-
linecastFirst
default LinecastPoint2D linecastFirst(LineConvexSubset subset)
Intersect the given line subset against the boundaries in this instance, returning the first intersection found when traveling in the direction of the line subset from its start location.- Specified by:
linecastFirst
in interfaceLinecastable2D
- Parameters:
subset
- line subset to intersect- Returns:
- the first intersection found or null if no intersection is found
-
getBounds
default Bounds2D getBounds()
Get aBounds2D
object defining the axis-aligned box containing all vertices in the boundaries for this instance. Null is returned if any boundaries are infinite or no vertices were found.- Returns:
- the bounding box for this instance or null if no valid bounds could be determined
-
of
static BoundarySource2D of(LineConvexSubset... boundaries)
Return aBoundarySource2D
instance containing the given boundaries.- Parameters:
boundaries
- line subsets to include in the boundary source- Returns:
- a boundary source containing the given boundaries
-
of
static BoundarySource2D of(java.util.Collection<LineConvexSubset> boundaries)
Return aBoundarySource2D
instance containing the given boundaries. The given collection is used directly as the source of the line subsets; no copy is made.- Parameters:
boundaries
- line subsets to include in the boundary source- Returns:
- a boundary source containing the given boundaries
-
-