OpenVDB  1.2.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
RootNode< ChildType > Class Template Reference

#include <RootNode.h>

Classes

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

typedef ChildType ChildNodeType
 
typedef ChildType::LeafNodeType LeafNodeType
 
typedef ChildType::ValueType ValueType
 
typedef ChildIter< RootNode,
MapIter, ChildOnPred,
ChildType > 
ChildOnIter
 
typedef ChildIter< const
RootNode, MapCIter,
ChildOnPred, const ChildType > 
ChildOnCIter
 
typedef ValueIter< RootNode,
MapIter, ChildOffPred, const
ValueType
ChildOffIter
 
typedef ValueIter< const
RootNode, MapCIter,
ChildOffPred, ValueType
ChildOffCIter
 
typedef DenseIter< RootNode,
MapIter, ChildType, ValueType
ChildAllIter
 
typedef DenseIter< const
RootNode, MapCIter, const
ChildType, const ValueType
ChildAllCIter
 
typedef ValueIter< RootNode,
MapIter, ValueOnPred,
ValueType
ValueOnIter
 
typedef ValueIter< const
RootNode, MapCIter,
ValueOnPred, const ValueType
ValueOnCIter
 
typedef ValueIter< RootNode,
MapIter, ValueOffPred,
ValueType
ValueOffIter
 
typedef ValueIter< const
RootNode, MapCIter,
ValueOffPred, const ValueType
ValueOffCIter
 
typedef ValueIter< RootNode,
MapIter, ValueAllPred,
ValueType
ValueAllIter
 
typedef ValueIter< const
RootNode, MapCIter,
ValueAllPred, const ValueType
ValueAllCIter
 

Public Member Functions

 RootNode ()
 Construct a new tree with a background value of 0. More...
 
 RootNode (const ValueType &background)
 Construct a new tree with the given background value. More...
 
 RootNode (const RootNode &other)
 
template<typename OtherChildType >
 RootNode (const RootNode< OtherChildType > &other, const ValueType &background, const ValueType &foreground, TopologyCopy)
 Topology copy constructor that guarantees the configuration of the constructed tree is topologically identical to the other tree. More...
 
template<typename OtherChildType >
 RootNode (const RootNode< OtherChildType > &other, const ValueType &background, TopologyCopy)
 Topology copy constructor that guarantees the configuration of the constructed tree is topologically identical to the other tree. More...
 
RootNodeoperator= (const RootNode &other)
 
 ~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. More...
 
void evalActiveVoxelBoundingBox (CoordBBox &bbox) 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. More...
 
void setBackground (const ValueType &value)
 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. More...
 
const ValueTypebackground () const
 Return the background value. More...
 
OPENVDB_DEPRECATED ValueType getBackground () const
 
bool isBackgroundTile (const Tile &) const
 Return true if the given tile is inactive and has the background value. More...
 
size_t numBackgroundTiles () const
 Return the number of background tiles. More...
 
size_t eraseBackgroundTiles ()
 Remove all background tiles. More...
 
void clear ()
 
bool empty () const
 Return true if this node's table is either empty or contains only background tiles. More...
 
bool expand (const Coord &xyz)
 Expand this node's table so that (x, y, z) is included in the index range. More...
 
Index getTableSize () const
 Return the number of entries in this node's table. More...
 
Index getWidth () const
 
Index getHeight () const
 
Index getDepth () const
 
Coord getMinIndex () const
 Return the smallest index of the current tree. More...
 
Coord getMaxIndex () const
 Return the largest index of the current tree. More...
 
void getIndexRange (CoordBBox &bbox) const
 Return the current index range. Both min and max are inclusive. More...
 
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). More...
 
Index32 leafCount () const
 
Index32 nonLeafCount () const
 
Index64 onVoxelCount () const
 
Index64 offVoxelCount () const
 
Index64 onLeafVoxelCount () const
 
Index64 offLeafVoxelCount () const
 
bool isValueOn (const Coord &xyz) const
 
bool hasActiveTiles () const
 
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. More...
 
void setActiveState (const Coord &xyz, bool on)
 Set the active state of the voxel at the given coordinates, but don't change its value. More...
 
