Top Description Inners Fields Constructors Methods
org.apache.commons.math3.geometry.partitioning

public Class BSPTree<S extends Space>

extends Object
Class Inheritance
Type Parameters
<S>
Type of the space.
Imports
java.util.ArrayList, .List, org.apache.commons.math3.exception.MathIllegalStateException, .MathInternalError, org.apache.commons.math3.exception.util.LocalizedFormats, org.apache.commons.math3.geometry.Point, .Space, .Vector, org.apache.commons.math3.util.FastMath

This class represent a Binary Space Partition tree.

BSP trees are an efficient way to represent space partitions and to associate attributes with each cell. Each node in a BSP tree represents a convex region which is partitioned in two convex sub-regions at each side of a cut hyperplane. The root tree contains the complete space.

The main use of such partitions is to use a boolean attribute to define an inside/outside property, hence representing arbitrary polytopes (line segments in 1D, polygons in 2D and polyhedrons in 3D) and to operate on them.

Another example would be to represent Voronoi tesselations, the attribute of each cell holding the defining point of the cell.

The application-defined attributes are shared among copied instances and propagated to split parts. These attributes are not used by the BSP-tree algorithms themselves, so the application can use them for any purpose. Since the tree visiting method holds internal and leaf nodes differently, it is possible to use different classes for internal nodes attributes and leaf nodes attributes. This should be used with care, though, because if the tree is modified in any way after attributes have been set, some internal nodes may become leaf nodes and some leaf nodes may become internal nodes.

One of the main sources for the development of this package was Bruce Naylor, John Amanatides and William Thibault paper Merging BSP Trees Yields Polyhedral Set Operations Proc. Siggraph '90, Computer Graphics 24(4), August 1990, pp 115-124, published by the Association for Computing Machinery (ACM).

Since
3.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
BSPTree.LeafMerger<
Type of the space.
S extends Space
>

This interface gather the merging operations between a BSP tree leaf and another BSP tree.

public static interface
BSPTree.VanishingCutHandler<
Type of the space.
S extends Space
>

This interface handles the corner cases when an internal node cut sub-hyperplane vanishes.

Field Summary

Modifier and TypeField and Description
private Object
attribute

Application-defined attribute.

private SubHyperplane<S>
cut

Cut sub-hyperplane.

private BSPTree<S>
minus

Tree at the minus side of the cut hyperplane.

private BSPTree<S>
parent

Parent tree.

private BSPTree<S>
plus

Tree at the plus side of the cut hyperplane.

Constructor Summary

AccessConstructor and Description
public
BSPTree()

Build a tree having only one root cell representing the whole space.

public
BSPTree(final Object
attribute of the tree (may be null)
attribute
)

Build a tree having only one root cell representing the whole space.

public
BSPTree(final SubHyperplane<S>
cut sub-hyperplane for the tree
cut
,
final BSPTree<S>
plus side sub-tree
plus
,
final BSPTree<S>
minus side sub-tree
minus
,
final Object
attribute associated with the node (may be null)
attribute
)

Build a BSPTree from its underlying elements.

Method Summary

Modifier and TypeMethod and Description
private void
chopOffMinus(final Hyperplane<S>
chopping hyperplane
hyperplane
,
final BSPTree.VanishingCutHandler<S>
handler to use for handling very rare corner cases of vanishing cut sub-hyperplanes in internal nodes during merging
vanishingHandler
)

Chop off parts of the tree.

private void
chopOffPlus(final Hyperplane<S>
chopping hyperplane
hyperplane
,
final BSPTree.VanishingCutHandler<S>
handler to use for handling very rare corner cases of vanishing cut sub-hyperplanes in internal nodes during merging
vanishingHandler
)

Chop off parts of the tree.

private void
condense()

Perform condensation on a tree.

public BSPTree<S>

Returns:

a new tree, copy of the instance
copySelf
()

Copy the instance.

private SubHyperplane<S>

Returns:

a new sub-hyperplane, guaranteed to have no part outside of the instance cell
fitToCell
(final SubHyperplane<S>
sub-hyperplane to fit
sub
)

Fit a sub-hyperplane inside the cell defined by the instance.

public Object

Returns:

attribute associated with the node or null if no attribute has been explicitly set using the setAttribute method
getAttribute
()

Get the attribute associated with the instance.

public BSPTree<S>

Returns:

the tree cell to which the point belongs
getCell
(final Vector<S>
point to check
point
)
Deprecated as of 3.3, replaced with getCell(Point, double)

Get the cell to which a point belongs.

public BSPTree<S>

Returns:

the tree cell to which the point belongs
getCell
(final Point<S>
point to check
point
,
final double
tolerance below which points close to a cut hyperplane are considered to belong to the hyperplane itself
tolerance
)

Get the cell to which a point belongs.

public List<BSPTree<S>>

Returns:

close cells (may be empty if all cut sub-hyperplanes are farther than maxOffset from the point)
getCloseCuts
(final Point<S>
point to check
point
,
final double
offset below which a cut sub-hyperplane is considered close to the point (in absolute value)
maxOffset
)

Get the cells whose cut sub-hyperplanes are close to the point.

public SubHyperplane<S>

Returns:

cut sub-hyperplane, null if this is a leaf tree
getCut
()

Get the cut sub-hyperplane.

public BSPTree<S>

Returns:

tree on the minus side of the cut hyperplane, null if this is a leaf tree
getMinus
()

Get the tree on the minus side of the cut hyperplane.

public BSPTree<S>

Returns:

parent node, null if the node has no parents
getParent
()

Get the parent node.

public BSPTree<S>

Returns:

tree on the plus side of the cut hyperplane, null if this is a leaf tree
getPlus
()

Get the tree on the plus side of the cut hyperplane.

public boolean

Returns:

true if a cut sub-hyperplane has been inserted (i.e. if the cell now has two leaf child nodes)
insertCut
(final Hyperplane<S>
hyperplane to insert, it will be chopped in order to fit in the cell defined by the parent nodes of the instance
hyperplane
)

Insert a cut sub-hyperplane in a node.

public void
insertInTree(final BSPTree<S>
parent tree to connect to (may be null)
parentTree
,
final boolean
if true and if parentTree is not null, the resulting tree should be the plus child of its parent, ignored if parentTree is null
isPlusChild
)
Deprecated as of 3.4, replaced with insertInTree(BSPTree, boolean, VanishingCutHandler)

Insert the instance into another tree.

public void
insertInTree(final BSPTree<S>
parent tree to connect to (may be null)
parentTree
,
final boolean
if true and if parentTree is not null, the resulting tree should be the plus child of its parent, ignored if parentTree is null
isPlusChild
,
final BSPTree.VanishingCutHandler<S>
handler to use for handling very rare corner cases of vanishing cut sub-hyperplanes in internal nodes during merging
vanishingHandler
)

Insert the instance into another tree.

public BSPTree<S>

Returns:

a new tree, result of instance <op> tree, this value can be ignored if parentTree is not null since all connections have already been established
merge
(final BSPTree<S>
other tree to merge with the instance (will be unusable after the operation, as well as the instance itself)
tree
,
final BSPTree.LeafMerger<S>
object implementing the final merging phase (this is where the semantic of the operation occurs, generally depending on the attribute of the leaf node)
leafMerger
)

Merge a BSP tree with the instance.

private BSPTree<S>

Returns:

a new tree, result of instance <op> tree, this value can be ignored if parentTree is not null since all connections have already been established
merge
(final BSPTree<S>
other tree to merge with the instance (will be unusable after the operation, as well as the instance itself)
tree
,
final BSPTree.LeafMerger<S>
object implementing the final merging phase (this is where the semantic of the operation occurs, generally depending on the attribute of the leaf node)
leafMerger
,
final BSPTree<S>
parent tree to connect to (may be null)
parentTree
,
final boolean
if true and if parentTree is not null, the resulting tree should be the plus child of its parent, ignored if parentTree is null
isPlusChild
)

Merge a BSP tree with the instance.

public BSPTree<S>

Returns:

a new tree (the original tree is left untouched) containing a single branch with the cell as a leaf node, and other leaf nodes as the remnants of the pruned branches
pruneAroundConvexCell
(final Object
attribute to set for the leaf node corresponding to the initial instance cell
cellAttribute
,
final Object
attribute to set for the other leaf nodes
otherLeafsAttributes
,
final Object
attribute to set for the internal nodes
internalAttributes
)

Prune a tree around a cell.

private void
recurseCloseCuts(final Point<S>
point to check
point
,
final double
offset below which a cut sub-hyperplane is considered close to the point (in absolute value)
maxOffset
,
final List<BSPTree<S>>
list to fill
close
)

