public static final class RegionBSPTree3D.PartitionedRegionBuilder3D extends AbstractPartitionedRegionBuilder<Vector3D,RegionBSPTree3D.RegionNode3D>
Usage of this class consists of 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 insertPartition
or similar methods. The INHERIT
cut rule is used internally to insert the cut so 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, using insertBoundary
or
similar methods. 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 build
method is used
to perform final processing and return the computed tree.
buildInternal, insertBoundaryInternal, insertPartitionInternal
public RegionBSPTree3D.PartitionedRegionBuilder3D insertPartition(Plane partition)
partition
- partition to insertIllegalStateException
- if a boundary has previously been insertedpublic RegionBSPTree3D.PartitionedRegionBuilder3D insertPartition(PlaneConvexSubset partition)
partition
- partition to insertIllegalStateException
- if a boundary has previously been insertedpublic RegionBSPTree3D.PartitionedRegionBuilder3D insertAxisAlignedPartitions(Vector3D center, Precision.DoubleEquivalence precision)
center
point and have the normals +x
, +y
,
and +z
in that order. If inserted into an empty tree, this will partition the space
into 8 sections.center
- center point for the partitions; all 3 inserted planes intersect at this pointprecision
- precision context used to construct the planesIllegalStateException
- if a boundary has previously been insertedpublic RegionBSPTree3D.PartitionedRegionBuilder3D insertAxisAlignedGrid(Bounds3D bounds, int level, Precision.DoubleEquivalence precision)
insertAxisAlignedPartitions
.
The algorithm then recurses using bounding boxes from the min point to the center and from the center
point to the max. Note that this means no partitions are ever inserted directly on the boundaries of
the given bounding box. This is intentional and done to allow this method to be called directly with the
bounding box from a set of boundaries to be inserted without unnecessarily adding partitions that will
never have region boundaries on both sides.bounds
- bounding box for the gridlevel
- recursion level for the grid; each level subdivides each grid cube into 8 sections, making the
total number of grid cubes equal to 8 ^ level
precision
- precision context used to construct the partition planesIllegalStateException
- if a boundary has previously been insertedpublic RegionBSPTree3D.PartitionedRegionBuilder3D insertBoundary(PlaneConvexSubset boundary)
boundary
- region boundary to insertpublic RegionBSPTree3D.PartitionedRegionBuilder3D insertBoundaries(Iterable<? extends PlaneConvexSubset> boundaries)
boundaries
- boundaries to insertpublic RegionBSPTree3D.PartitionedRegionBuilder3D insertBoundaries(BoundarySource3D boundarySrc)
boundarySrc
- source of boundaries to insertpublic RegionBSPTree3D build()
Copyright © 2016–2021 The Apache Software Foundation. All rights reserved.