void setValueOff (const Coord &xyz)
 Mark the voxel at the given coordinates as inactive, but don't change its value. More...
 
void setValueOff (const Coord &xyz, const ValueType &value)
 Change the value of the voxel at the given coordinates and mark the voxel as inactive. More...
 
void setValueOn (const Coord &xyz, const ValueType &value)
 
void setValueOnly (const Coord &xyz, const ValueType &value)
 
void setValueOnMin (const Coord &xyz, const ValueType &value)
 
void setValueOnMax (const Coord &xyz, const ValueType &value)
 
void setValueOnSum (const Coord &xyz, const ValueType &value)
 
void fill (const CoordBBox &bbox, const ValueType &value, bool active=true)
 Set all voxels within a given box to a constant value, if necessary subdividing tiles that intersect the box. More...
 
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. More...
 
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)
 
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 AccessorT >
void setValueOnSumAndCache (const Coord &xyz, const ValueType &value, 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
 
template<typename PruneOp >
void pruneOp (PruneOp &)
 
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. More...
 
void pruneInactive (const ValueType &)
 Reduce the memory footprint of this tree by replacing with tiles of the given value any nodes whose values are all inactive. More...
 
void pruneInactive ()
 Reduce the memory footprint of this tree by replacing with background tiles any nodes whose values are all inactive. More...
 
void pruneTiles (const ValueType &)
 
void addLeaf (LeafNodeType *leaf)
 Add the specified leaf to this node, possibly creating a child branch in the process. If the leaf node already exists, replace it. More...
 
template<typename AccessorT >
void addLeafAndCache (LeafNodeType *leaf, AccessorT &)
 Same as addLeaf except, if necessary, it update the accessor with pointers to the nodes along the path from the root node to the node containing the coordinate. More...
 
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 NULL. More...
 
void addTile (Index level, const Coord &xyz, const ValueType &value, bool state)
 Add a tile at the specified tree level that contains voxel (x, y, z), possibly creating a parent branch or deleting a child branch in the process. More...
 
template<typename AccessorT >
void addTileAndCache (Index level, const Coord &xyz, const ValueType &value, bool state, AccessorT &)
 Same as addTile() except, if necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing (x, y, z). More...
 
LeafNodeTypetouchLeaf (const Coord &xyz)
 Return the leaf node that contains voxel (x, y, z). If no such node exists, create one, but preserve the values and active states of all voxels. More...
 
template<typename AccessorT >
LeafNodeTypetouchLeafAndCache (const Coord &xyz, AccessorT &acc)
 Same as touchLeaf except, if necessary, it update the accessor with pointers to the nodes along the path from the root node to the node containing the coordinate. More...
 
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 NULL. More...
 
template<typename NodeT >
const NodeT * probeConstNode (const Coord &xyz) const
 
template<typename NodeT , typename AccessorT >
NodeT * probeNodeAndCache (const Coord &xyz, AccessorT &acc)
 Same as probeNode except, if necessary, it update the accessor with pointers to the nodes along the path from the root node to the node containing the coordinate. More...
 
template<typename NodeT , typename AccessorT >
const NodeT * probeConstNodeAndCache (const Coord &xyz, AccessorT &acc) const
 Same as probeConstNode except, if necessary, it update the accessor with pointers to the nodes along the path from the root node to the node containing the coordinate. More...
 
LeafNodeTypeprobeLeaf (const Coord &xyz)
 Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, return NULL. More...
 
const LeafNodeTypeprobeConstLeaf (const Coord &xyz) const
 Return a const pointer to the leaf node that contains voxel (x, y, z). If no such node exists, return NULL. More...
 
const LeafNodeTypeprobeLeaf (const Coord &xyz) const
 Same as probeConstLeaf. More...
 
template<typename AccessorT >
LeafNodeTypeprobeLeafAndCache (const Coord &xyz, AccessorT &acc)
 Same as probeLeaf except, if necessary, it update the accessor with pointers to the nodes along the path from the root node to the node containing the coordinate. More...
 
template<typename AccessorT >
const LeafNodeTypeprobeConstLeafAndCache (const Coord &xyz, AccessorT &acc) const
 Same as probeConstLeaf except, if necessary, it update the accessor with pointers to the nodes along the path from the root node to the node containing the coordinate. More...
 
template<typename AccessorT >
const LeafNodeTypeprobeLeafAndCache (const Coord &xyz, AccessorT &acc) const
 Same as probeConstLeafAndCache. More...
 
void signedFloodFill ()
 Set the values of all inactive voxels and tiles of a narrow-band level set from the signs of the active voxels, setting outside values to +background and inside values to -background. More...
 
void signedFloodFill (const ValueType &outside, const ValueType &inside)
 Set the values of all inactive voxels and tiles of a narrow-band level set from the signs of the active voxels, setting exterior values to outside and interior values to inside. Set the background value of this tree to outside. More...
 
void merge (RootNode &other)
 
void voxelizeActiveTiles ()
 Turn active tiles into dense voxels, i.e., into leaf nodes that are entirely active. More...
 
template<typename OtherChildType >
void topologyUnion (const RootNode< OtherChildType > &other)
 Union this tree's set of active values with the active values of the other tree, whose ValueType may be different. More...
 
template<typename CombineOp >
void combine (RootNode &other, CombineOp &, bool prune=false)
 
template<typename CombineOp >
void combine2 (const RootNode &other0, const RootNode &other1, CombineOp &op, bool prune=false)
 
template<typename BBoxOp >
void visitActiveBBox (BBoxOp &) const
 Calls the templated functor BBoxOp with bounding box information for all active tiles and leaf nodes in the tree. An additional level argument is provided for each callback. More...
 
template<typename VisitorOp >
void visit (VisitorOp &)
 
template<typename VisitorOp >
void visit (VisitorOp &) const
 
template<typename OtherRootNodeType , typename VisitorOp >
void visit2 (OtherRootNodeType &other, VisitorOp &)
 
template<typename OtherRootNodeType , typename VisitorOp >
void visit2 (OtherRootNodeType &other, VisitorOp &) const
 
template<typename OtherChildType >
bool hasSameConfiguration (const RootNode< OtherChildType > &)
 
template<typename OtherChildType >
void enforceSameConfiguration (const RootNode< OtherChildType > &)
 
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 NodeT >
bool hasNodeType ()
 
template<typename RootNodeT , typename VisitorOp , typename ChildAllIterT >
void doVisit (RootNodeT &self, VisitorOp &op)
 
template<typename RootNodeT , typename OtherRootNodeT , typename VisitorOp , typename ChildAllIterT , typename OtherChildAllIterT >
void doVisit2 (RootNodeT &self, OtherRootNodeT &other, VisitorOp &op)
 
bool isBackgroundTile (const MapIter &) const
 Return true if the given iterator points to an inactive tile with the background value. More...
 
bool isBackgroundTile (const MapCIter &) const
 Return true if the given iterator points to an inactive tile with the background value. More...
 

Static Public Member Functions

static CoordBBox getNodeBoundingBox ()
 Return the bounding box of this RootNode, i.e., an infinite bounding box. More...
 
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. More...
 
template<typename NodeT >
static bool hasNodeType ()
 Return true if the specified node type is part of this tree configuration. More...
 

Static Public Attributes

static const Index LEVEL = 1 + ChildType::LEVEL
 

Friends

template<typename >
class RootNode
 

Member Typedef Documentation

typedef DenseIter<const RootNode, MapCIter, const ChildType, const ValueType> ChildAllCIter
typedef DenseIter<RootNode, MapIter, ChildType, ValueType> ChildAllIter
typedef ChildType ChildNodeType
typedef ValueIter<const RootNode, MapCIter, ChildOffPred, ValueType> ChildOffCIter
typedef ValueIter<RootNode, MapIter, ChildOffPred, const ValueType> ChildOffIter
typedef ChildIter<const RootNode, MapCIter, ChildOnPred, const ChildType> ChildOnCIter
typedef ChildIter<RootNode, MapIter, ChildOnPred, ChildType> ChildOnIter
typedef ChildType::LeafNodeType LeafNodeType
typedef ValueIter<const RootNode, MapCIter, ValueAllPred, const ValueType> ValueAllCIter
typedef ValueIter<RootNode, MapIter, ValueAllPred, ValueType> ValueAllIter
typedef ValueIter<const RootNode, MapCIter, ValueOffPred, const ValueType> ValueOffCIter
typedef ValueIter<RootNode, MapIter, ValueOffPred, ValueType> ValueOffIter
typedef ValueIter<const RootNode, MapCIter, ValueOnPred, const ValueType> ValueOnCIter
typedef ValueIter<RootNode, MapIter, ValueOnPred, ValueType> ValueOnIter
typedef ChildType::ValueType ValueType

Constructor & Destructor Documentation

RootNode ( )
inline

Construct a new tree with a background value of 0.

RootNode ( const ValueType background)
inlineexplicit

Construct a new tree with the given background value.

RootNode ( const RootNode< ChildType > &  other)
inline
RootNode ( const RootNode< OtherChildType > &  other,
const ValueType background,
const ValueType foreground,
TopologyCopy   
)
inline

Topology copy constructor that guarantees the configuration of the constructed tree is topologically identical to the other tree.

Reproduce the topology and active states of the other tree (which may have a different ValueType), but don't copy values. All values that are active in the other tree are set to the foreground value and all other values to the background value.

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
RootNode ( const RootNode< OtherChildType > &  other,
const ValueType background,
TopologyCopy   
)
inline

Topology copy constructor that guarantees the configuration of the constructed tree is topologically identical to the other tree.

Note
this copy constructor is generally faster then the one above that takes both a forground and a background value. Its main application is multithreading where the topology of the output tree exactly matches the input tree.

Reproduce the topology and active states of the other node (which may have a different ValueType), but don't copy values. All values in the constructed tree are set to the background value regardless of their active states.

Parameters
otherthe root node of a tree having (possibly) a different ValueType
backgroundthe value to which inactive tiles and voxels are initialized
~RootNode ( )
inline

Member Function Documentation

void addLeaf ( LeafNodeType leaf)
inline

Add the specified leaf to this node, possibly creating a child branch in the process. If the leaf node already exists, replace it.

void addLeafAndCache ( LeafNodeType leaf,
AccessorT &  acc 
)
inline

Same as addLeaf except, if necessary, it update the accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.

void addTile ( Index  level,
const Coord xyz,
const ValueType value,
bool  state 
)
inline

Add a tile at the specified tree level that contains voxel (x, y, z), possibly creating a parent branch or deleting a child branch in the process.

void addTileAndCache ( Index  level,
const Coord xyz,
const ValueType value,
bool  state,
AccessorT &  acc 
)
inline

Same as addTile() except, if necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing (x, y, z).

const ValueType& background ( ) const
inline

Return the background value.

ChildAllCIter beginChildAll ( ) const
inline
ChildAllIter beginChildAll ( )
inline
ChildOffCIter beginChildOff ( ) const
inline
ChildOffIter beginChildOff ( )
inline
ChildOnCIter beginChildOn ( ) const
inline
ChildOnIter beginChildOn ( )
inline
ValueAllCIter beginValueAll ( ) const
inline
ValueAllIter beginValueAll ( )
inline
ValueOffCIter beginValueOff ( ) const
inline
ValueOffIter beginValueOff ( )
inline
ValueOnCIter beginValueOn ( ) const
inline
ValueOnIter beginValueOn ( )
inline
ChildAllCIter cbeginChildAll ( ) const
inline
ChildOffCIter cbeginChildOff ( ) const
inline
ChildOnCIter cbeginChildOn ( ) const
inline
ValueAllCIter cbeginValueAll ( ) const
inline
ValueOffCIter cbeginValueOff ( ) const
inline
ValueOnCIter cbeginValueOn ( ) const
inline
void clear ( )
inline
void combine ( RootNode< ChildType > &  other,
CombineOp &  op,
bool  prune = false 
)
inline
void combine2 ( const RootNode< ChildType > &  other0,
const RootNode< ChildType > &  other1,
CombineOp &  op,
bool  prune = false 
)
inline
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)
void doVisit ( RootNodeT &  self,
VisitorOp &  op 
)
inline
void doVisit2 ( RootNodeT &  self,
OtherRootNodeT &  other,
VisitorOp &  op 
)
inline
bool empty ( ) const
inline

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

