OpenVDB 12.0.0
 
Loading...
Searching...
No Matches
RootNode< ChildType > Class Template Reference

#include <openvdb/tree/RootNode.h>

Classes

struct  SameConfiguration
 SameConfiguration<OtherNodeType>::value is true if and only if OtherNodeType is the type of a RootNode whose ChildNodeType has the same configuration as this node's ChildNodeType. More...
 
struct  ValueConverter
 ValueConverter<T>::Type is the type of a RootNode having the same child hierarchy as this node but a different value type, T. More...
 

Public Types

using ChildNodeType = ChildType
 
using LeafNodeType = typename ChildType::LeafNodeType
 
using ValueType = typename ChildType::ValueType
 
using BuildType = typename ChildType::BuildType
 
using NodeChainType = typename NodeChain<RootNode, LEVEL>::Type
 NodeChainType is a list of this tree's node types, from LeafNodeType to RootNode.
 
using ChildOnIter = ChildIter<RootNode, MapIter, ChildOnPred, ChildType>
 
using ChildOnCIter = ChildIter<const RootNode, MapCIter, ChildOnPred, const ChildType>
 
using ChildOffIter = ValueIter<RootNode, MapIter, ChildOffPred, const ValueType>
 
using ChildOffCIter = ValueIter<const RootNode, MapCIter, ChildOffPred, ValueType>
 
using ChildAllIter = DenseIter<RootNode, MapIter, ChildType, ValueType>
 
using ChildAllCIter = DenseIter<const RootNode, MapCIter, const ChildType, const ValueType>
 
using ValueOnIter = ValueIter<RootNode, MapIter, ValueOnPred, ValueType>
 
using ValueOnCIter = ValueIter<const RootNode, MapCIter, ValueOnPred, const ValueType>
 
using ValueOffIter = ValueIter<RootNode, MapIter, ValueOffPred, ValueType>
 
using ValueOffCIter = ValueIter<const RootNode, MapCIter, ValueOffPred, const ValueType>
 
using ValueAllIter = ValueIter<RootNode, MapIter, ValueAllPred, ValueType>
 
using ValueAllCIter = ValueIter<const RootNode, MapCIter, ValueAllPred, const ValueType>
 

Public Member Functions

 RootNode ()
 Construct a new tree with a background value of 0.
 
 RootNode (const ValueType &background)
 Construct a new tree with the given background value.
 
 RootNode (const RootNode &other)
 
template<typename OtherChildType>
 RootNode (const RootNode< OtherChildType > &other)
 Construct a new tree that reproduces the topology and active states of a tree of a different ValueType but the same configuration (levels, node dimensions and branching factors). Cast the other tree's values to this tree's ValueType.
 
template<typename OtherChildType>
 RootNode (const RootNode< OtherChildType > &other, const ValueType &background, const ValueType &foreground, TopologyCopy)
 Construct a new tree that reproduces the topology and active states of another tree (which may have a different ValueType), but not the other tree's values.
 
template<typename OtherChildType>
 RootNode (const RootNode< OtherChildType > &other, const ValueType &background, TopologyCopy)
 Construct a new tree that reproduces the topology and active states of another tree (which may have a different ValueType), but not the other tree's values. All tiles and voxels in the new tree are set to background regardless of their active states in the other tree.
 
RootNodeoperator= (const RootNode &other)
 Copy a root node of the same type as this node.
 
template<typename OtherChildType>
RootNodeoperator= (const RootNode< OtherChildType > &other)
 Copy a root node of the same tree configuration as this node but a different ValueType.
 
 ~RootNode ()
 
ChildOnCIter cbeginChildOn () const
 
ChildOffCIter cbeginChildOff () const
 
ChildAllCIter cbeginChildAll () const
 
ChildOnCIter beginChildOn () const
 
ChildOffCIter beginChildOff () const
 
ChildAllCIter beginChildAll () const
 
ChildOnIter beginChildOn ()
 
ChildOffIter beginChildOff ()
 
ChildAllIter beginChildAll ()
 
ValueOnCIter cbeginValueOn () const
 
ValueOffCIter cbeginValueOff () const
 
ValueAllCIter cbeginValueAll () const
 
ValueOnCIter beginValueOn () const
 
ValueOffCIter beginValueOff () const
 
ValueAllCIter beginValueAll () const
 
ValueOnIter beginValueOn ()
 
ValueOffIter beginValueOff ()
 
ValueAllIter beginValueAll ()
 
Index64 memUsage () const
 Return the total amount of memory in bytes occupied by this node and its children.
 
void evalActiveBoundingBox (CoordBBox &bbox, bool visitVoxels=true) const
 Expand the specified bbox so it includes the active tiles of this root node as well as all the active values in its child nodes. If visitVoxels is false LeafNodes will be approximated as dense, i.e. with all voxels active. Else the individual active voxels are visited to produce a tight bbox.
 
Index32 transientData () const
 Return the transient data value.
 
void setTransientData (Index32 transientData)
 Set the transient data value.
 
void setBackground (const ValueType &value, bool updateChildNodes)
 Change inactive tiles or voxels with a value equal to +/- the old background to the specified value (with the same sign). Active values are unchanged.
 
const ValueTypebackground () const
 Return this node's background value.
 
bool isBackgroundTile (const Tile &) const
 Return true if the given tile is inactive and has the background value.
 
bool isBackgroundTile (const MapIter &) const
 Return true if the given iterator points to an inactive tile with the background value.
 
bool isBackgroundTile (const MapCIter &) const
 
size_t numBackgroundTiles () const
 Return the number of background tiles.
 
size_t eraseBackgroundTiles ()
 Remove all background tiles.
 
void clear ()
 
bool empty () const
 Return true if this node's table is either empty or contains only background tiles.
 
bool expand (const Coord &xyz)
 Expand this node's table so that (x, y, z) is included in the index range.
 
Index getTableSize () const
 Return the number of entries in this node's table.
 
Index getWidth () const
 
Index getHeight () const
 
Index getDepth () const
 
Coord getMinIndex () const
 Return the smallest index of the current tree.
 
Coord getMaxIndex () const
 Return the largest index of the current tree.
 
void getIndexRange (CoordBBox &bbox) const
 Return the current index range. Both min and max are inclusive.
 
template<typename OtherChildType>
bool hasSameTopology (const RootNode< OtherChildType > &other) const
 Return true if the given tree has the same node and active value topology as this tree (but possibly a different ValueType).
 
Index64 leafCount () const
 
Index64 nonLeafCount () const
 
Index32 childCount () const
 
Index32 tileCount () const
 
Index32 activeTileCount () const
 
Index32 inactiveTileCount () const
 
Index64 onVoxelCount () const
 
Index64 offVoxelCount () const
 
Index64 onLeafVoxelCount () const
 
Index64 offLeafVoxelCount () const
 
Index64 onTileCount () const
 
void nodeCount (std::vector< Index64 > &vec) const
 
void nodeCount (std::vector< Index32 > &vec) const
 
bool isValueOn (const Coord &xyz) const
 
bool hasActiveTiles () const
 Return true if this root node, or any of its child nodes, have active tiles.
 
