Interface BSPTree.Node<P extends Point<P>,N extends BSPTree.Node<P,N>>
- Type Parameters:
P
- Point typeN
- BSP tree node implementation type
- All Superinterfaces:
BSPSubtree<P,
N>
- All Known Implementing Classes:
AbstractBSPTree.AbstractNode
,AbstractRegionBSPTree.AbstractRegionNode
,RegionBSPTree1D.RegionNode1D
,RegionBSPTree1S.RegionNode1S
,RegionBSPTree2D.RegionNode2D
,RegionBSPTree2S.RegionNode2S
,RegionBSPTree3D.RegionNode3D
public static interface BSPTree.Node<P extends Point<P>,N extends BSPTree.Node<P,N>>
extends BSPSubtree<P,N>
Interface for Binary Space Partitioning (BSP) tree nodes.
-
Method Summary
Modifier and TypeMethodDescriptionint
depth()
Get the depth of the node in the tree.getCut()
Get the cut for the node.Get the hyperplane containing the node cut, if it exists.getMinus()
Get the node for the minus region of the cell.Get the parent of the node.getPlus()
Get the node for the plus region of the cell.getTree()
Get theBSPTree
that owns the node.boolean
Return true if the node is an internal node, meaning that is has a binary partitioner (aka "cut") and therefore two child nodes.boolean
isLeaf()
Return true if the node is a leaf node, meaning that it has no binary partitioner (aka "cut") and therefore no child nodes.boolean
isMinus()
Return true if the node has a parent and is the parent's minus child.boolean
isPlus()
Return true if the node has a parent and is the parent's plus child.trim
(HyperplaneConvexSubset<P> sub) Trim the given hyperplane subset to the region defined by this node by cutting the argument with the cut hyperplanes (binary partitioners) of all parent nodes up to the root.Methods inherited from interface org.apache.commons.geometry.core.partitioning.bsp.BSPSubtree
accept, count, height, nodes
-
Method Details
-
getTree
Get theBSPTree
that owns the node.- Returns:
- the owning tree
-
depth
int depth()Get the depth of the node in the tree. The root node of the tree has a depth of 0.- Returns:
- the depth of the node in the tree
-
getParent
N getParent()Get the parent of the node. This will be null if the node is the root of the tree.- Returns:
- the parent node for this instance
-
getCut
HyperplaneConvexSubset<P> getCut()Get the cut for the node. This is a hyperplane convex subset that splits the region for the cell into two disjoint regions, namely the plus and minus regions. This will be null for leaf nodes.- Returns:
- the cut for the cell
- See Also:
-
getCutHyperplane
Hyperplane<P> getCutHyperplane()Get the hyperplane containing the node cut, if it exists.- Returns:
- the hyperplane containing the node cut, or null if the node does not have a cut
- See Also:
-
getMinus
N getMinus()Get the node for the minus region of the cell. This will be null if the node has not been cut, ie if it is a leaf node.- Returns:
- the node for the minus region of the cell
-
getPlus
N getPlus()Get the node for the plus region of the cell. This will be null if the node has not been cut, ie if it is a leaf node.- Returns:
- the node for the plus region of the cell
-
isLeaf
boolean isLeaf()Return true if the node is a leaf node, meaning that it has no binary partitioner (aka "cut") and therefore no child nodes.- Returns:
- true if the node is a leaf node
-
isInternal
boolean isInternal()Return true if the node is an internal node, meaning that is has a binary partitioner (aka "cut") and therefore two child nodes.- Returns:
- true if the node is an internal node
-
isMinus
boolean isMinus()Return true if the node has a parent and is the parent's minus child.- Returns:
- true if the node is the minus child of its parent
-
isPlus
boolean isPlus()Return true if the node has a parent and is the parent's plus child.- Returns:
- true if the node is the plus child of its parent
-
trim
Trim the given hyperplane subset to the region defined by this node by cutting the argument with the cut hyperplanes (binary partitioners) of all parent nodes up to the root. Null is returned if the hyperplane subset lies outside of the region defined by the node.- Parameters:
sub
- the hyperplane subset to trim- Returns:
- the trimmed hyperplane subset or null if no part of the argument lies within the node's region
-