void enforceSameConfiguration ( const RootNode< OtherChildType > &  )
inline
size_t eraseBackgroundTiles ( )
inline

Remove all background tiles.

Returns
the number of tiles removed.
void evalActiveVoxelBoundingBox ( CoordBBox bbox) 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.

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).
void fill ( const CoordBBox bbox,
const ValueType value,
bool  active = true 
)
inline

Set all voxels within a given box to a constant value, if necessary subdividing tiles that intersect the box.

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
OPENVDB_DEPRECATED ValueType getBackground ( ) const
inline
static Index getChildDim ( )
inlinestatic
Index getDepth ( ) const
inline
Index getHeight ( ) const
inline
void getIndexRange ( CoordBBox bbox) const
inline

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

static Index getLevel ( )
inlinestatic
Coord getMaxIndex ( ) const
inline

Return the largest index of the current tree.

Coord getMinIndex ( ) const
inline

Return the smallest index of the current tree.

static CoordBBox getNodeBoundingBox ( )
inlinestatic

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

void getNodeLog2Dims ( std::vector< Index > &  dims)
inlinestatic
Index getTableSize ( ) const
inline

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

const ChildT::ValueType & getValue ( const Coord xyz) const
inline
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.
const ChildT::ValueType& getValueAndCache ( const Coord xyz,
AccessorT &  acc 
) const
inline
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.

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.
Index getWidth ( ) const
inline
bool hasActiveTiles ( ) const
inline
static bool hasNodeType ( )
static