Get the cells whose cut sub-hyperplanes are close to the point.

public void
setAttribute(final Object
attribute to associate with the node
attribute
)

Associate an attribute with the instance.

public BSPTree<S>

Returns:

a tree having the specified sub-hyperplane as its cut sub-hyperplane, the two parts of the split instance as its two sub-trees and a null parent
split
(final SubHyperplane<S>
partitioning sub-hyperplane, must be already clipped to the convex region represented by the instance, will be used as the cut sub-hyperplane of the returned tree
sub
)

Split a BSP tree by an external sub-hyperplane.

public void
visit(final BSPTreeVisitor<S>
object visiting the tree nodes
visitor
)

Visit the BSP tree nodes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributeback to summary
private Object attribute

Application-defined attribute.

cutback to summary
private SubHyperplane<S> cut

Cut sub-hyperplane.

minusback to summary
private BSPTree<S> minus

Tree at the minus side of the cut hyperplane.

parentback to summary
private BSPTree<S> parent

Parent tree.

plusback to summary
private BSPTree<S> plus

Tree at the plus side of the cut hyperplane.

Constructor Detail

BSPTreeback to summary
public BSPTree()

Build a tree having only one root cell representing the whole space.

BSPTreeback to summary
public BSPTree(final Object attribute)

Build a tree having only one root cell representing the whole space.

Parameters
attribute:Object

attribute of the tree (may be null)

BSPTreeback to summary
public BSPTree(final SubHyperplane<S> cut, final BSPTree<S> plus, final BSPTree<S> minus, final Object attribute)

Build a BSPTree from its underlying elements.

This method does not perform any verification on consistency of its arguments, it should therefore be used only when then caller knows what it is doing.

This method is mainly useful to build trees bottom-up. Building trees top-down is realized with the help of method insertCut.

Parameters
cut:SubHyperplane<S>

cut sub-hyperplane for the tree

plus:BSPTree<S>

plus side sub-tree

minus:BSPTree<S>

minus side sub-tree

attribute:Object

attribute associated with the node (may be null)

See Also
insertCut

Method Detail

chopOffMinusback to summary
private void chopOffMinus(final Hyperplane<S> hyperplane, final BSPTree.VanishingCutHandler<S> vanishingHandler)

Chop off parts of the tree.

The instance is modified in place, all the parts that are on the minus side of the chopping hyperplane are discarded, only the parts on the plus side remain.

Parameters
hyperplane:Hyperplane<S>

chopping hyperplane

vanishingHandler:BSPTree.VanishingCutHandler<S>

handler to use for handling very rare corner cases of vanishing cut sub-hyperplanes in internal nodes during merging

chopOffPlusback to summary
private void chopOffPlus(final Hyperplane<S> hyperplane, final BSPTree.VanishingCutHandler<S> vanishingHandler)

Chop off parts of the tree.

The instance is modified in place, all the parts that are on the plus side of the chopping hyperplane are discarded, only the parts on the minus side remain.

Parameters
hyperplane:Hyperplane<S>

chopping hyperplane

vanishingHandler:BSPTree.VanishingCutHandler<S>

handler to use for handling very rare corner cases of vanishing cut sub-hyperplanes in internal nodes during merging

condenseback to summary
private void condense()

Perform condensation on a tree.

The condensation operation is not recursive, it must be called explicitly from leaves to root.

copySelfback to summary
public BSPTree<S> copySelf()

Copy the instance.

The instance created is completely independent of the original one. A deep copy is used, none of the underlying objects are shared (except for the nodes attributes and immutable objects).

Returns:BSPTree<S>

a new tree, copy of the instance

fitToCellback to summary
private SubHyperplane<S> fitToCell(final SubHyperplane<S> sub)

Fit a sub-hyperplane inside the cell defined by the instance.

Fitting is done by chopping off the parts of the sub-hyperplane that lie outside of the cell using the cut-hyperplanes of the parent nodes of the instance.

Parameters
sub:SubHyperplane<S>

sub-hyperplane to fit

Returns:SubHyperplane<S>

a new sub-hyperplane, guaranteed to have no part outside of the instance cell

getAttributeback to summary
public Object getAttribute()

Get the attribute associated with the instance.

Returns:Object

attribute associated with the node or null if no attribute has been explicitly set using the setAttribute method

See Also
setAttribute
getCellback to summary
public BSPTree<S> getCell(final Vector<S> point)

Deprecated

as of 3.3, replaced with getCell(Point, double)

Get the cell to which a point belongs.

If the returned cell is a leaf node the points belongs to the interior of the node, if the cell is an internal node the points belongs to the node cut sub-hyperplane.

Parameters
point:Vector<S>

point to check

Returns:BSPTree<S>

the tree cell to which the point belongs

Annotations
@Deprecated
getCellback to summary
public BSPTree<S> getCell(final Point<S> point, final double tolerance)

Get the cell to which a point belongs.

If the returned cell is a leaf node the points belongs to the interior of the node, if the cell is an internal node the points belongs to the node cut sub-hyperplane.

Parameters
point:Point<S>

point to check

tolerance:double

tolerance below which points close to a cut hyperplane are considered to belong to the hyperplane itself

Returns:BSPTree<S>

the tree cell to which the point belongs

getCloseCutsback to summary
public List<BSPTree<S>> getCloseCuts(final Point<S> point, final double maxOffset)

Get the cells whose cut sub-hyperplanes are close to the point.

Parameters
point:Point<S>

point to check

maxOffset:double

offset below which a cut sub-hyperplane is considered close to the point (in absolute value)

Returns:List<BSPTree<S>>

close cells (may be empty if all cut sub-hyperplanes are farther than maxOffset from the point)

getCutback to summary
public SubHyperplane<S> getCut()

Get the cut sub-hyperplane.

Returns:SubHyperplane<S>

cut sub-hyperplane, null if this is a leaf tree

getMinusback to summary
public BSPTree<S> getMinus()

Get the tree on the minus side of the cut hyperplane.

Returns:BSPTree<S>

tree on the minus side of the cut hyperplane, null if this is a leaf tree

getParentback to summary
public BSPTree<S> getParent()

Get the parent node.

Returns:BSPTree<S>

parent node, null if the node has no parents

getPlusback to summary
public BSPTree<S> getPlus()

Get the tree on the plus side of the cut hyperplane.

Returns:BSPTree<S>

tree on the plus side of the cut hyperplane, null if this is a leaf tree

insertCutback to summary
public boolean insertCut(final Hyperplane<S> hyperplane)

Insert a cut sub-hyperplane in a node.

The sub-tree starting at this node will be completely overwritten. The new cut sub-hyperplane will be built from the intersection of the provided hyperplane with the cell. If the hyperplane does intersect the cell, the cell will have two children cells with null attributes on each side of the inserted cut sub-hyperplane. If the hyperplane does not intersect the cell then no cut hyperplane will be inserted and the cell will be changed to a leaf cell. The attribute of the node is never changed.

This method is mainly useful when called on leaf nodes (i.e. nodes for which getCut returns null), in this case it provides a way to build a tree top-down (whereas the 4 arguments constructor is devoted to build trees bottom-up).

Parameters
hyperplane:Hyperplane<S>

hyperplane to insert, it will be chopped in order to fit in the cell defined by the parent nodes of the instance

Returns:boolean

true if a cut sub-hyperplane has been inserted (i.e. if the cell now has two leaf child nodes)

See Also
BSPTree(SubHyperplane, BSPTree, BSPTree, Object)
insertInTreeback to summary
public void insertInTree(final BSPTree<S> parentTree, final boolean isPlusChild)

Deprecated

as of 3.4, replaced with insertInTree(BSPTree, boolean, VanishingCutHandler)

Insert the instance into another tree.

The instance itself is modified so its former parent should not be used anymore.

Parameters
parentTree:BSPTree<S>

parent tree to connect to (may be null)

isPlusChild:boolean

if true and if parentTree is not null, the resulting tree should be the plus child of its parent, ignored if parentTree is null

Annotations
@Deprecated
See Also
LeafMerger
insertInTreeback to summary
public void insertInTree(final BSPTree<S> parentTree, final boolean isPlusChild, final BSPTree.VanishingCutHandler<S> vanishingHandler)

Insert the instance into another tree.

The instance itself is modified so its former parent should not be used anymore.

Parameters
parentTree:BSPTree<S>

parent tree to connect to (may be null)

isPlusChild:boolean

if true and if parentTree is not null, the resulting tree should be the plus child of its parent, ignored if parentTree is null

vanishingHandler:BSPTree.VanishingCutHandler<S>

handler to use for handling very rare corner cases of vanishing cut sub-hyperplanes in internal nodes during merging