const ValueTypegetValue (const Coord &xyz) const
 
bool probeValue (const Coord &xyz, ValueType &value) const
 
int getValueDepth (const Coord &xyz) const
 Return the tree depth (0 = root) at which the value of voxel (x, y, z) resides.
 
void setActiveState (const Coord &xyz, bool on)
 Set the active state of the voxel at the given coordinates but don't change its value.
 
void setValueOnly (const Coord &xyz, const ValueType &value)
 Set the value of the voxel at the given coordinates but don't change its active state.
 
void setValueOn (const Coord &xyz, const ValueType &value)
 Set the value of the voxel at the given coordinates and mark the voxel as active.
 
void setValueOff (const Coord &xyz)
 Mark the voxel at the given coordinates as inactive but don't change its value.
 
void setValueOff (const Coord &xyz, const ValueType &value)
 Set the value of the voxel at the given coordinates and mark the voxel as inactive.
 
template<typename ModifyOp>
void modifyValue (const Coord &xyz, const ModifyOp &op)
 Apply a functor to the value of the voxel at the given coordinates and mark the voxel as active.
 
template<typename ModifyOp>
void modifyValueAndActiveState (const Coord &xyz, const ModifyOp &op)
 Apply a functor to the voxel at the given coordinates.
 
void fill (const CoordBBox &bbox, const ValueType &value, bool active=true)
 Set all voxels within a given axis-aligned box to a constant value.
 
void sparseFill (const CoordBBox &bbox, const ValueType &value, bool active=true)
 
void denseFill (const CoordBBox &bbox, const ValueType &value, bool active=true)
 Set all voxels within a given axis-aligned box to a constant value and ensure that those voxels are all represented at the leaf level.
 
void voxelizeActiveTiles (bool threaded=true)
 Densify active tiles, i.e., replace them with leaf-level active voxels.
 
template<typename DenseT>
void copyToDense (const CoordBBox &bbox, DenseT &dense) const
 Copy into a dense grid the values of all voxels, both active and inactive, that intersect a given bounding box.
 
bool writeTopology (std::ostream &, bool toHalf=false) const
 
bool readTopology (std::istream &, bool fromHalf=false)
 
void writeBuffers (std::ostream &, bool toHalf=false) const
 
void readBuffers (std::istream &, bool fromHalf=false)
 
void readBuffers (std::istream &, const CoordBBox &, bool fromHalf=false)
 
template<typename AccessorT>
const ValueTypegetValueAndCache (const Coord &xyz, AccessorT &) const
 
template<typename AccessorT>
bool isValueOnAndCache (const Coord &xyz, AccessorT &) const
 
template<typename AccessorT>
void setValueAndCache (const Coord &xyz, const ValueType &value, AccessorT &)
 
template<typename AccessorT>
void setValueOnlyAndCache (const Coord &xyz, const ValueType &value, AccessorT &)
 
template<typename ModifyOp, typename AccessorT>
void modifyValueAndCache (const Coord &xyz, const ModifyOp &op, AccessorT &)
 
template<typename ModifyOp, typename AccessorT>
void modifyValueAndActiveStateAndCache (const Coord &xyz, const ModifyOp &op, AccessorT &)
 
template<typename AccessorT>
void setValueOffAndCache (const Coord &xyz, const ValueType &value, AccessorT &)
 
template<typename AccessorT>
void setActiveStateAndCache (const Coord &xyz, bool on, AccessorT &)
 
template<typename AccessorT>
bool probeValueAndCache (const Coord &xyz, ValueType &value, AccessorT &) const
 
template<typename AccessorT>
int getValueDepthAndCache (const Coord &xyz, AccessorT &) const
 
void clip (const CoordBBox &)
 Set all voxels that lie outside the given axis-aligned box to the background.
 
void prune (const ValueType &tolerance=zeroVal< ValueType >())
 Reduce the memory footprint of this tree by replacing with tiles any nodes whose values are all the same (optionally to within a tolerance) and have the same active state.
 
void addLeaf (LeafNodeType *leaf)
 Add the given leaf node to this tree, creating a new branch if necessary. If a leaf node with the same origin already exists, replace it.
 
template<typename AccessorT>
void addLeafAndCache (LeafNodeType *leaf, AccessorT &)
 Same as addLeaf() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.
 
template<typename NodeT>
NodeT * stealNode (const Coord &xyz, const ValueType &value, bool state)
 Return a pointer to the node of type NodeT that contains voxel (x, y, z) and replace it with a tile of the specified value and state. If no such node exists, leave the tree unchanged and return nullptr.
 
bool addChild (ChildType *child)
 Add the given child node at the root level. If a child node with the same origin already exists, delete the old node and add the new node in its place (i.e. ownership of the new child node is transferred to this RootNode).
 
void addTile (const Coord &xyz, const ValueType &value, bool state)
 Add a tile containing voxel (x, y, z) at the root level, deleting the existing branch if necessary.
 
void addTile (Index level, const Coord &xyz, const ValueType &value, bool state)
 Add a tile containing voxel (x, y, z) at the specified tree level, creating a new branch if necessary. Delete any existing lower-level nodes that contain (x, y, z).
 
template<typename AccessorT>
void addTileAndCache (Index level, const Coord &xyz, const ValueType &, bool state, AccessorT &)
 Same as addTile() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.
 
bool deleteChildOrTile (const Coord &xyz)
 Delete any child or tile containing voxel (x, y, z) at the root level. Do nothing if no child or tile was found.
 
LeafNodeTypetouchLeaf (const Coord &xyz)
 Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, create one that preserves the values and active states of all voxels.
 
template<typename AccessorT>
LeafNodeTypetouchLeafAndCache (const Coord &xyz, AccessorT &acc)
 Same as touchLeaf() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.
 
template<typename NodeT>
NodeT * probeNode (const Coord &xyz)
 Return a pointer to the node that contains voxel (x, y, z). If no such node exists, return nullptr.
 
template<typename NodeT>
const NodeT * probeNode (const Coord &xyz) const
 
template<typename NodeT>
const NodeT * probeConstNode (const Coord &xyz) const
 
bool probe (const Coord &xyz, ChildNodeType *&child, ValueType &value, bool &active)
 Return a pointer to the root child node that contains voxel (x, y, z). If no such node exists, query and set the tile value and active status and return nullptr.
 
bool probeConst (const Coord &xyz, const ChildNodeType *&child, ValueType &value, bool &active) const
 
bool probe (const Coord &xyz, const ChildNodeType *&child, ValueType &value, bool &active) const
 
template<typename NodeT, typename AccessorT>
NodeT * probeNodeAndCache (const Coord &xyz, AccessorT &acc)
 Same as probeNode() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.
 
template<typename NodeT, typename AccessorT>
const NodeT * probeConstNodeAndCache (const Coord &xyz, AccessorT &acc) const
 
ChildNodeTypeprobeChild (const Coord &xyz)
 Return a pointer to the root child node that contains voxel (x, y, z). If no such node exists, return nullptr.
 
const ChildNodeTypeprobeConstChild (const Coord &xyz) const
 
const ChildNodeTypeprobeChild (const Coord &xyz) const
 