Return true if the specified node type is part of this tree configuration.

bool hasNodeType ( )
inline
static bool hasSameConfiguration ( const RootNode< OtherChildType > &  other)
static

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

bool hasSameConfiguration ( const RootNode< OtherChildType > &  )
inline
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).

bool isBackgroundTile ( const Tile &  tile) const
inline

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

bool isBackgroundTile ( const MapIter &  iter) const
inline

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

bool isBackgroundTile ( const MapCIter &  iter) const
inline

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

bool isValueOn ( const Coord xyz) const
inline
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.
Index32 leafCount ( ) const
inline
Index64 memUsage ( ) const
inline

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

void merge ( RootNode< ChildType > &  other)
inline

Move child nodes from the other tree into this tree wherever those nodes correspond to constant-value tiles in this tree, and replace leaf-level inactive voxels in this tree with corresponding voxels in the other tree that are active.

Note
This operation always empties the other tree, whether or not any nodes were moved.
Index32 nonLeafCount ( ) const
inline
size_t numBackgroundTiles ( ) const
inline

Return the number of background tiles.

Index64 offLeafVoxelCount ( ) const
inline
Index64 offVoxelCount ( ) const
inline
Index64 onLeafVoxelCount ( ) const
inline
Index64 onVoxelCount ( ) const
inline
RootNode< ChildT > & operator= ( const RootNode< ChildType > &  other)
inline
const LeafNodeType* probeConstLeaf ( const Coord xyz) const
inline

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

