P
- Point implementation typeN
- BSP tree node implementation typepublic abstract static class AbstractRegionBSPTree.AbstractRegionNode<P extends Point<P>,N extends AbstractRegionBSPTree.AbstractRegionNode<P,N>> extends AbstractBSPTree.AbstractNode<P,N>
BSPTree.Node
implementation for use with AbstractRegionBSPTree
s.Modifier | Constructor and Description |
---|---|
protected |
AbstractRegionNode(AbstractBSPTree<P,N> tree)
Simple constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
clearCut()
Remove the cut from this node.
|
N |
cut(Hyperplane<P> cutter)
Cut this node with the given hyperplane.
|
N |
cut(Hyperplane<P> cutter,
RegionCutRule cutRule)
Cut this node with the given hyperplane, using
cutRule to determine the region
locations of any new child nodes. |
RegionCutBoundary<P> |
getCutBoundary()
Get the portion of the node's cut that lies on the boundary of the region.
|
RegionLocation |
getLocation()
Get the location property of the node.
|
AbstractRegionBSPTree<P,N> |
getTree()
Get the
BSPTree that owns the node. |
boolean |
insertCut(Hyperplane<P> cutter)
Insert a cut into this node, using the default region cut rule of
RegionCutRule.MINUS_INSIDE . |
boolean |
insertCut(Hyperplane<P> cutter,
RegionCutRule cutRule)
Insert a cut into this node.
|
boolean |
isInside()
True if the node is a leaf node and has a location of
RegionLocation.INSIDE . |
boolean |
isOutside()
True if the node is a leaf node and has a location of
RegionLocation.OUTSIDE . |
protected void |
nodeInvalidated()
Method called from
AbstractBSPTree.AbstractNode.checkValid() when updates
are detected in the tree. |
void |
setLocation(RegionLocation location)
Set the location property for the node.
|
protected void |
setLocationValue(RegionLocation locationValue)
Directly set the value of the location property for the node.
|
String |
toString() |
accept, checkValid, count, depth, getCut, getCutHyperplane, getMinus, getParent, getPlus, getSelf, height, isInternal, isLeaf, isMinus, isPlus, makeRoot, nodes, setSubtree, trim
protected AbstractRegionNode(AbstractBSPTree<P,N> tree)
tree
- owning tree instancepublic AbstractRegionBSPTree<P,N> getTree()
BSPTree
that owns the node.getTree
in interface BSPTree.Node<P extends Point<P>,N extends AbstractRegionBSPTree.AbstractRegionNode<P,N>>
getTree
in class AbstractBSPTree.AbstractNode<P extends Point<P>,N extends AbstractRegionBSPTree.AbstractRegionNode<P,N>>
public RegionLocation getLocation()
public void setLocation(RegionLocation location)
Only the locations of leaf nodes are meaningful as they relate to the region represented by the BSP tree. For example, changing the location of an internal node will only affect the geometric properties of the region if the node later becomes a leaf node.
location
- the location for the nodeIllegalArgumentException
- if location
is not one of
INSIDE
or OUTSIDE
public boolean isInside()
RegionLocation.INSIDE
.RegionLocation.INSIDE
public boolean isOutside()
RegionLocation.OUTSIDE
.RegionLocation.OUTSIDE
public boolean insertCut(Hyperplane<P> cutter)
RegionCutRule.MINUS_INSIDE
.cutter
- the hyperplane to cut the node's region withinsertCut(Hyperplane, RegionCutRule)
public boolean insertCut(Hyperplane<P> cutter, RegionCutRule cutRule)
HyperplaneConvexSubset
representing the intersection, new plus and minus child leaf nodes
are assigned, and true is returned. If the hyperplane does not intersect
the node's region, then the node's cut and plus and minus child references
are all set to null (ie, it becomes a leaf node) and false is returned. In
either case, any existing cut and/or child nodes are removed by this method.cutter
- the hyperplane to cut the node's region withcutRule
- rule used to determine the region locations of newly created
child nodespublic boolean clearCut()
public N cut(Hyperplane<P> cutter)
cutter
- the hyperplane to cut the node's region withinsertCut(Hyperplane)
public N cut(Hyperplane<P> cutter, RegionCutRule cutRule)
cutRule
to determine the region
locations of any new child nodes. The same node is returned, regardless of
the outcome of the cut operation. If the operation succeeded, then the node will
have plus and minus child nodes.cutter
- the hyperplane to cut the node's region withcutRule
- rule used to determine the region locations of newly created
child nodesinsertCut(Hyperplane, RegionCutRule)
public RegionCutBoundary<P> getCutBoundary()
public String toString()
toString
in class AbstractBSPTree.AbstractNode<P extends Point<P>,N extends AbstractRegionBSPTree.AbstractRegionNode<P,N>>
protected void nodeInvalidated()
AbstractBSPTree.AbstractNode.checkValid()
when updates
are detected in the tree. This method should clear out any
computed properties that rely on the structure of the tree
and prepare them for recalculation.nodeInvalidated
in class AbstractBSPTree.AbstractNode<P extends Point<P>,N extends AbstractRegionBSPTree.AbstractRegionNode<P,N>>
protected void setLocationValue(RegionLocation locationValue)
locationValue
- the new location value for the nodesetLocation(RegionLocation)
Copyright © 2016–2021 The Apache Software Foundation. All rights reserved.