Class RegionBSPTree1S
- All Implemented Interfaces:
BSPSubtree<Point1S,,RegionBSPTree1S.RegionNode1S> BSPTree<Point1S,,RegionBSPTree1S.RegionNode1S> HyperplaneBoundedRegion<Point1S>,Splittable<Point1S,,HyperplaneBoundedRegion<Point1S>> Region<Point1S>,Sized
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classInternal class containing pairs of interval boundaries.private static final classClass used to project points onto the region boundary.static final classBSP tree node for one dimensional spherical space.Nested classes/interfaces inherited from class org.apache.commons.geometry.core.partitioning.bsp.AbstractRegionBSPTree
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>> Nested classes/interfaces inherited from class org.apache.commons.geometry.core.partitioning.bsp.AbstractBSPTree
AbstractBSPTree.AbstractNode<P extends Point<P>,N extends AbstractBSPTree.AbstractNode<P, N>>, AbstractBSPTree.SubtreeInitializer<N extends AbstractBSPTree.AbstractNode<?, ?>> Nested classes/interfaces inherited from interface org.apache.commons.geometry.core.partitioning.bsp.BSPTree
BSPTree.FindNodeCutRule, BSPTree.Node<P extends Point<P>,N extends BSPTree.Node<P, N>> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Comparator<RegionBSPTree1S.BoundaryPair> Comparator used to sort BoundaryPairs by ascending azimuth. -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new, empty instance.RegionBSPTree1S(boolean full) Create a new region. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(AngularInterval interval) Add an interval to this region.Compute the size-related properties of the region.copy()Return a deep copy of this instance.private AngularIntervalCreate an interval instance from the min boundary from the start boundary pair and the max boundary from the end boundary pair.protected RegionBSPTree1S.RegionNode1SCreate a new node for this tree.static RegionBSPTree1Sempty()Return a new, empty BSP tree.static RegionBSPTree1SfromInterval(AngularInterval interval) Return a new BSP tree representing the same region as the given angular interval.static RegionBSPTree1Sfull()Return a new, full BSP tree.private intgetIntervalStartIndex(List<RegionBSPTree1S.BoundaryPair> boundaryPairs) Get the index that should be used as the starting point for combining adjacent boundary pairs into contiguous intervals.private RegionBSPTree1S.BoundaryPairReturn the min/max boundary pair for the convex region represented by the given node.Project a point onto the boundary of the region.private static voidsafeUnion(RegionBSPTree1S target, RegionBSPTree1S input) Perform a union operation withtargetandinput, storing the result intarget; does nothing ifinputis null.split(Hyperplane<Point1S> splitter) Split this instance with the given hyperplane.splitDiameter(CutAngle splitter) Split the instance along a circle diameter.The diameter is defined by the given split point and its reversed antipodal point.Convert the region represented by this tree into a list of separateAngularIntervals, arranged in order of ascending min value.voidTransform this tree.Methods inherited from class org.apache.commons.geometry.core.partitioning.bsp.AbstractRegionBSPTree
boundaries, classify, complement, complement, condense, copyNodeProperties, createBoundaryIterable, createBoundaryList, difference, difference, getBoundaries, getBoundarySize, getCentroid, getRegionSizeProperties, getSize, getSubtreeInitializer, insert, insert, insert, insert, insert, insert, insert, insert, intersection, intersection, invalidate, isEmpty, isFull, setEmpty, setFull, split, union, union, xor, xorMethods inherited from class org.apache.commons.geometry.core.partitioning.bsp.AbstractBSPTree
accept, accept, copy, copyNode, copySubtree, count, cutNode, extract, extractParentPath, findNode, findNode, getRoot, getVersion, height, importSubtree, insert, nodes, removeNodeCut, setNodeCut, setRoot, splitIntoTrees, splitSubtree, swapsInsideOutside, toString, treeString, treeString, trimToNodeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.commons.geometry.core.Sized
isFinite, isInfinite
-
Field Details
-
BOUNDARY_PAIR_COMPARATOR
Comparator used to sort BoundaryPairs by ascending azimuth.
-
-
Constructor Details
-
RegionBSPTree1S
public RegionBSPTree1S()Create a new, empty instance. -
RegionBSPTree1S
public RegionBSPTree1S(boolean full) Create a new region. Iffullis true, then the region will represent the entire circle. Otherwise, it will be empty.- Parameters:
full- whether or not the region should contain the entire circle or be empty
-
-
Method Details
-
copy
Return a deep copy of this instance.- Returns:
- a deep copy of this instance.
- See Also:
-
add
Add an interval to this region. The resulting region will be the union of the interval and the region represented by this instance.- Parameters:
interval- the interval to add
-
project
Project a point onto the boundary of the region. Null is returned if the region contains no boundaries (ie, is eitherfullorempty).- Specified by:
projectin interfaceRegion<Point1S>- Overrides:
projectin classAbstractRegionBSPTree<Point1S,RegionBSPTree1S.RegionNode1S> - Parameters:
pt- pt to project- Returns:
- projection of the point on the boundary of the region or null if the region does not contain any boundaries
-
transform
Transform this tree. Each cut in the tree is transformed in place using the givenTransform.Each interval of the region is transformed individually and the results are unioned. If the size of any transformed interval is greater than or equal to 2pi, then the region is set to the full space.
- Specified by:
transformin interfaceBSPTree<Point1S,RegionBSPTree1S.RegionNode1S> - Overrides:
transformin classAbstractBSPTree<Point1S,RegionBSPTree1S.RegionNode1S> - Parameters:
transform- the transform to apply
-
split
Split this instance with the given hyperplane.It is important to note that split operations occur according to the rules of the
CutAnglehyperplane class. In this class, the continuous circle is viewed as a non-circular segment of the number line in the range[0, 2pi). Hyperplanes are placed along this line and partition it into the segments[0, x]and[x, 2pi), wherexis the location of the hyperplane. For example, a positive-facingCutAngleinstance with an azimuth of0.5pihas a minus side consisting of the angles[0, 0.5pi]and a plus side consisting of the angles[0.5pi, 2pi). Similarly, a positive-facingCutAnglewith an azimuth of0pihas a plus side of[0, 2pi)(the full space) and a minus side that is completely empty (since no points exist in our domain that are less than zero). These rules can result in somewhat non-intuitive behavior at times. For example, splitting a non-empty region with a hyperplane at0piis essentially a no-op, since the region will either lie entirely on the plus or minus side of the hyperplane (depending on the hyperplane's orientation) regardless of the actual content of the region. In these situations, a copy of the tree is returned on the appropriate side of the split.- Parameters:
splitter- the hyperplane to split this object with.- Returns:
- result of the split operation
- See Also:
-
splitDiameter
Split the instance along a circle diameter.The diameter is defined by the given split point and its reversed antipodal point.- Parameters:
splitter- split point defining one side of the split diameter- Returns:
- result of the split operation
-
toIntervals
Convert the region represented by this tree into a list of separateAngularIntervals, arranged in order of ascending min value.- Returns:
- list of
AngularIntervals representing this region in order of ascending min value
-
getIntervalStartIndex
Get the index that should be used as the starting point for combining adjacent boundary pairs into contiguous intervals. This is computed as the first boundary pair found that is not connected to the pair before it, or0if no such entry exists.- Parameters:
boundaryPairs- list of boundary pairs to search; must be ordered by increasing azimuth- Returns:
- the index to use as a starting place for combining adjacent boundary pairs into contiguous intervals
-
createInterval
private AngularInterval createInterval(RegionBSPTree1S.BoundaryPair start, RegionBSPTree1S.BoundaryPair end) Create an interval instance from the min boundary from the start boundary pair and the max boundary from the end boundary pair. The hyperplane directions are adjusted as needed.- Parameters:
start- starting boundary pairend- ending boundary pair- Returns:
- an interval created from the min boundary of the given start pair and the max boundary from the given end pair
-
getNodeBoundaryPair
Return the min/max boundary pair for the convex region represented by the given node.- Parameters:
node- the node to compute the interval for- Returns:
- the min/max boundary pair for the convex region represented by the given node
-
computeRegionSizeProperties
Compute the size-related properties of the region.- Specified by:
computeRegionSizePropertiesin classAbstractRegionBSPTree<Point1S,RegionBSPTree1S.RegionNode1S> - Returns:
- object containing size properties for the region
-
createNode
Create a new node for this tree.- Specified by:
createNodein classAbstractBSPTree<Point1S,RegionBSPTree1S.RegionNode1S> - Returns:
- a new node for this tree
-
empty
Return a new, empty BSP tree.- Returns:
- a new, empty BSP tree.
-
full
Return a new, full BSP tree. The returned tree represents the full space.- Returns:
- a new, full BSP tree.
-
fromInterval
Return a new BSP tree representing the same region as the given angular interval.- Parameters:
interval- the input interval- Returns:
- a new BSP tree representing the same region as the given angular interval
-
safeUnion
Perform a union operation withtargetandinput, storing the result intarget; does nothing ifinputis null.- Parameters:
target- target treeinput- input tree
-