LeafNodeTypeprobeLeaf (const Coord &xyz)
 Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, return nullptr.
 
const LeafNodeTypeprobeConstLeaf (const Coord &xyz) const
 
const LeafNodeTypeprobeLeaf (const Coord &xyz) const
 
template<typename AccessorT>
LeafNodeTypeprobeLeafAndCache (const Coord &xyz, AccessorT &acc)
 Same as probeLeaf() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.
 
template<typename AccessorT>
const LeafNodeTypeprobeConstLeafAndCache (const Coord &xyz, AccessorT &acc) const
 
template<typename AccessorT>
const LeafNodeTypeprobeLeafAndCache (const Coord &xyz, AccessorT &acc) const
 
const ValueTypegetTileValueUnsafe (const Coord &xyz) const
 Return the tile value at the given coordinate.
 
bool getTileValueUnsafe (const Coord &xyz, ValueType &value) const
 Return the tile value and active state at the given coordinate.
 
ChildNodeTypegetChildUnsafe (const Coord &xyz)
 Return the child node at the given coordinate.
 
const ChildNodeTypegetConstChildUnsafe (const Coord &xyz) const
 Return the child node at the given coordinate.
 
const ChildNodeTypegetChildUnsafe (const Coord &xyz) const
 Return the child node at the given coordinate.
 
template<typename ArrayT>
void getNodes (ArrayT &array)
 Adds all nodes of a certain type to a container with the following API:
 
template<typename ArrayT>
void getNodes (ArrayT &array) const
 
template<typename ArrayT>
void stealNodes (ArrayT &array, const ValueType &value, bool state)
 Steals all nodes of a certain type from the tree and adds them to a container with the following API:
 
template<typename ArrayT>
void stealNodes (ArrayT &array)
 
template<MergePolicy Policy>
void merge (RootNode &other)
 Efficiently merge another tree into this tree using one of several schemes.
 
template<typename OtherChildType>
void topologyUnion (const RootNode< OtherChildType > &other, const bool preserveTiles=false)
 Union this tree's set of active values with the active values of the other tree, whose ValueType may be different.
 
template<typename OtherChildType>
void topologyIntersection (const RootNode< OtherChildType > &other)
 Intersects this tree's set of active values with the active values of the other tree, whose ValueType may be different.
 
template<typename OtherChildType>
void topologyDifference (const RootNode< OtherChildType > &other)
 Difference this tree's set of active values with the active values of the other tree, whose ValueType may be different. So a resulting voxel will be active only if the original voxel is active in this tree and inactive in the other tree.
 
template<typename CombineOp>
void combine (RootNode &other, CombineOp &, bool prune=false)
 
template<typename CombineOp, typename OtherRootNode>
void combine2 (const RootNode &other0, const OtherRootNode &other1, CombineOp &op, bool prune=false)
 
const Coordorigin () const
 Return the grid index coordinates of this node's local origin.
 
void setOrigin (const Coord &origin)
 change the origin on this root node
 
Coord coordToKey (const Coord &xyz) const
 Return a MapType key for the given coordinates, offset by the mOrigin.
 
bool hasKey (const Coord &key) const
 Return true if this node's mTable contains the given key.
 
template<typename OtherChildType>
RootNode< ChildT > & operator= (const RootNode< OtherChildType > &other)
 
template<typename AccessorT>
const ChildT::ValueType & getValueAndCache (const Coord &xyz, AccessorT &acc) const
 
template<typename AccessorT>
ChildT::LeafNodeType * touchLeafAndCache (const Coord &xyz, AccessorT &acc)
 
template<typename AccessorT>
ChildT::LeafNodeType * probeLeafAndCache (const Coord &xyz, AccessorT &acc)
 
template<typename AccessorT>
const ChildT::LeafNodeType * probeConstLeafAndCache (const Coord &xyz, AccessorT &acc) const
 
template<typename AccessorT>
const ChildT::LeafNodeType * probeLeafAndCache (const Coord &xyz, AccessorT &acc) const
 

Static Public Member Functions

static CoordBBox getNodeBoundingBox ()
 Return the bounding box of this RootNode, i.e., an infinite bounding box.
 
static Index getLevel ()
 
static void getNodeLog2Dims (std::vector< Index > &dims)
 
static Index getChildDim ()
 
template<typename OtherChildType>
static bool hasSameConfiguration (const RootNode< OtherChildType > &other)
 Return false if the other node's dimensions don't match this node's.
 
template<typename OtherChildType>
static bool hasCompatibleValueType (const RootNode< OtherChildType > &other)
 

Static Public Attributes

static const Index LEVEL = 1 + ChildType::LEVEL
 

Friends

template<typename>
class RootNode
 
template<typename, typename, bool>
struct RootNodeCopyHelper
 
template<typename, typename, typename, bool>
struct RootNodeCombineHelper
 

Member Typedef Documentation

◆ BuildType

template<typename ChildType>
using BuildType = typename ChildType::BuildType

◆ ChildAllCIter

template<typename ChildType>
using ChildAllCIter = DenseIter<const RootNode, MapCIter, const ChildType, const ValueType>

◆ ChildAllIter

template<typename ChildType>
using ChildAllIter = DenseIter<RootNode, MapIter, ChildType, ValueType>

◆ ChildNodeType

template<typename ChildType>
using ChildNodeType = ChildType

◆ ChildOffCIter

template<typename ChildType>
using ChildOffCIter = ValueIter<const RootNode, MapCIter, ChildOffPred, ValueType>

◆ ChildOffIter

template<typename ChildType>
using ChildOffIter = ValueIter<RootNode, MapIter, ChildOffPred, const ValueType>

◆ ChildOnCIter

template<typename ChildType>
using ChildOnCIter = ChildIter<const RootNode, MapCIter, ChildOnPred, const ChildType>

◆ ChildOnIter

template<typename ChildType>
using ChildOnIter = ChildIter<RootNode, MapIter, ChildOnPred, ChildType>

◆ LeafNodeType

template<typename ChildType>
using LeafNodeType = typename ChildType::LeafNodeType

◆ NodeChainType

template<typename ChildType>
using NodeChainType = typename NodeChain<RootNode, LEVEL>::Type

NodeChainType is a list of this tree's node types, from LeafNodeType to RootNode.

◆ ValueAllCIter

template<typename ChildType>
using ValueAllCIter = ValueIter<const RootNode, MapCIter, ValueAllPred, const ValueType>

◆ ValueAllIter

template<typename ChildType>
using ValueAllIter = ValueIter<RootNode, MapIter, ValueAllPred, ValueType>

◆ ValueOffCIter

template<typename ChildType>
using ValueOffCIter = ValueIter<const RootNode, MapCIter, ValueOffPred, const ValueType>

◆ ValueOffIter

template<typename ChildType>
using ValueOffIter = ValueIter<RootNode, MapIter, ValueOffPred, ValueType>

◆ ValueOnCIter

template<typename ChildType>
using ValueOnCIter = ValueIter<const RootNode, MapCIter, ValueOnPred, const ValueType>

◆ ValueOnIter

template<typename ChildType>
using ValueOnIter = ValueIter<RootNode, MapIter, ValueOnPred, ValueType>