const LeafNodeType* probeConstLeafAndCache ( const Coord xyz,
AccessorT &  acc 
) const
inline

Same as probeConstLeaf except, if necessary, it update the accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.

const NodeT * probeConstNode ( const Coord xyz) const
inline
const NodeT * probeConstNodeAndCache ( const Coord xyz,
AccessorT &  acc 
) const
inline

Same as probeConstNode except, if necessary, it update the accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.

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 NULL.

const LeafNodeType* probeLeaf ( const Coord xyz) const
inline

Same as probeConstLeaf.

LeafNodeType* probeLeafAndCache ( const Coord xyz,
AccessorT &  acc 
)
inline

Same as probeLeaf except, if necessary, it update the accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.

const LeafNodeType* probeLeafAndCache ( const Coord xyz,
AccessorT &  acc 
) const
inline

Same as probeConstLeafAndCache.

NodeT * probeNode ( const Coord xyz)
inline

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

NodeT * probeNodeAndCache ( const Coord xyz,
AccessorT &  acc 
)
inline

Same as probeNode except, if necessary, it update the accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.

bool probeValue ( const Coord xyz,
ValueType value 
) const
inline
bool probeValueAndCache ( const Coord xyz,
ValueType value,
AccessorT &  acc 
) const
inline