Since
3.4
See Also
LeafMerger
mergeback to summary
public BSPTree<S> merge(final BSPTree<S> tree, final BSPTree.LeafMerger<S> leafMerger)

Merge a BSP tree with the instance.

All trees are modified (parts of them are reused in the new tree), it is the responsibility of the caller to ensure a copy has been done before if any of the former tree should be preserved, no such copy is done here!

The algorithm used here is directly derived from the one described in the Naylor, Amanatides and Thibault paper (section III, Binary Partitioning of a BSP Tree).

Parameters
tree:BSPTree<S>

other tree to merge with the instance (will be unusable after the operation, as well as the instance itself)

leafMerger:BSPTree.LeafMerger<S>

object implementing the final merging phase (this is where the semantic of the operation occurs, generally depending on the attribute of the leaf node)

Returns:BSPTree<S>

a new tree, result of instance <op> tree, this value can be ignored if parentTree is not null since all connections have already been established

mergeback to summary
private BSPTree<S> merge(final BSPTree<S> tree, final BSPTree.LeafMerger<S> leafMerger, final BSPTree<S> parentTree, final boolean isPlusChild)

Merge a BSP tree with the instance.

Parameters
tree:BSPTree<S>

other tree to merge with the instance (will be unusable after the operation, as well as the instance itself)

leafMerger:BSPTree.LeafMerger<S>

object implementing the final merging phase (this is where the semantic of the operation occurs, generally depending on the attribute of the leaf node)

parentTree:BSPTree<S>

parent tree to connect to (may be null)

isPlusChild:boolean

if true and if parentTree is not null, the resulting tree should be the plus child of its parent, ignored if parentTree is null

Returns:BSPTree<S>

a new tree, result of instance <op> tree, this value can be ignored if parentTree is not null since all connections have already been established

pruneAroundConvexCellback to summary
public BSPTree<S> pruneAroundConvexCell(final Object cellAttribute, final Object otherLeafsAttributes, final Object internalAttributes)

Prune a tree around a cell.

This method can be used to extract a convex cell from a tree. The original cell may either be a leaf node or an internal node. If it is an internal node, it's subtree will be ignored (i.e. the extracted cell will be a leaf node in all cases). The original tree to which the original cell belongs is not touched at all, a new independent tree will be built.

Parameters
cellAttribute:Object

attribute to set for the leaf node corresponding to the initial instance cell

otherLeafsAttributes:Object

attribute to set for the other leaf nodes

internalAttributes:Object

attribute to set for the internal nodes

Returns:BSPTree<S>

a new tree (the original tree is left untouched) containing a single branch with the cell as a leaf node, and other leaf nodes as the remnants of the pruned branches

Since
3.3
recurseCloseCutsback to summary
private void recurseCloseCuts(final Point<S> point, final double maxOffset, final List<BSPTree<S>> close)

Get the cells whose cut sub-hyperplanes are close to the point.

Parameters
point:Point<S>

point to check

maxOffset:double

offset below which a cut sub-hyperplane is considered close to the point (in absolute value)

close:List<BSPTree<S>>

list to fill

setAttributeback to summary
public void setAttribute(final Object attribute)

Associate an attribute with the instance.

Parameters
attribute:Object

attribute to associate with the node

See Also
getAttribute
splitback to summary
public BSPTree<S> split(final SubHyperplane<S> sub)

Split a BSP tree by an external sub-hyperplane.

Split a tree in two halves, on each side of the sub-hyperplane. The instance is not modified.

The tree returned is not upward-consistent: despite all of its sub-trees cut sub-hyperplanes (including its own cut sub-hyperplane) are bounded to the current cell, it is not attached to any parent tree yet. This tree is intended to be later inserted into an higher level tree.

The algorithm used here is the one given in Naylor, Amanatides and Thibault paper (section III, Binary Partitioning of a BSP Tree).

Parameters
sub:SubHyperplane<S>

partitioning sub-hyperplane, must be already clipped to the convex region represented by the instance, will be used as the cut sub-hyperplane of the returned tree

Returns:BSPTree<S>

a tree having the specified sub-hyperplane as its cut sub-hyperplane, the two parts of the split instance as its two sub-trees and a null parent

visitback to summary
public void visit(final BSPTreeVisitor<S> visitor)

Visit the BSP tree nodes.

Parameters
visitor:BSPTreeVisitor<S>

object visiting the tree nodes