◆ ValueType

template<typename ChildType>
using ValueType = typename ChildType::ValueType

Constructor & Destructor Documentation

◆ RootNode() [1/6]

template<typename ChildT>
RootNode ( )
inline

Construct a new tree with a background value of 0.

◆ RootNode() [2/6]

template<typename ChildT>
RootNode ( const ValueType & background)
inlineexplicit

Construct a new tree with the given background value.

◆ RootNode() [3/6]

template<typename ChildType>
RootNode ( const RootNode< ChildType > & other)
inline

◆ RootNode() [4/6]

template<typename ChildType>
template<typename OtherChildType>
RootNode ( const RootNode< OtherChildType > & other)
inlineexplicit

Construct a new tree that reproduces the topology and active states of a tree of a different ValueType but the same configuration (levels, node dimensions and branching factors). Cast the other tree's values to this tree's ValueType.

Exceptions
TypeErrorif the other tree's configuration doesn't match this tree's or if this tree's ValueType is not constructible from the other tree's ValueType.

◆ RootNode() [5/6]

template<typename ChildT>
template<typename OtherChildType>
RootNode ( const RootNode< OtherChildType > & other,
const ValueType & background,
const ValueType & foreground,
TopologyCopy  )
inline

Construct a new tree that reproduces the topology and active states of another tree (which may have a different ValueType), but not the other tree's values.

All tiles and voxels that are active in the other tree are set to foreground in the new tree, and all inactive tiles and voxels are set to background.

Parameters
otherthe root node of a tree having (possibly) a different ValueType
backgroundthe value to which inactive tiles and voxels are initialized
foregroundthe value to which active tiles and voxels are initialized
Exceptions
TypeErrorif the other tree's configuration doesn't match this tree's.

◆ RootNode() [6/6]

template<typename ChildT>
template<typename OtherChildType>
RootNode ( const RootNode< OtherChildType > & other,
const ValueType & background,
TopologyCopy  )
inline

Construct a new tree that reproduces the topology and active states of another tree (which may have a different ValueType), but not the other tree's values. All tiles and voxels in the new tree are set to background regardless of their active states in the other tree.

Parameters
otherthe root node of a tree having (possibly) a different ValueType
backgroundthe value to which inactive tiles and voxels are initialized
Note
This copy constructor is generally faster than the one that takes both a foreground and a background value. Its main application is in multithreaded operations where the topology of the output tree exactly matches the input tree.
Exceptions
TypeErrorif the other tree's configuration doesn't match this tree's.

◆ ~RootNode()

template<typename ChildType>
~RootNode ( )
inline

Member Function Documentation

◆ activeTileCount()

template<typename ChildT>
Index32 activeTileCount ( ) const
inline

◆ addChild()

template<typename ChildType>
bool addChild ( ChildType * child)
inline

Add the given child node at the root level. If a child node with the same origin already exists, delete the old node and add the new node in its place (i.e. ownership of the new child node is transferred to this RootNode).

Returns
true (for consistency with InternalNode::addChild)

◆ addLeaf()

template<typename ChildT>
void addLeaf ( LeafNodeType * leaf)
inline

Add the given leaf node to this tree, creating a new branch if necessary. If a leaf node with the same origin already exists, replace it.

◆ addLeafAndCache()

template<typename ChildT>
template<typename AccessorT>
void addLeafAndCache ( LeafNodeType * leaf,
AccessorT & acc )
inline

Same as addLeaf() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.

◆ addTile() [1/2]

template<typename ChildT>
void addTile ( const Coord & xyz,
const ValueType & value,
bool state )
inline

Add a tile containing voxel (x, y, z) at the root level, deleting the existing branch if necessary.

◆ addTile() [2/2]

template<typename ChildT>
void addTile ( Index level,
const Coord & xyz,
const ValueType & value,
bool state )
inline

Add a tile containing voxel (x, y, z) at the specified tree level, creating a new branch if necessary. Delete any existing lower-level nodes that contain (x, y, z).

◆ addTileAndCache()

template<typename ChildT>
template<typename AccessorT>
void addTileAndCache ( Index level,
const Coord & xyz,
const ValueType & value,
bool state,
AccessorT & acc )
inline

Same as addTile() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.

◆ background()

template<typename ChildType>
const ValueType & background ( ) const
inline

Return this node's background value.

◆ beginChildAll() [1/2]

template<typename ChildType>
ChildAllIter beginChildAll ( )
inline

◆ beginChildAll() [2/2]

template<typename ChildType>
ChildAllCIter beginChildAll ( ) const
inline

◆ beginChildOff() [1/2]

template<typename ChildType>
ChildOffIter beginChildOff ( )
inline

◆ beginChildOff() [2/2]

template<typename ChildType>
ChildOffCIter beginChildOff ( ) const
inline

◆ beginChildOn() [1/2]

template<typename ChildType>
ChildOnIter beginChildOn ( )
inline

◆ beginChildOn() [2/2]

template<typename ChildType>
ChildOnCIter beginChildOn ( ) const
inline

◆ beginValueAll() [1/2]

template<typename ChildType>
ValueAllIter beginValueAll ( )
inline

◆ beginValueAll() [2/2]

template<typename ChildType>
ValueAllCIter beginValueAll ( ) const
inline

◆ beginValueOff() [1/2]

template<typename ChildType>
ValueOffIter beginValueOff ( )
inline

◆ beginValueOff() [2/2]

template<typename ChildType>
ValueOffCIter beginValueOff ( ) const
inline

◆ beginValueOn() [1/2]

template<typename ChildType>
ValueOnIter beginValueOn ( )
inline

◆ beginValueOn() [2/2]

template<typename ChildType>
ValueOnCIter beginValueOn ( ) const
inline

◆ cbeginChildAll()

template<typename ChildType>
ChildAllCIter cbeginChildAll ( ) const
inline

◆ cbeginChildOff()

template<typename ChildType>
ChildOffCIter cbeginChildOff ( ) const
inline

◆ cbeginChildOn()

template<typename ChildType>
ChildOnCIter cbeginChildOn ( ) const
inline

◆ cbeginValueAll()

template<typename ChildType>
ValueAllCIter cbeginValueAll ( ) const
inline

◆ cbeginValueOff()

template<typename ChildType>
ValueOffCIter cbeginValueOff ( ) const
inline

◆ cbeginValueOn()

template<typename ChildType>
ValueOnCIter cbeginValueOn ( ) const
inline

◆ childCount()

template<typename ChildT>
Index32 childCount ( ) const
inline

◆ clear()

template<typename ChildT>
void clear ( )
inline

◆ clip()

template<typename ChildT>
void clip ( const CoordBBox & clipBBox)
inline

Set all voxels that lie outside the given axis-aligned box to the background.

◆ combine()

template<typename ChildT>
template<typename CombineOp>
void combine ( RootNode< ChildType > & other,
CombineOp & op,
bool prune = false )
inline

◆ combine2()

template<typename ChildT>
template<typename CombineOp, typename OtherRootNode>
void combine2 ( const RootNode< ChildType > & other0,
const OtherRootNode< ChildType > & other1,
CombineOp & op,
bool prune = false )
inline

◆ coordToKey()

template<typename ChildType>
Coord coordToKey ( const Coord & xyz) const
inline

Return a MapType key for the given coordinates, offset by the mOrigin.

◆ copyToDense()

template<typename ChildT>
template<typename DenseT>
void copyToDense ( const CoordBBox & bbox,
DenseT & dense ) const
inline

Copy into a dense grid the values of all voxels, both active and inactive, that intersect a given bounding box.

Parameters
bboxinclusive bounding box of the voxels to be copied into the dense grid
densedense grid with a stride in z of one (see tools::Dense in tools/Dense.h for the required API)

◆ deleteChildOrTile()

template<typename ChildT>
bool deleteChildOrTile ( const Coord & xyz)
inline

Delete any child or tile containing voxel (x, y, z) at the root level. Do nothing if no child or tile was found.

Warning
This method will invalidate any existing RootNode iterators.
Returns
true if child or tile was deleted

◆ denseFill()

template<typename ChildT>
void denseFill ( const CoordBBox & bbox,
const ValueType & value,
bool active = true )
inline

Set all voxels within a given axis-aligned box to a constant value and ensure that those voxels are all represented at the leaf level.

Parameters
bboxinclusive coordinates of opposite corners of an axis-aligned box.
valuethe value to which to set voxels within the box.
activeif true, mark voxels within the box as active, otherwise mark them as inactive.
See also
voxelizeActiveTiles()

◆ empty()

template<typename ChildType>
bool empty ( ) const
inline

Return true if this node's table is either empty or contains only background tiles.

◆ eraseBackgroundTiles()

template<typename ChildT>
size_t eraseBackgroundTiles ( )
inline

Remove all background tiles.

Returns
the number of tiles removed.

◆ evalActiveBoundingBox()

template<typename ChildT>
void evalActiveBoundingBox ( CoordBBox & bbox,
bool visitVoxels = true ) const
inline

Expand the specified bbox so it includes the active tiles of this root node as well as all the active values in its child nodes. If visitVoxels is false LeafNodes will be approximated as dense, i.e. with all voxels active. Else the individual active voxels are visited to produce a tight bbox.

◆ expand()

template<typename ChildT>
bool expand ( const Coord & xyz)
inline

Expand this node's table so that (x, y, z) is included in the index range.

Returns
true if an expansion was performed (i.e., if (x, y, z) was not already included in the index range).

◆ fill()

template<typename ChildT>
void fill ( const CoordBBox & bbox,
const ValueType & value,
bool active = true )
inline

Set all voxels within a given axis-aligned box to a constant value.

Parameters
bboxinclusive coordinates of opposite corners of an axis-aligned box
valuethe value to which to set voxels within the box
activeif true, mark voxels within the box as active, otherwise mark them as inactive
Note
This operation generates a sparse, but not always optimally sparse, representation of the filled box. Follow fill operations with a prune() operation for optimal sparseness.

◆ getChildDim()

template<typename ChildType>
static Index getChildDim ( )
inlinestatic

◆ getChildUnsafe() [1/2]

template<typename ChildT>
ChildT * getChildUnsafe ( const Coord & xyz)
inline

Return the child node at the given coordinate.

Note
Use beginChildAll() for a safer alternative.
Warning
This method should only be used by experts seeking low-level optimizations.

◆ getChildUnsafe() [2/2]

template<typename ChildT>
const ChildT * getChildUnsafe ( const Coord & xyz) const
inline

Return the child node at the given coordinate.

Note
Use cbeginChildAll() for a safer alternative.
Warning
This method should only be used by experts seeking low-level optimizations.

◆ getConstChildUnsafe()

template<typename ChildT>
const ChildT * getConstChildUnsafe ( const Coord & xyz) const
inline

Return the child node at the given coordinate.

Note
Use cbeginChildAll() for a safer alternative.
Warning
This method should only be used by experts seeking low-level optimizations.

◆ getDepth()

template<typename ChildType>
Index getDepth ( ) const
inline

◆ getHeight()

template<typename ChildType>
Index getHeight ( ) const
inline

◆ getIndexRange()

template<typename ChildT>
void getIndexRange ( CoordBBox & bbox) const
inline

Return the current index range. Both min and max are inclusive.

◆ getLevel()

template<typename ChildType>
static Index getLevel ( )
inlinestatic

◆ getMaxIndex()

template<typename ChildT>
Coord getMaxIndex ( ) const
inline

Return the largest index of the current tree.

◆ getMinIndex()

template<typename ChildT>
Coord getMinIndex ( ) const
inline

Return the smallest index of the current tree.

◆ getNodeBoundingBox()

template<typename ChildType>
static CoordBBox getNodeBoundingBox ( )
inlinestatic

Return the bounding box of this RootNode, i.e., an infinite bounding box.

◆ getNodeLog2Dims()

template<typename ChildT>
void getNodeLog2Dims ( std::vector< Index > & dims)
inlinestatic

◆ getNodes() [1/2]

template<typename ChildT>
template<typename ArrayT>
void getNodes ( ArrayT & array)
inline

Adds all nodes of a certain type to a container with the following API:

struct ArrayT {
using value_type = ...;// defines the type of nodes to be added to the array
void push_back(value_type nodePtr);// method that add nodes to the array
};

An example of a wrapper around a c-style array is:

struct MyArray {
using value_type = LeafType*;
value_type* ptr;
MyArray(value_type* array) : ptr(array) {}
void push_back(value_type leaf) { *ptr++ = leaf; }
};

An example that constructs a list of pointer to all leaf nodes is:

std::vector<const LeafNodeType*> array;//most std contains have the required API
array.reserve(tree.leafCount());//this is a fast preallocation.
tree.getNodes(array);
Definition PointDataGrid.h:170

◆ getNodes() [2/2]

template<typename ChildT>
template<typename ArrayT>
void getNodes ( ArrayT & array) const
inline

◆ getTableSize()

template<typename ChildType>
Index getTableSize ( ) const
inline

Return the number of entries in this node's table.

◆ getTileValueUnsafe() [1/2]

template<typename ChildT>
const ChildT::ValueType & getTileValueUnsafe ( const Coord & xyz) const
inline

Return the tile value at the given coordinate.

Note
Use cbeginValueAll() for a safer alternative.
Warning
This method should only be used by experts seeking low-level optimizations.

◆ getTileValueUnsafe() [2/2]

template<typename ChildT>
bool getTileValueUnsafe ( const Coord & xyz,
ValueType & value ) const
inline

Return the tile value and active state at the given coordinate.

Note
Use cbeginValueAll() for a safer alternative.
Warning
This method should only be used by experts seeking low-level optimizations.

◆ getValue()

template<typename ChildT>
const ChildT::ValueType & getValue ( const Coord & xyz) const
inline

◆ getValueAndCache() [1/2]

template<typename ChildType>
template<typename AccessorT>
const ValueType & getValueAndCache ( const Coord & xyz,
AccessorT &  ) const

Return the value of the voxel at the given coordinates and, if necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing the voxel.

Note
Used internally by ValueAccessor.

◆ getValueAndCache() [2/2]

template<typename ChildType>
template<typename AccessorT>
const ChildT::ValueType & getValueAndCache ( const Coord & xyz,
AccessorT & acc ) const
inline

◆ getValueDepth()

template<typename ChildT>
int getValueDepth ( const Coord & xyz) const
inline

Return the tree depth (0 = root) at which the value of voxel (x, y, z) resides.

If (x, y, z) isn't explicitly represented in the tree (i.e., it is implicitly a background voxel), return -1.

◆ getValueDepthAndCache()

template<typename ChildT>
template<typename AccessorT>
int getValueDepthAndCache ( const Coord & xyz,
AccessorT & acc ) const
inline

Return the tree depth (0 = root) at which the value of voxel (x, y, z) resides. If (x, y, z) isn't explicitly represented in the tree (i.e., it is implicitly a background voxel), return -1. If necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing the voxel.

Note
Used internally by ValueAccessor.

◆ getWidth()

template<typename ChildType>
Index getWidth ( ) const
inline

◆ hasActiveTiles()

template<typename ChildT>
bool hasActiveTiles ( ) const
inline

Return true if this root node, or any of its child nodes, have active tiles.

◆ hasCompatibleValueType()

template<typename ChildT>
template<typename OtherChildType>
bool hasCompatibleValueType ( const RootNode< OtherChildType > & other)
inlinestatic

Return true if values of the other node's ValueType can be converted to values of this node's ValueType.

◆ hasKey()

template<typename ChildType>
bool hasKey ( const Coord & key) const
inline

Return true if this node's mTable contains the given key.

◆ hasSameConfiguration()

template<typename ChildT>
template<typename OtherChildType>
bool hasSameConfiguration ( const RootNode< OtherChildType > & other)
inlinestatic

Return false if the other node's dimensions don't match this node's.

◆ hasSameTopology()

template<typename ChildT>
template<typename OtherChildType>
bool hasSameTopology ( const RootNode< OtherChildType > & other) const
inline

Return true if the given tree has the same node and active value topology as this tree (but possibly a different ValueType).

◆ inactiveTileCount()

template<typename ChildT>
Index32 inactiveTileCount ( ) const
inline

◆ isBackgroundTile() [1/3]

template<typename ChildT>
bool isBackgroundTile ( const MapCIter & iter) const
inline

◆ isBackgroundTile() [2/3]

template<typename ChildT>
bool isBackgroundTile ( const MapIter & iter) const
inline

Return true if the given iterator points to an inactive tile with the background value.

◆ isBackgroundTile() [3/3]

template<typename ChildT>
bool isBackgroundTile ( const Tile & tile) const
inline

Return true if the given tile is inactive and has the background value.

◆ isValueOn()

template<typename ChildT>
bool isValueOn ( const Coord & xyz) const
inline

◆ isValueOnAndCache()

template<typename ChildT>
template<typename AccessorT>
bool isValueOnAndCache ( const Coord & xyz,
AccessorT & acc ) const
inline

Return true if the voxel at the given coordinates is active and, if necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing the voxel.

Note
Used internally by ValueAccessor.

◆ leafCount()

template<typename ChildT>
Index64 leafCount ( ) const
inline

◆ memUsage()

template<typename ChildT>
Index64 memUsage ( ) const
inline

Return the total amount of memory in bytes occupied by this node and its children.

◆ merge()

template<typename ChildT>
template<MergePolicy Policy>
void merge ( RootNode< ChildType > & other)
inline

Efficiently merge another tree into this tree using one of several schemes.

This operation is primarily intended to combine trees that are mostly non-overlapping (for example, intermediate trees from computations that are parallelized across disjoint regions of space).

Note
This operation is not guaranteed to produce an optimally sparse tree. Follow merge() with prune() for optimal sparseness.
Warning
This operation always empties the other tree.

◆ modifyValue()

template<typename ChildT>
template<typename ModifyOp>
void modifyValue ( const Coord & xyz,
const ModifyOp & op )
inline

Apply a functor to the value of the voxel at the given coordinates and mark the voxel as active.

◆ modifyValueAndActiveState()

template<typename ChildT>
template<typename ModifyOp>
void modifyValueAndActiveState ( const Coord & xyz,
const ModifyOp & op )
inline

Apply a functor to the voxel at the given coordinates.

◆ modifyValueAndActiveStateAndCache()

template<typename ChildT>
template<typename ModifyOp, typename AccessorT>
void modifyValueAndActiveStateAndCache ( const Coord & xyz,
const ModifyOp & op,
AccessorT & acc )
inline

Apply a functor to the voxel at the given coordinates. If necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing the voxel.

Note
Used internally by ValueAccessor.

◆ modifyValueAndCache()

template<typename ChildT>
template<typename ModifyOp, typename AccessorT>
void modifyValueAndCache ( const Coord & xyz,
const ModifyOp & op,
AccessorT & acc )
inline

Apply a functor to the value of the voxel at the given coordinates and mark the voxel as active. If necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing the voxel.

Note
Used internally by ValueAccessor.

◆ nodeCount() [1/2]

template<typename ChildT>
void nodeCount ( std::vector< Index32 > & vec) const
inline
Deprecated
"Use input type std::vector<Index64> for nodeCount."

◆ nodeCount() [2/2]

template<typename ChildT>
void nodeCount ( std::vector< Index64 > & vec) const
inline

◆ nonLeafCount()

template<typename ChildT>
Index64 nonLeafCount ( ) const
inline

◆ numBackgroundTiles()

template<typename ChildT>
size_t numBackgroundTiles ( ) const
inline

Return the number of background tiles.

◆ offLeafVoxelCount()

template<typename ChildT>
Index64 offLeafVoxelCount ( ) const
inline

◆ offVoxelCount()

template<typename ChildT>
Index64 offVoxelCount ( ) const
inline

◆ onLeafVoxelCount()

template<typename ChildT>
Index64 onLeafVoxelCount ( ) const
inline

◆ onTileCount()

template<typename ChildT>
Index64 onTileCount ( ) const
inline

◆ onVoxelCount()

template<typename ChildT>
Index64 onVoxelCount ( ) const
inline

◆ operator=() [1/3]

template<typename ChildT>
RootNode< ChildT > & operator= ( const RootNode< ChildType > & other)
inline

Copy a root node of the same type as this node.

◆ operator=() [2/3]

template<typename ChildType>
template<typename OtherChildType>
RootNode & operator= ( const RootNode< OtherChildType > & other)

Copy a root node of the same tree configuration as this node but a different ValueType.

Exceptions
TypeErrorif the other tree's configuration doesn't match this tree's.
Note
This node's ValueType must be constructible from the other node's ValueType. For example, a root node with values of type float can be assigned to a root node with values of type Vec3s, because a Vec3s can be constructed from a float. But a Vec3s root node cannot be assigned to a float root node.

◆ operator=() [3/3]

template<typename ChildType>
template<typename OtherChildType>
RootNode< ChildT > & operator= ( const RootNode< OtherChildType > & other)
inline

◆ origin()

template<typename ChildType>
const Coord & origin ( ) const
inline

Return the grid index coordinates of this node's local origin.

◆ probe() [1/2]

template<typename ChildT>
bool probe ( const Coord & xyz,
ChildNodeType *& child,
ValueType & value,
bool & active )
inline

Return a pointer to the root child node that contains voxel (x, y, z). If no such node exists, query and set the tile value and active status and return nullptr.

◆ probe() [2/2]

template<typename ChildType>
bool probe ( const Coord & xyz,
const ChildNodeType *& child,
ValueType & value,
bool & active ) const
inline

◆ probeChild() [1/2]

template<typename ChildT>
ChildT * probeChild ( const Coord & xyz)
inline

Return a pointer to the root child node that contains voxel (x, y, z). If no such node exists, return nullptr.

◆ probeChild() [2/2]

template<typename ChildType>
const ChildNodeType * probeChild ( const Coord & xyz) const
inline

◆ probeConst()

template<typename ChildT>
bool probeConst ( const Coord & xyz,
const ChildNodeType *& child,
ValueType & value,
bool & active ) const
inline

◆ probeConstChild()

template<typename ChildT>
const ChildT * probeConstChild ( const Coord & xyz) const
inline

◆ probeConstLeaf()

template<typename ChildT>
const ChildT::LeafNodeType * probeConstLeaf ( const Coord & xyz) const
inline

◆ probeConstLeafAndCache() [1/2]

template<typename ChildType>
template<typename AccessorT>
const LeafNodeType * probeConstLeafAndCache ( const Coord & xyz,
AccessorT & acc ) const

◆ probeConstLeafAndCache() [2/2]

template<typename ChildType>
template<typename AccessorT>
const ChildT::LeafNodeType * probeConstLeafAndCache ( const Coord & xyz,
AccessorT & acc ) const
inline

◆ probeConstNode()

template<typename ChildT>
template<typename NodeT>
const NodeT * probeConstNode ( const Coord & xyz) const
inline

◆ probeConstNodeAndCache()

template<typename ChildT>
template<typename NodeT, typename AccessorT>
const NodeT * probeConstNodeAndCache ( const Coord & xyz,
AccessorT & acc ) const
inline

◆ probeLeaf() [1/2]

template<typename ChildT>
ChildT::LeafNodeType * probeLeaf ( const Coord & xyz)
inline

Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, return nullptr.

◆ probeLeaf() [2/2]

template<typename ChildType>
const LeafNodeType * probeLeaf ( const Coord & xyz) const
inline

◆ probeLeafAndCache() [1/4]

template<typename ChildType>
template<typename AccessorT>
LeafNodeType * probeLeafAndCache ( const Coord & xyz,
AccessorT & acc )

Same as probeLeaf() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.

◆ probeLeafAndCache() [2/4]

template<typename ChildType>
template<typename AccessorT>
ChildT::LeafNodeType * probeLeafAndCache ( const Coord & xyz,
AccessorT & acc )
inline

◆ probeLeafAndCache() [3/4]

template<typename ChildType>
template<typename AccessorT>
const LeafNodeType * probeLeafAndCache ( const Coord & xyz,
AccessorT & acc ) const

◆ probeLeafAndCache() [4/4]

template<typename ChildType>
template<typename AccessorT>
const ChildT::LeafNodeType * probeLeafAndCache ( const Coord & xyz,
AccessorT & acc ) const
inline

◆ probeNode() [1/2]

template<typename ChildT>
template<typename NodeT>
NodeT * probeNode ( const Coord & xyz)
inline

Return a pointer to the node that contains voxel (x, y, z). If no such node exists, return nullptr.

◆ probeNode() [2/2]

template<typename ChildT>
template<typename NodeT>
const NodeT * probeNode ( const Coord & xyz) const
inline

◆ probeNodeAndCache()

template<typename ChildT>
template<typename NodeT, typename AccessorT>
NodeT * probeNodeAndCache ( const Coord & xyz,
AccessorT & acc )
inline

Same as probeNode() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.

◆ probeValue()

template<typename ChildT>
bool probeValue ( const Coord & xyz,
ValueType & value ) const
inline

◆ probeValueAndCache()

template<typename ChildT>
template<typename AccessorT>
bool probeValueAndCache ( const Coord & xyz,
ValueType & value,
AccessorT & acc ) const
inline

Return, in value, the value of the voxel at the given coordinates and, if necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing the voxel.

Returns
true if the voxel at the given coordinates is active
Note
Used internally by ValueAccessor.

◆ prune()

template<typename ChildT>
void prune ( const ValueType & tolerance = zeroVal<ValueType>())
inline

Reduce the memory footprint of this tree by replacing with tiles any nodes whose values are all the same (optionally to within a tolerance) and have the same active state.

Note
Consider instead using tools::prune which is multi-threaded!

◆ readBuffers() [1/2]

template<typename ChildT>
void readBuffers ( std::istream & is,
bool fromHalf = false )
inline

◆ readBuffers() [2/2]

template<typename ChildT>
void readBuffers ( std::istream & is,
const CoordBBox & clipBBox,
bool fromHalf = false )
inline

◆ readTopology()

template<typename ChildT>
bool readTopology ( std::istream & is,
bool fromHalf = false )
inline

◆ setActiveState()

template<typename ChildT>
void setActiveState ( const Coord & xyz,
bool on )
inline

Set the active state of the voxel at the given coordinates but don't change its value.

◆ setActiveStateAndCache()

template<typename ChildT>
template<typename AccessorT>
void setActiveStateAndCache ( const Coord & xyz,
bool on,
AccessorT & acc )
inline

Set the active state of the voxel at the given coordinates without changing its value. If necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing the voxel.

Note
Used internally by ValueAccessor.

◆ setBackground()

template<typename ChildT>
void setBackground ( const ValueType & value,
bool updateChildNodes )
inline

Change inactive tiles or voxels with a value equal to +/- the old background to the specified value (with the same sign). Active values are unchanged.

Parameters
valueThe new background value
updateChildNodesIf true the background values of the child nodes is also updated. Else only the background value stored in the RootNode itself is changed.
Note
Instead of setting updateChildNodes to true, consider using tools::changeBackground or tools::changeLevelSetBackground which are multi-threaded!

◆ setOrigin()

template<typename ChildT>
void setOrigin ( const Coord & origin)
inline

change the origin on this root node

Parameters
originthe index coordinates of the new alignment
Warning
This method will throw if the origin is non-zero, since other tools do not yet support variable offsets.

◆ setTransientData()

template<typename ChildType>
void setTransientData ( Index32 transientData)
inline

Set the transient data value.

◆ setValueAndCache()

template<typename ChildT>
template<typename AccessorT>
void setValueAndCache ( const Coord & xyz,
const ValueType & value,
AccessorT & acc )
inline

Change the value of the voxel at the given coordinates and mark it as active. If necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing the voxel.

Note
Used internally by ValueAccessor.

◆ setValueOff() [1/2]

template<typename ChildT>
void setValueOff ( const Coord & xyz)
inline

Mark the voxel at the given coordinates as inactive but don't change its value.

◆ setValueOff() [2/2]

template<typename ChildT>
void setValueOff ( const Coord & xyz,
const ValueType & value )
inline

Set the value of the voxel at the given coordinates and mark the voxel as inactive.

◆ setValueOffAndCache()

template<typename ChildT>
template<typename AccessorT>
void setValueOffAndCache ( const Coord & xyz,
const ValueType & value,
AccessorT & acc )
inline

Change the value of the voxel at the given coordinates and mark it as inactive. If necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing the voxel.

Note
Used internally by ValueAccessor.

◆ setValueOn()

template<typename ChildT>
void setValueOn ( const Coord & xyz,
const ValueType & value )
inline

Set the value of the voxel at the given coordinates and mark the voxel as active.

◆ setValueOnly()

template<typename ChildT>
void setValueOnly ( const Coord & xyz,
const ValueType & value )
inline

Set the value of the voxel at the given coordinates but don't change its active state.

◆ setValueOnlyAndCache()

template<typename ChildT>
template<typename AccessorT>
void setValueOnlyAndCache ( const Coord & xyz,
const ValueType & value,
AccessorT & acc )
inline

Set the value of the voxel at the given coordinates without changing its active state. If necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing the voxel.

Note
Used internally by ValueAccessor.

◆ sparseFill()

template<typename ChildType>
void sparseFill ( const CoordBBox & bbox,
const ValueType & value,
bool active = true )
inline

◆ stealNode()

template<typename ChildT>
template<typename NodeT>
NodeT * stealNode ( const Coord & xyz,
const ValueType & value,
bool state )
inline

Return a pointer to the node of type NodeT that contains voxel (x, y, z) and replace it with a tile of the specified value and state. If no such node exists, leave the tree unchanged and return nullptr.

Note
The caller takes ownership of the node and is responsible for deleting it.
Warning
Since this method potentially removes nodes and branches of the tree, it is important to clear the caches of all ValueAccessors associated with this tree.

◆ stealNodes() [1/2]

template<typename ChildType>
template<typename ArrayT>
void stealNodes ( ArrayT & array)
inline

◆ stealNodes() [2/2]

template<typename ChildT>
template<typename ArrayT>
void stealNodes ( ArrayT & array,
const ValueType & value,
bool state )
inline

Steals all nodes of a certain type from the tree and adds them to a container with the following API:

struct ArrayT {
using value_type = ...;// defines the type of nodes to be added to the array
void push_back(value_type nodePtr);// method that add nodes to the array
};

An example of a wrapper around a c-style array is:

struct MyArray {
using value_type = LeafType*;
value_type* ptr;
MyArray(value_type* array) : ptr(array) {}
void push_back(value_type leaf) { *ptr++ = leaf; }
};

An example that constructs a list of pointer to all leaf nodes is:

std::vector<const LeafNodeType*> array;//most std contains have the required API
array.reserve(tree.leafCount());//this is a fast preallocation.
tree.stealNodes(array);

◆ tileCount()

template<typename ChildT>
Index32 tileCount ( ) const
inline

◆ topologyDifference()

template<typename ChildT>
template<typename OtherChildType>
void topologyDifference ( const RootNode< OtherChildType > & other)
inline

Difference this tree's set of active values with the active values of the other tree, whose ValueType may be different. So a resulting voxel will be active only if the original voxel is active in this tree and inactive in the other tree.

Note
This operation can delete branches in this grid if they overlap with active tiles in the other grid. Likewise active voxels can be turned into inactive voxels resulting in leaf nodes with no active values. Thus, it is recommended to subsequently call prune.

◆ topologyIntersection()

template<typename ChildT>
template<typename OtherChildType>
void topologyIntersection ( const RootNode< OtherChildType > & other)
inline

Intersects this tree's set of active values with the active values of the other tree, whose ValueType may be different.

The resulting state of a value is active only if the corresponding value was already active AND if it is active in the other tree. Also, a resulting value maps to a voxel if the corresponding value already mapped to an active voxel in either of the two grids and it maps to an active tile or voxel in the other grid.

Note
This operation can delete branches in this grid if they overlap with inactive tiles in the other grid. Likewise active voxels can be turned into inactive voxels resulting in leaf nodes with no active values. Thus, it is recommended to subsequently call prune.

◆ topologyUnion()

template<typename ChildT>
template<typename OtherChildType>
void topologyUnion ( const RootNode< OtherChildType > & other,
const bool preserveTiles = false )
inline

Union this tree's set of active values with the active values of the other tree, whose ValueType may be different.

The resulting state of a value is active if the corresponding value was already active OR if it is active in the other tree. Also, a resulting value maps to a voxel if the corresponding value already mapped to a voxel OR if it is a voxel in the other tree. Thus, a resulting value can only map to a tile if the corresponding value already mapped to a tile AND if it is a tile value in other tree.

Note
This operation modifies only active states, not values. Specifically, active tiles and voxels in this tree are not changed, and tiles or voxels that were inactive in this tree but active in the other tree are marked as active in this tree but left with their original values.
If preserveTiles is true, any active tile in this topology will not be densified by overlapping child topology.

◆ touchLeaf()

template<typename ChildT>
ChildT::LeafNodeType * touchLeaf ( const Coord & xyz)
inline

Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, create one that preserves the values and active states of all voxels.

Use this method to preallocate a static tree topology over which to safely perform multithreaded processing.

◆ touchLeafAndCache() [1/2]

template<typename ChildType>
template<typename AccessorT>
LeafNodeType * touchLeafAndCache ( const Coord & xyz,
AccessorT & acc )

Same as touchLeaf() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.

◆ touchLeafAndCache() [2/2]

template<typename ChildType>
template<typename AccessorT>
ChildT::LeafNodeType * touchLeafAndCache ( const Coord & xyz,
AccessorT & acc )
inline

◆ transientData()

template<typename ChildType>
Index32 transientData ( ) const
inline

Return the transient data value.

◆ voxelizeActiveTiles()

template<typename ChildT>
void voxelizeActiveTiles ( bool threaded = true)
inline

Densify active tiles, i.e., replace them with leaf-level active voxels.

Parameters
threadedif true, this operation is multi-threaded (over the internal nodes).
Warning
This method can explode the tree's memory footprint, especially if it contains active tiles at the upper levels (in particular the root level)!
See also
denseFill()

◆ writeBuffers()

template<typename ChildT>
void writeBuffers ( std::ostream & os,
bool toHalf = false ) const
inline

◆ writeTopology()

template<typename ChildT>
bool writeTopology ( std::ostream & os,
bool toHalf = false ) const
inline

Friends And Related Symbol Documentation

◆ RootNode

template<typename ChildType>
template<typename>
friend class RootNode
friend

During topology-only construction, access is needed to protected/private members of other template instances.

◆ RootNodeCombineHelper

template<typename ChildType>
template<typename, typename, typename, bool>
friend struct RootNodeCombineHelper
friend

◆ RootNodeCopyHelper

template<typename ChildType>
template<typename, typename, bool>
friend struct RootNodeCopyHelper
friend

Member Data Documentation

◆ LEVEL

template<typename ChildType>
const Index LEVEL = 1 + ChildType::LEVEL
static