Return true if the voxel at the given coordinates is active, assigns the voxel value, 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.
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.

void pruneInactive ( const ValueType bg)
inline

Reduce the memory footprint of this tree by replacing with tiles of the given value any nodes whose values are all inactive.

void pruneInactive ( )
inline

Reduce the memory footprint of this tree by replacing with background tiles any nodes whose values are all inactive.

void pruneOp ( PruneOp &  op)
inline

Call the PruneOp functor for each child node and, if the functor returns true, prune the node and replace it with a tile.

This method is used to implement all of the various pruning algorithms (prune(), pruneInactive(), etc.). It should rarely be called directly.

See Also
openvdb/tree/Util.h for the definition of the PruneOp functor
void pruneTiles ( const ValueType tolerance)
inline
void readBuffers ( std::istream &  is,
bool  fromHalf = false 
)
inline
bool readTopology ( std::istream &  is,
bool  fromHalf = false 
)
inline
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.

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.
void setBackground ( const ValueType value)
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.

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.
void setValueOff ( const Coord xyz)
inline

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

void setValueOff ( const Coord xyz,
const ValueType value 
)
inline

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

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.
void setValueOn ( const Coord xyz,
const ValueType value 
)
inline
void setValueOnly ( const Coord xyz,
const ValueType value 
)
inline
void setValueOnlyAndCache ( const Coord xyz,
const ValueType value,
AccessorT &  acc 
)
inline

Set the value of the voxel at the given coordinate but preserves 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.
void setValueOnMax ( const Coord xyz,
const ValueType value 
)
inline
void setValueOnMin ( const Coord xyz,
const ValueType value 
)
inline
void setValueOnSum ( const Coord xyz,
const ValueType value 
)
inline
void setValueOnSumAndCache ( const Coord xyz,
const ValueType value,
AccessorT &  acc 
)
inline

Set the value of the voxel at the given coordinates to the sum of its current value and the given value, 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.
void signedFloodFill ( )
inline

Set the values of all inactive voxels and tiles of a narrow-band level set from the signs of the active voxels, setting outside values to +background and inside values to -background.

Note
This method should only be used on closed, narrow-band level sets!
void signedFloodFill ( const ValueType outside,
const ValueType inside 
)
inline

Set the values of all inactive voxels and tiles of a narrow-band level set from the signs of the active voxels, setting exterior values to outside and interior values to inside. Set the background value of this tree to outside.

Note
This method should only be used on closed, narrow-band level sets!
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 NULL.

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.
void topologyUnion ( const RootNode< OtherChildType > &  other)
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.
ChildT::LeafNodeType * touchLeaf ( const Coord xyz)
inline

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

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

LeafNodeType* touchLeafAndCache ( const Coord xyz,
AccessorT &  acc 
)

Same as touchLeaf except, if necessary, it update the accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.

ChildT::LeafNodeType* touchLeafAndCache ( const Coord xyz,
AccessorT &  acc 
)
inline
void visit ( VisitorOp &  op)
inline
void visit ( VisitorOp &  op) const
inline
void visit2 ( OtherRootNodeType &  other,
VisitorOp &  op 
)
inline
void visit2 ( OtherRootNodeType &  other,
VisitorOp &  op 
) const
inline
void visitActiveBBox ( BBoxOp &  op) const
inline

Calls the templated functor BBoxOp with bounding box information for all active tiles and leaf nodes in the tree. An additional level argument is provided for each callback.

Note
The bounding boxes are guarenteed to be non-overlapping.
void voxelizeActiveTiles ( )
inline

Turn active tiles into dense voxels, i.e., into leaf nodes that are entirely active.

void writeBuffers ( std::ostream &  os,
bool  toHalf = false 
) const
inline
bool writeTopology ( std::ostream &  os,
bool  toHalf = false 
) const
inline

Friends And Related Function Documentation

friend class RootNode
friend

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

Member Data Documentation

const Index LEVEL = 1 + ChildType::LEVEL
static

The documentation for this class was generated from the following file: