Skip to content

OBBTree ​

Introduction ​

vtkOBBTree - generate an oriented bounding box hierarchy for a dataset

vtkOBBTree builds a tree of oriented bounding boxes over the cells of a vtkPolyData. Each node holds the box of a subset of the cells, split in two along its longest axis until the leaves hold no more than numberOfCellsPerNode cells or the maximum level is reached. The tree can then be tested against another OBB tree to find intersecting cells.

Methods ​

buildLocator ​

Build the OBB tree of the current dataset. The tree is discarded and rebuilt on every call.

computeOBBFromDataset ​

Compute the oriented bounding box of a dataset without building a tree. The results are written into the arrays passed in.

ArgumentTypeRequiredDescription
inputvtkPolyDataYes
cornerVector3Yescorner the axes originate from
maxVector3Yeslongest axis
midVector3Yesmiddle axis
minVector3Yesshortest axis
sizeVector3Yesextent of the box along each axis

deepCopy ​

Copy the settings and the tree of another OBB tree into this one.

ArgumentTypeRequiredDescription
treevtkOBBTreeYes

disjointOBBNodes ​

Test whether two nodes are disjoint, nodeB being optionally transformed into the space of nodeA by XformBtoA. Returns 0 when the boxes overlap and the number of the separating axis test that succeeded otherwise.

ArgumentTypeRequiredDescription
nodeAvtkOBBNodeYes
nodeBvtkOBBNodeYes
XformBtoAmat4Noassumed to be orthogonal

extend ​

Method used to decorate a given object (publicAPI+model) with vtkOBBTree characteristics.

ArgumentTypeRequiredDescription
publicAPIYesobject on which methods will be bounds (public)
modelYesobject on which data structure will be bounds (protected)
initialValuesIOBBTreeInitialValuesNo(default: {})

findTriangleIntersections ​

Intersect the triangles of two leaf nodes and append the resulting segments to info.intersectionLines. Returns the number of intersection lines found.

ArgumentTypeRequiredDescription
infoITriangleIntersectionInfoYes
node0vtkOBBNodeYesleaf of this tree
node1vtkOBBNodeYesleaf of info.obbTree1
transformmat4No

generateRepresentation ​

Create a polygonal representation of the boxes at the given level. When level is negative the leaf nodes are gathered instead. Returns null when the tree has not been built.

ArgumentTypeRequiredDescription
levelNumberYes

getAutomatic ​

Get whether the number of cells per node is computed from the dataset.

getDataset ​

Get the dataset the tree is built from.

getLevel ​

Get the depth reached by the last call to buildLocator.

getMaxLevel ​

Get the maximum depth of the tree.

getNumberOfCellsPerNode ​

Get the number of cells below which a node is not split any further.

getRetainCellLists ​

Get whether the cell lists of the non-leaf nodes are kept.

getTolerance ​

Get the tolerance used by the separating axis tests.

getTree ​

Get the root node of the tree.

intersectWithOBBTree ​

Traverse this tree against obbTreeB and call onIntersect for every pair of intersecting leaf nodes. obbTreeB is optionally transformed into the space of this tree by XformBtoA. Returns the accumulated absolute value of the callback results.

ArgumentTypeRequiredDescription
obbTreeBvtkOBBTreeYes
XformBtoAmat4No
onIntersectOnIntersectCallbackNo(default: () => -1)

intersectionLines ​

Polydata the intersection points and lines are appended to.

newInstance ​

Method used to create a new instance of vtkOBBTree

ArgumentTypeRequiredDescription
initialValuesIOBBTreeInitialValuesNofor pre-setting some of its content

obbTree1 ​

The tree the triangles of the second node belong to.

setAutomatic ​

Set whether the number of cells per node is computed from the dataset.

ArgumentTypeRequiredDescription
automaticBooleanYes

setDataset ​

Set the dataset the tree is built from.

ArgumentTypeRequiredDescription
datasetvtkPolyDataYes

setLevel ​

Set the depth of the tree.

ArgumentTypeRequiredDescription
levelNumberYes

setMaxLevel ​

Set the maximum depth of the tree.

ArgumentTypeRequiredDescription
maxLevelNumberYes

setNumberOfCellsPerNode ​

Set the number of cells below which a node is not split any further.

ArgumentTypeRequiredDescription
numberOfCellsPerNodeNumberYes

setRetainCellLists ​

Set whether the cell lists of the non-leaf nodes are kept.

ArgumentTypeRequiredDescription
retainCellListsNumberYes

setTolerance ​

Set the tolerance used by the separating axis tests.

ArgumentTypeRequiredDescription
toleranceNumberYes

setTree ​

Set the root node of the tree.

ArgumentTypeRequiredDescription
treevtkOBBNodeYes

transform ​

Apply a transform to every node of the tree in place.

ArgumentTypeRequiredDescription
transformTransformYesa vtkMatrixBuilder transform

triangleIntersectsNode ​

Test whether a triangle intersects a node, the triangle being optionally transformed into the space of the node by XformBtoA. Returns 1 when they overlap and 0 otherwise.

ArgumentTypeRequiredDescription
nodeAvtkOBBNodeYes
p0Vector3Yes
p1Vector3Yes
p2Vector3Yes
XformBtoAmat4Noassumed to be orthogonal