P
- Point implementation typeN
- BSP tree node implementation typepublic abstract class AbstractPartitionedRegionBuilder<P extends Point<P>,N extends AbstractRegionBSPTree.AbstractRegionNode<P,N>> extends Object
This class constructs regions in two phases: (1) partition insertion and (2) boundary insertion.
Instances begin in the partition insertion phase. Here, partitions can be inserted into the empty tree
using the standard BSP insertion logic. The INHERIT
cut rule is used so that the
represented region remains empty even as partitions are inserted.
The instance moves into the boundary insertion phase when the caller inserts the first region boundary.
Attempting to insert a partition after this point results in an IllegalStateException
. This ensures that
partitioning cuts are always located higher up the tree than boundary cuts.
After all boundaries are inserted, the tree undergoes final processing to ensure that the region is consistent and that unnecessary nodes are removed.
This class does not expose any public methods so that subclasses can present their own public API, tailored to the specific types being worked with. In particular, most subclasses will want to restrict the tree types used with the algorithm, which is difficult to implement cleanly at this level.
Modifier | Constructor and Description |
---|---|
protected |
AbstractPartitionedRegionBuilder(AbstractRegionBSPTree<P,N> tree)
Construct a new instance that builds a partitioned region in the given tree.
|
Modifier and Type | Method and Description |
---|---|
protected AbstractRegionBSPTree<P,N> |
buildInternal()
Internal method to build and return the tree representing the final partitioned region.
|
protected void |
insertBoundaryInternal(HyperplaneConvexSubset<P> boundary)
Internal method to insert a region boundary into the tree.
|
protected void |
insertPartitionInternal(HyperplaneConvexSubset<P> partition)
Internal method to insert a partition into the tree.
|
protected AbstractPartitionedRegionBuilder(AbstractRegionBSPTree<P,N> tree)
tree
- tree to build the region in; must be emptyIllegalArgumentException
- if the tree is not emptyprotected AbstractRegionBSPTree<P,N> buildInternal()
protected void insertPartitionInternal(HyperplaneConvexSubset<P> partition)
partition
- partition to insertIllegalStateException
- if a boundary has previously been insertedprotected void insertBoundaryInternal(HyperplaneConvexSubset<P> boundary)
boundary
- boundary to insertCopyright © 2016–2021 The Apache Software Foundation. All rights reserved.