org.apache.commons.math3.geometry.partitioning back to summary

public Interface BSPTree.LeafMerger<S extends Space>

Known Direct Implementers
org.apache.commons.math3.geometry.partitioning.RegionFactory.UnionMerger, org.apache.commons.math3.geometry.partitioning.RegionFactory.IntersectionMerger, org.apache.commons.math3.geometry.partitioning.RegionFactory.XorMerger, org.apache.commons.math3.geometry.partitioning.RegionFactory.DifferenceMerger
Type Parameters
<S>
Type of the space.

This interface gather the merging operations between a BSP tree leaf and another BSP tree.

As explained in Bruce Naylor, John Amanatides and William Thibault paper Merging BSP Trees Yields Polyhedral Set Operations, the operations on BSP trees can be expressed as a generic recursive merging operation where only the final part, when one of the operand is a leaf, is specific to the real operation semantics. For example, a tree representing a region using a boolean attribute to identify inside cells and outside cells would use four different objects to implement the final merging phase of the four set operations union, intersection, difference and symmetric difference (exclusive or).

Method Summary

Modifier and TypeMethod and Description
public BSPTree<S>

Returns:

the BSP tree resulting from the merging (may be one of the arguments)
merge
(BSPTree<S>
leaf node (its cut hyperplane is guaranteed to be null)
leaf
,
BSPTree<S>
tree node (its cut hyperplane may be null or not)
tree
,
BSPTree<S>
parent tree to connect to (may be null)
parentTree
,
boolean
if true and if parentTree is not null, the resulting tree should be the plus child of its parent, ignored if parentTree is null
isPlusChild
,
boolean
if true, the leaf node comes from the instance tree (tree1) and the tree node comes from the argument tree (tree2)
leafFromInstance
)

Merge a leaf node and a tree node.

Method Detail

mergeback to summary
public BSPTree<S> merge(BSPTree<S> leaf, BSPTree<S> tree, BSPTree<S> parentTree, boolean isPlusChild, boolean leafFromInstance)

Merge a leaf node and a tree node.

This method is called at the end of a recursive merging resulting from a tree1.merge(tree2, leafMerger) call, when one of the sub-trees involved is a leaf (i.e. when its cut-hyperplane is null). This is the only place where the precise semantics of the operation are required. For all upper level nodes in the tree, the merging operation is only a generic partitioning algorithm.

Since the final operation may be non-commutative, it is important to know if the leaf node comes from the instance tree (tree1) or the argument tree (tree2). The third argument of the method is devoted to this. It can be ignored for commutative operations.

The BSPTree.insertInTree method may be useful to implement this method.

Parameters
leaf:BSPTree<S>

leaf node (its cut hyperplane is guaranteed to be null)

tree:BSPTree<S>

tree node (its cut hyperplane may be null or not)

parentTree:BSPTree<S>

parent tree to connect to (may be null)

isPlusChild:boolean

if true and if parentTree is not null, the resulting tree should be the plus child of its parent, ignored if parentTree is null

leafFromInstance:boolean

if true, the leaf node comes from the instance tree (tree1) and the tree node comes from the argument tree (tree2)

Returns:BSPTree<S>

the BSP tree resulting from the merging (may be one of the arguments)

org.apache.commons.math3.geometry.partitioning back to summary

public Interface BSPTree.VanishingCutHandler<S extends Space>

Known Direct Implementers
org.apache.commons.math3.geometry.partitioning.RegionFactory.DifferenceMerger, org.apache.commons.math3.geometry.partitioning.RegionFactory.VanishingToLeaf
Type Parameters
<S>
Type of the space.

This interface handles the corner cases when an internal node cut sub-hyperplane vanishes.

Such cases happens for example when a cut sub-hyperplane is inserted into another tree (during a merge operation), and is split in several parts, some of which becomes smaller than the tolerance. The corresponding node as then no cut sub-hyperplane anymore, but does have children. This interface specifies how to handle this situation. setting

Since
3.4

Method Summary

Modifier and TypeMethod and Description
public BSPTree<S>

Returns:

fixed node
fixNode
(BSPTree<S>
node to fix
node
)

Fix a node with both vanished cut and children.

Method Detail

fixNodeback to summary
public BSPTree<S> fixNode(BSPTree<S> node)

Fix a node with both vanished cut and children.

Parameters
node:BSPTree<S>

node to fix

Returns:BSPTree<S>

fixed node