public final class RegionBSPTree2D extends AbstractRegionBSPTree<Vector2D,RegionBSPTree2D.RegionNode2D> implements BoundarySource2D
Modifier and Type | Class and Description |
---|---|
static class |
RegionBSPTree2D.PartitionedRegionBuilder2D
Class used to build regions in Euclidean 2D space by inserting boundaries into a BSP
tree containing "partitions", i.e.
|
static class |
RegionBSPTree2D.RegionNode2D
BSP tree node for two dimensional Euclidean space.
|
AbstractRegionBSPTree.AbstractRegionNode<P extends Point<P>,N extends AbstractRegionBSPTree.AbstractRegionNode<P,N>>, AbstractRegionBSPTree.BoundaryProjector<P extends Point<P>,N extends AbstractRegionBSPTree.AbstractRegionNode<P,N>>, AbstractRegionBSPTree.RegionSizeProperties<P extends Point<P>>
AbstractBSPTree.AbstractNode<P extends Point<P>,N extends AbstractBSPTree.AbstractNode<P,N>>, AbstractBSPTree.SubtreeInitializer<N extends AbstractBSPTree.AbstractNode<?,?>>
BSPTree.FindNodeCutRule, BSPTree.Node<P extends Point<P>,N extends BSPTree.Node<P,N>>
Constructor and Description |
---|
RegionBSPTree2D()
Create a new, empty region.
|
RegionBSPTree2D(boolean full)
Create a new region.
|
Modifier and Type | Method and Description |
---|---|
void |
add(ConvexArea area)
Add a convex area to this region.
|
Iterable<LineConvexSubset> |
boundaries() |
Stream<LineConvexSubset> |
boundaryStream() |
protected AbstractRegionBSPTree.RegionSizeProperties<Vector2D> |
computeRegionSizeProperties() |
RegionBSPTree2D |
copy()
Return a deep copy of this instance.
|
protected RegionBSPTree2D.RegionNode2D |
createNode() |
static RegionBSPTree2D |
empty()
Return a new, empty
RegionBSPTree2D instance. |
static RegionBSPTree2D |
from(Iterable<? extends LineConvexSubset> boundaries)
Construct a new tree from the given boundaries.
|
static RegionBSPTree2D |
from(Iterable<? extends LineConvexSubset> boundaries,
boolean full)
Construct a new tree from the given boundaries.
|
static RegionBSPTree2D |
full()
Return a new
RegionBSPTree2D instance containing the entire space. |
List<LineConvexSubset> |
getBoundaries() |
List<LinePath> |
getBoundaryPaths()
Get the boundary of the region as a list of connected line subset paths.
|
protected void |
invalidate() |
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.
|
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 RegionBSPTree2D.PartitionedRegionBuilder2D |
partitionedRegionBuilder()
Create a new
RegionBSPTree2D.PartitionedRegionBuilder2D instance which can be used to build balanced
BSP trees from region boundaries. |
Vector2D |
project(Vector2D pt) |
Split<RegionBSPTree2D> |
split(Hyperplane<Vector2D> splitter) |
List<ConvexArea> |
toConvex()
Return a list of
ConvexArea s representing the same region
as this instance. |
RegionBSPTree2D |
toTree()
Return the current instance.
|
classify, complement, complement, condense, copyNodeProperties, createBoundaryIterable, createBoundaryList, difference, difference, getBoundarySize, getCentroid, getRegionSizeProperties, getSize, getSubtreeInitializer, insert, insert, insert, insert, insert, insert, insert, insert, intersection, intersection, isEmpty, isFull, setEmpty, setFull, split, union, union, xor, xor
accept, accept, copy, copyNode, copySubtree, count, cutNode, extract, extractParentPath, findNode, findNode, getRoot, getVersion, height, importSubtree, insert, nodes, removeNodeCut, setNodeCut, setRoot, splitIntoTrees, splitSubtree, swapsInsideOutside, toString, transform, treeString, treeString, trimToNode
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getBounds, of, of, toList
linecast, linecastFirst
isFinite, isInfinite
public RegionBSPTree2D()
public RegionBSPTree2D(boolean full)
full
is true, then the region will
represent the entire 2D space. Otherwise, it will be empty.full
- whether or not the region should contain the entire
2D space or be emptypublic RegionBSPTree2D copy()
AbstractBSPTree.copy(org.apache.commons.geometry.core.partitioning.bsp.BSPTree)
public Iterable<LineConvexSubset> boundaries()
boundaries
in class AbstractRegionBSPTree<Vector2D,RegionBSPTree2D.RegionNode2D>
public Stream<LineConvexSubset> boundaryStream()
boundaryStream
in interface BoundarySource<LineConvexSubset>
public List<LineConvexSubset> getBoundaries()
getBoundaries
in class AbstractRegionBSPTree<Vector2D,RegionBSPTree2D.RegionNode2D>
public List<LinePath> getBoundaryPaths()
public void add(ConvexArea area)
area
- the convex area to addpublic List<ConvexArea> toConvex()
ConvexArea
s representing the same region
as this instance. One convex area is returned for each interior leaf
node in the tree.public Split<RegionBSPTree2D> split(Hyperplane<Vector2D> splitter)
split
in interface Splittable<Vector2D,HyperplaneBoundedRegion<Vector2D>>
public Vector2D project(Vector2D pt)
project
in interface Region<Vector2D>
project
in class AbstractRegionBSPTree<Vector2D,RegionBSPTree2D.RegionNode2D>
public RegionBSPTree2D toTree()
toTree
in interface BoundarySource2D
partitionedRegionBuilder()
public List<LinecastPoint2D> linecast(LineConvexSubset subset)
linecast
in interface BoundarySource2D
linecast
in interface Linecastable2D
subset
- line subset to intersectpublic LinecastPoint2D linecastFirst(LineConvexSubset subset)
linecastFirst
in interface BoundarySource2D
linecastFirst
in interface Linecastable2D
subset
- line subset to intersectprotected AbstractRegionBSPTree.RegionSizeProperties<Vector2D> computeRegionSizeProperties()
computeRegionSizeProperties
in class AbstractRegionBSPTree<Vector2D,RegionBSPTree2D.RegionNode2D>
protected void invalidate()
invalidate
in class AbstractRegionBSPTree<Vector2D,RegionBSPTree2D.RegionNode2D>
protected RegionBSPTree2D.RegionNode2D createNode()
createNode
in class AbstractBSPTree<Vector2D,RegionBSPTree2D.RegionNode2D>
public static RegionBSPTree2D full()
RegionBSPTree2D
instance containing the entire space.RegionBSPTree2D
instance containing the entire spacepublic static RegionBSPTree2D empty()
RegionBSPTree2D
instance.RegionBSPTree2D
instancepublic static RegionBSPTree2D from(Iterable<? extends LineConvexSubset> boundaries)
boundaries
- boundaries to construct the tree fromfrom(Iterable, boolean)
public static RegionBSPTree2D from(Iterable<? extends LineConvexSubset> boundaries, boolean full)
full
is true, then
the initial tree before boundary insertion contains the entire space. Otherwise,
it is empty.boundaries
- boundaries to construct the tree fromfull
- if true, the initial tree will contain the entire spacepublic static RegionBSPTree2D.PartitionedRegionBuilder2D partitionedRegionBuilder()
RegionBSPTree2D.PartitionedRegionBuilder2D
instance which can be used to build balanced
BSP trees from region boundaries.RegionBSPTree2D.PartitionedRegionBuilder2D
instanceCopyright © 2016–2021 The Apache Software Foundation. All rights reserved.