OpenVDB 12.0.0
 
Loading...
Searching...
No Matches
InternalNode< _ChildNodeType, Log2Dim >::TopologyCopy2< OtherInternalNode > Struct Template Reference

#include <openvdb/tree/InternalNode.h>

Public Types

using ChildNodeType
 
using LeafNodeType
 
using ValueType
 
using BuildType
 
using UnionType
 
using NodeMaskType
 
using ChildOnIter
 
using ChildOnCIter
 
using ChildOffIter
 
using ChildOffCIter
 
using ChildAllIter
 
using ChildAllCIter
 
using ValueOnIter
 
using ValueOnCIter
 
using ValueOffIter
 
using ValueOffCIter
 
using ValueAllIter
 
using ValueAllCIter
 

Public Member Functions

 TopologyCopy2 (const OtherInternalNode *source, InternalNode *target, const ValueType &offValue, const ValueType &onValue)
 
void operator() (const tbb::blocked_range< Index > &r) const
 
NodeT * probeNode (const Coord &xyz)
 
NodeT * probeNodeAndCache (const Coord &xyz, AccessorT &acc)
 
const NodeT * probeConstNode (const Coord &xyz) const
 
const NodeT * probeConstNodeAndCache (const Coord &xyz, AccessorT &acc) const
 
ChildT::LeafNodeType * probeLeafAndCache (const Coord &xyz, AccessorT &acc)
 
const ChildT::LeafNodeType * probeLeafAndCache (const Coord &xyz, AccessorT &acc) const
 
const ChildT::LeafNodeType * probeConstLeafAndCache (const Coord &xyz, AccessorT &acc) const
 
ChildT::LeafNodeType * touchLeafAndCache (const Coord &xyz, AccessorT &acc)
 
const ChildT::ValueType & getValueAndCache (const Coord &xyz, AccessorT &acc) const
 
void topologyUnion (const InternalNode< OtherChildT, Log2Dim > &other, const bool preserveTiles)
 
void topologyIntersection (const InternalNode< OtherChildT, Log2Dim > &other, const ValueType &background)
 
void topologyDifference (const InternalNode< OtherChildT, Log2Dim > &other, const ValueType &background)
 
 InternalNode ()
 Default constructor.
 
 InternalNode (const ValueType &offValue)
 Constructor of an InternalNode with dense inactive tiles of the specified value.
 
 InternalNode (const Coord &origin, const ValueType &fillValue, bool active=false)
 Constructs an InternalNode with dense tiles.
 
 InternalNode (PartialCreate, const Coord &, const ValueType &fillValue, bool active=false)
 
 InternalNode (const InternalNode &)
 Deep copy constructor.
 
 InternalNode (const InternalNode< OtherChildNodeType, Log2Dim > &other)
 Value conversion copy constructor.
 
 InternalNode (const InternalNode< OtherChildNodeType, Log2Dim > &other, const ValueType &background, TopologyCopy)
 Topology copy constructor.
 
 InternalNode (const InternalNode< OtherChildNodeType, Log2Dim > &other, const ValueType &offValue, const ValueType &onValue, TopologyCopy)
 Topology copy constructor.
 
 ~InternalNode ()
 
ChildOnCIter cbeginChildOn () const
 
ChildOffCIter cbeginChildOff () const
 
ChildAllCIter cbeginChildAll () const
 
ChildOnCIter beginChildOn () const
 
ChildOnIter beginChildOn ()
 
ChildOffCIter beginChildOff () const
 
ChildOffIter beginChildOff ()
 
ChildAllCIter beginChildAll () const
 
ChildAllIter beginChildAll ()
 
ValueOnCIter cbeginValueOn () const
 
ValueOffCIter cbeginValueOff () const
 
ValueAllCIter cbeginValueAll () const
 
ValueOnCIter beginValueOn () const
 
ValueOnIter beginValueOn ()
 
ValueOffCIter beginValueOff () const
 
ValueOffIter beginValueOff ()
 
ValueAllCIter beginValueAll () const
 
ValueAllIter beginValueAll ()
 
Coord offsetToGlobalCoord (Index n) const
 Return the global coordinates for a linear table offset.
 
const Coordorigin () const
 Return the grid index coordinates of this node's local origin.
 
void setOrigin (const Coord &origin)
 Set the grid index coordinates of this node's local origin.
 
Index32 transientData () const
 Return the transient data value.
 
void setTransientData (Index32 transientData)
 Set the transient data value.
 
Index64 leafCount () const
 
Index64 nonLeafCount () const
 
void nodeCount (std::vector< Index64 > &vec) const
 
void nodeCount (std::vector< Index32 > &vec) const
 
Index32 childCount () const
 
Index64 onVoxelCount () const
 
Index64 offVoxelCount () const
 
Index64 onLeafVoxelCount () const
 
Index64 offLeafVoxelCount () const
 
Index64 onTileCount () const
 
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 bounding box so that it includes the active tiles of this internal 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.
 
CoordBBox getNodeBoundingBox () const
 Return the bounding box of this node, i.e., the full index space spanned by the node regardless of its content.
 
bool isEmpty () const
 
bool isConstant (ValueType &firstValue, bool &state, const ValueType &tolerance=zeroVal< ValueType >()) const
 
bool isConstant (ValueType &minValue, ValueType &maxValue, bool &state, const ValueType &tolerance=zeroVal< ValueType >()) const
 
bool isInactive () const
 Return true if this node has no children and only contains inactive values.
 
bool isValueOn (const Coord &xyz) const
 Return true if the voxel at the given coordinates is active.
 
bool isValueOn (Index offset) const
 Return true if the voxel at the given offset is active.
 
bool isValueOff (const Coord &xyz) const
 Return true if the voxel at the given coordinates is inactive.
 
bool isValueOff (Index offset) const
 Return true if the voxel at the given offset is inactive.
 
bool hasActiveTiles () const
 Return true if this node or any of its child nodes have any active tiles.
 
const ValueTypegetValue (const Coord &xyz) const
 
bool probeValue (const Coord &xyz, ValueType &value) const
 
Index getValueLevel (const Coord &xyz) const
 Return the level of the tree (0 = leaf) at which the value at the given coordinates resides.
 
const ValueTypegetFirstValue () const
 If the first entry in this node's table is a tile, return the tile's value. Otherwise, return the result of calling getFirstValue() on the child.
 
const ValueTypegetLastValue () const
 If the last entry in this node's table is a tile, return the tile's value. Otherwise, return the result of calling getLastValue() on the child.
 
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)
 Mark the voxel at the given coordinates as active but don't change its value.
 
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.
 
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.
 
void modifyValueAndActiveState (const Coord &xyz, const ModifyOp &op)
 Apply a functor to the voxel at the given coordinates.
 
const ValueTypegetValueAndCache (const Coord &xyz, AccessorT &) const
 
const ChildT::ValueType & getValueAndCache (const Coord &xyz, AccessorT &acc) const
 
bool isValueOnAndCache (const Coord &xyz, AccessorT &) const
 
void setValueAndCache (const Coord &xyz, const ValueType &value, AccessorT &)
 
void setValueOnlyAndCache (const Coord &xyz, const ValueType &value, AccessorT &)
 
void modifyValueAndCache (const Coord &xyz, const ModifyOp &op, AccessorT &)
 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.
 
void modifyValueAndActiveStateAndCache (const Coord &xyz, const ModifyOp &op, AccessorT &)
 
void setValueOffAndCache (const Coord &xyz, const ValueType &value, AccessorT &)
 
void setActiveStateAndCache (const Coord &xyz, bool on, AccessorT &)
 
bool probeValueAndCache (const Coord &xyz, ValueType &value, AccessorT &) const
 
Index getValueLevelAndCache (const Coord &xyz, AccessorT &) const
 Return the level of the tree (0 = leaf) at which the value at the given coordinates resides.
 
void setValuesOn ()
 Mark all values (both tiles and voxels) as active.
 
void writeTopology (std::ostream &, bool toHalf=false) const
 
void 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)
 
const ValueTypegetValueUnsafe (Index offset) const
 Return the tile value at offset.
 
bool getValueUnsafe (Index offset, ValueType &value) const
 Return the tile value and active state at offset.
 
ChildNodeTypegetChildUnsafe (Index offset)
 Return the child node at offset.
 
const ChildNodeTypegetChildUnsafe (Index offset) const
 Return the child node at offset.
 
const ChildNodeTypegetConstChildUnsafe (Index offset) const
 Return the child node at offset.
 
void setActiveStateUnsafe (Index offset, bool on)
 Set the tile active state at offset but don't change its value.
 
void setValueOnlyUnsafe (Index offset, const ValueType &value)
 Set the tile value at offset but don't change its value.
 
void setValueOnUnsafe (Index offset)
 Mark the tile active at offset but don't change its value.
 
void setValueOnUnsafe (Index offset, const ValueType &value)
 Set the tile value at offset and mark the voxel as active.
 
void setValueOffUnsafe (Index offset)
 Mark the tile inactive at offset but don't change its value.
 
void setValueOffUnsafe (Index offset, const ValueType &value)
 Set the tile value at offset and mark the voxel as inactive.
 
void setChildUnsafe (Index offset, ChildNodeType *child)
 Replace a tile at offset with the given child node.
 
void resetChildUnsafe (Index offset, ChildNodeType *child)
 Replace a child node at offset with the given child node.
 
ChildNodeTypestealChildUnsafe (Index offset, const ValueType &value, bool active)
 Replace a child node at offset with the given value and active state.
 
void deleteChildUnsafe (Index offset, const ValueType &value, bool active)
 Delete a child node at offset and replace with the given value and active state.
 
void negate ()
 Change the sign of all the values represented in this node and its child nodes.
 
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 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.
 
void copyToDense (const CoordBBox &bbox, DenseT &dense) const
 Copy into a dense grid the values of the voxels that lie within a given bounding box.
 
void merge (InternalNode &other, const ValueType &background, const ValueType &otherBackground)
 Efficiently merge another tree into this tree using one of several schemes.
 
void merge (const ValueType &tileValue, bool tileActive)
 Merge, using one of several schemes, this node (and its descendants) with a tile of the same dimensions and the given value and active state.
 
void topologyUnion (const InternalNode< OtherChildNodeType, Log2Dim > &other, const bool preserveTiles=false)
 Union this branch's set of active values with the other branch's active values. The value type of the other branch can be different.
 
void topologyUnion (const InternalNode< OtherChildT, Log2Dim > &other, const bool preserveTiles)
 
void topologyIntersection (const InternalNode< OtherChildNodeType, Log2Dim > &other, const ValueType &background)
 Intersects this tree's set of active values with the active values of the other tree, whose ValueType may be different.
 
void topologyIntersection (const InternalNode< OtherChildT, Log2Dim > &other, const ValueType &background)
 
void topologyDifference (const InternalNode< OtherChildNodeType, Log2Dim > &other, const ValueType &background)
 Difference this node's set of active values with the active values of the other node, whose ValueType may be different. So a resulting voxel will be active only if the original voxel is active in this node and inactive in the other node.
 
void topologyDifference (const InternalNode< OtherChildT, Log2Dim > &other, const ValueType &background)
 
void combine (InternalNode &other, CombineOp &)
 
void combine (const ValueType &value, bool valueIsActive, CombineOp &)
 
void combine2 (const InternalNode &other0, const OtherNodeType &other1, CombineOp &)
 
void combine2 (const ValueType &value, const OtherNodeType &other, bool valIsActive, CombineOp &)
 
void combine2 (const InternalNode &other, const OtherValueType &, bool valIsActive, CombineOp &)
 
void clip (const CoordBBox &, const ValueType &background)
 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 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 &)
 Same as addLeaf() except, if necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.
 
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 (ChildNodeType *child)
 Add the given child node at this level deducing the offset from it's origin. If a child node with this offset 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 InternalNode)
 
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.
 
void addTile (Index offset, const ValueType &value, bool state)
 Delete any existing child branch at the specified offset and add a tile.
 
void addTileAndCache (Index level, const Coord &xyz, const ValueType &, 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).
 
NodeType * probeNode (const Coord &xyz)
 Return a pointer to the node that contains voxel (x, y, z). If no such node exists, return nullptr.
 
const NodeType * probeNode (const Coord &xyz) const
 
NodeT * probeNode (const Coord &xyz)
 
const NodeType * probeConstNode (const Coord &xyz) const
 
const NodeT * probeConstNode (const Coord &xyz) const
 
ChildNodeTypeprobeChild (const Coord &xyz)
 Return a pointer to the child node that contains voxel (x, y, z). If no such node exists, return nullptr.
 
const ChildNodeTypeprobeChild (const Coord &xyz) const
 
ChildNodeTypeprobeChild (const Coord &xyz, ValueType &value, bool &active)
 Return a pointer to the child node that contains voxel (x, y, z). If no such node exists, return nullptr.
 
const ChildNodeTypeprobeChild (const Coord &xyz, ValueType &value, bool &active) const
 
const ChildNodeTypeprobeConstChild (const Coord &xyz) const
 
const ChildNodeTypeprobeConstChild (const Coord &xyz, ValueType &value, bool &active) const
 
ChildNodeTypeprobeChildUnsafe (Index offset)
 Return a pointer to the child node for a specific offset. If no such node exists, return nullptr.
 
const ChildNodeTypeprobeChildUnsafe (Index offset) const
 
ChildNodeTypeprobeChildUnsafe (Index offset, ValueType &value, bool &active)
 Return a pointer to the child node for a specific offset. If no such node exists, return nullptr.
 
const ChildNodeTypeprobeChildUnsafe (Index offset, ValueType &value, bool &active) const
 
const ChildNodeTypeprobeConstChildUnsafe (Index offset) const
 
const ChildNodeTypeprobeConstChildUnsafe (Index offset, ValueType &value, bool &active) const
 
NodeType * probeNodeAndCache (const Coord &xyz, AccessorT &)
 Same as probeNode() 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).
 
NodeT * probeNodeAndCache (const Coord &xyz, AccessorT &acc)
 
const NodeType * probeConstNodeAndCache (const Coord &xyz, AccessorT &) const
 
const NodeT * probeConstNodeAndCache (const Coord &xyz, AccessorT &acc) 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 LeafNodeTypeprobeLeaf (const Coord &xyz) const
 
const LeafNodeTypeprobeConstLeaf (const Coord &xyz) const
 
LeafNodeTypeprobeLeafAndCache (const Coord &xyz, AccessorT &acc)
 Same as probeLeaf() 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 LeafNodeTypeprobeLeafAndCache (const Coord &xyz, AccessorT &acc) const
 
ChildT::LeafNodeType * probeLeafAndCache (const Coord &xyz, AccessorT &acc)
 
const ChildT::LeafNodeType * probeLeafAndCache (const Coord &xyz, AccessorT &acc) const
 
const LeafNodeTypeprobeConstLeafAndCache (const Coord &xyz, AccessorT &acc) const
 
const ChildT::LeafNodeType * probeConstLeafAndCache (const Coord &xyz, AccessorT &acc) const
 
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.
 
LeafNodeTypetouchLeafAndCache (const Coord &xyz, AccessorT &)
 Same as touchLeaf() except, if necessary, 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)
 
void getNodes (ArrayT &array)
 Adds all nodes of a certain type to a container with the following API:
 
void getNodes (ArrayT &array) const
 
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:
 
void resetBackground (const ValueType &oldBackground, const ValueType &newBackground)
 Change inactive tiles or voxels with value oldBackground to newBackground or -oldBackground to -newBackground. Active values are unchanged.
 
bool hasSameTopology (const InternalNode< OtherChildNodeType, OtherLog2Dim > *other) const
 Return true if the given tree branch has the same node and active value topology as this tree branch (but possibly a different ValueType).
 
bool isValueMaskOn (Index n) const
 
bool isValueMaskOn () const
 
bool isValueMaskOff (Index n) const
 
bool isValueMaskOff () const
 
bool isChildMaskOn (Index n) const
 
bool isChildMaskOff (Index n) const
 
bool isChildMaskOff () const
 
const NodeMaskTypegetValueMask () const
 
const NodeMaskTypegetChildMask () const
 
NodeMaskType getValueOffMask () const
 
const UnionTypegetTable () const
 

Static Public Member Functions

static Index dim ()
 
static Index getLevel ()
 
static void getNodeLog2Dims (std::vector< Index > &dims)
 Populated an std::vector with the dimension of all the nodes in the branch starting with this node.
 
static Index getChildDim ()
 
static Index coordToOffset (const Coord &xyz)
 Return the linear table offset of the given global or local coordinates.
 
static void offsetToLocalCoord (Index n, Coord &xyz)
 Return the local coordinates for a linear table offset, where offset 0 has coordinates (0, 0, 0).
 

Public Attributes

const OtherInternalNode * s
 
InternalNodet
 
const ValueTypeoffV
 
const ValueTypeonV
 

Static Public Attributes

static const Index LOG2DIM
 
static const Index TOTAL
 
static const Index DIM
 
static const Index NUM_VALUES
 
static const Index LEVEL
 
static const Index64 NUM_VOXELS
 

Protected Types

using MaskOnIterator
 
using MaskOffIterator
 
using MaskDenseIterator
 

Protected Member Functions

void setValueMask (Index n, bool on)
 
void makeChildNodeEmpty (Index n, const ValueType &value)
 
void setChildNode (Index i, ChildNodeType *child)
 
void resetChildNode (Index i, ChildNodeType *child)
 
ChildNodeTypeunsetChildNode (Index i, const ValueType &value)
 
ChildNodeTypegetChildNode (Index n)
 Returns a pointer to the child node at the linear offset n.
 
const ChildNodeTypegetChildNode (Index n) const
 Returns a pointer to the child node at the linear offset n.
 

Protected Attributes

UnionType mNodes [NUM_VALUES]
 
NodeMaskType mChildMask
 
NodeMaskType mValueMask
 
Coord mOrigin
 Global grid index coordinates (x,y,z) of the local origin of this node.
 
Index32 mTransientData
 Transient data (not serialized)
 

Friends

class IteratorBase< MaskOnIterator, InternalNode >
 
class IteratorBase< MaskOffIterator, InternalNode >
 
class IteratorBase< MaskDenseIterator, InternalNode >
 
class InternalNode
 During topology-only construction, access is needed to protected/private members of other template instances.
 

Member Typedef Documentation

◆ BuildType

using BuildType

◆ ChildAllCIter

◆ ChildAllIter

using ChildAllIter

◆ ChildNodeType

◆ ChildOffCIter

◆ ChildOffIter

using ChildOffIter

◆ ChildOnCIter

using ChildOnCIter

◆ ChildOnIter

using ChildOnIter

◆ LeafNodeType

using LeafNodeType

◆ MaskDenseIterator

using MaskDenseIterator
protected

◆ MaskOffIterator

using MaskOffIterator
protected

◆ MaskOnIterator

using MaskOnIterator
protected

◆ NodeMaskType

using NodeMaskType

◆ UnionType

using UnionType

◆ ValueAllCIter

◆ ValueAllIter

using ValueAllIter

◆ ValueOffCIter

◆ ValueOffIter

using ValueOffIter

◆ ValueOnCIter

using ValueOnCIter

◆ ValueOnIter

using ValueOnIter

◆ ValueType

using ValueType

Constructor & Destructor Documentation

◆ TopologyCopy2()

template<typename _ChildNodeType, Index Log2Dim>
template<typename OtherInternalNode>
TopologyCopy2 ( const OtherInternalNode * source,
InternalNode * target,
const ValueType & offValue,
const ValueType & onValue )
inline

◆ ~InternalNode()

~InternalNode ( )
inline

Member Function Documentation

◆ addChild()

bool addChild ( ChildNodeType * child)
inline

Add the given child node at this level deducing the offset from it's origin. If a child node with this offset 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 InternalNode)

Returns
true if inserting the child has been successful, otherwise the caller retains ownership of the node and is responsible for deleting it.

◆ addLeaf()

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.

◆ addLeafAndCache()

void addLeafAndCache ( LeafNodeType * leaf,
AccessorT & acc )
inline

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

◆ addTile() [1/2]

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.

◆ addTile() [2/2]

void addTile ( Index offset,
const ValueType & value,
bool state )
inline

Delete any existing child branch at the specified offset and add a tile.

◆ addTileAndCache()

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

◆ beginChildAll() [1/2]

ChildAllIter beginChildAll ( )
inline

◆ beginChildAll() [2/2]

ChildAllCIter beginChildAll ( ) const
inline

◆ beginChildOff() [1/2]

ChildOffIter beginChildOff ( )
inline

◆ beginChildOff() [2/2]

ChildOffCIter beginChildOff ( ) const
inline

◆ beginChildOn() [1/2]

ChildOnIter beginChildOn ( )
inline

◆ beginChildOn() [2/2]

ChildOnCIter beginChildOn ( ) const
inline

◆ beginValueAll() [1/2]

ValueAllIter beginValueAll ( )
inline

◆ beginValueAll() [2/2]

ValueAllCIter beginValueAll ( ) const
inline

◆ beginValueOff() [1/2]

ValueOffIter beginValueOff ( )
inline
Warning
This iterator will also visit child nodes so use isChildMaskOn to skip them!

◆ beginValueOff() [2/2]

ValueOffCIter beginValueOff ( ) const
inline
Warning
This iterator will also visit child nodes so use isChildMaskOn to skip them!

◆ beginValueOn() [1/2]

ValueOnIter beginValueOn ( )
inline

◆ beginValueOn() [2/2]

ValueOnCIter beginValueOn ( ) const
inline

◆ cbeginChildAll()

ChildAllCIter cbeginChildAll ( ) const
inline

◆ cbeginChildOff()

ChildOffCIter cbeginChildOff ( ) const
inline

◆ cbeginChildOn()

ChildOnCIter cbeginChildOn ( ) const
inline

◆ cbeginValueAll()

ValueAllCIter cbeginValueAll ( ) const
inline

◆ cbeginValueOff()

ValueOffCIter cbeginValueOff ( ) const
inline
Warning
This iterator will also visit child nodes so use isChildMaskOn to skip them!

◆ cbeginValueOn()

ValueOnCIter cbeginValueOn ( ) const
inline

◆ childCount()

Index32 childCount ( ) const
inline

◆ clip()

void clip ( const CoordBBox & clipBBox,
const ValueType & background )
inline

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

◆ combine() [1/2]

void combine ( const ValueType & value,
bool valueIsActive,
CombineOp & op )
inline

◆ combine() [2/2]

void combine ( InternalNode & other,
CombineOp & op )
inline

◆ combine2() [1/3]

void combine2 ( const InternalNode & other,
const OtherValueType & value,
bool valIsActive,
CombineOp & op )
inline

◆ combine2() [2/3]

void combine2 ( const InternalNode & other0,
const OtherNodeType & other1,
CombineOp & op )
inline

◆ combine2() [3/3]

void combine2 ( const ValueType & value,
const OtherNodeType & other,
bool valIsActive,
CombineOp & op )
inline

◆ coordToOffset()

Index coordToOffset ( const Coord & xyz)
inlinestatic

Return the linear table offset of the given global or local coordinates.

◆ copyToDense()

void copyToDense ( const CoordBBox & bbox,
DenseT & dense ) const
inline

Copy into a dense grid the values of the voxels that lie within 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)
Note
bbox is assumed to be identical to or contained in the coordinate domains of both the dense grid and this node, i.e., no bounds checking is performed.

◆ deleteChildUnsafe()

void deleteChildUnsafe ( Index offset,
const ValueType & value,
bool active )
inline

Delete a child node at offset and replace with the given value and active state.

Note
Use addTile(Index, const ValueType&, bool) for a safer alternative.
Warning
This method should only be used by experts seeking low-level optimizations.

◆ denseFill()

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()

◆ dim()

static Index dim ( )
inlinestatic
Returns
The dimension of this InternalNode

The number of voxels in one coordinate direction covered by this node

◆ evalActiveBoundingBox()

void evalActiveBoundingBox ( CoordBBox & bbox,
bool visitVoxels = true ) const
inline

Expand the specified bounding box so that it includes the active tiles of this internal 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.

◆ fill()

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()

static Index getChildDim ( )
inlinestatic
Returns
The dimension of the child nodes of this node.

The number of voxels in one coordinate direction covered by a child node of this node.

◆ getChildMask()

const NodeMaskType & getChildMask ( ) const
inline

◆ getChildNode() [1/2]

ChildT * getChildNode ( Index n)
inlineprotected

Returns a pointer to the child node at the linear offset n.

Warning
This protected method assumes that a child node exists at the specified linear offset!

◆ getChildNode() [2/2]

const ChildT * getChildNode ( Index n) const
inlineprotected

Returns a pointer to the child node at the linear offset n.

Warning
This protected method assumes that a child node exists at the specified linear offset!

◆ getChildUnsafe() [1/2]

ChildT * getChildUnsafe ( Index offset)
inline

Return the child node at offset.

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

◆ getChildUnsafe() [2/2]

const ChildT * getChildUnsafe ( Index offset) const
inline

Return the child node at offset.

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

◆ getConstChildUnsafe()

const ChildT * getConstChildUnsafe ( Index offset) const
inline

Return the child node at offset.

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

◆ getFirstValue()

const ChildT::ValueType & getFirstValue ( ) const
inline

If the first entry in this node's table is a tile, return the tile's value. Otherwise, return the result of calling getFirstValue() on the child.

◆ getLastValue()

const ChildT::ValueType & getLastValue ( ) const
inline

If the last entry in this node's table is a tile, return the tile's value. Otherwise, return the result of calling getLastValue() on the child.

◆ getLevel()

static Index getLevel ( )
inlinestatic
Returns
The level of this node

Level 0 is by definition the level of the leaf nodes

◆ getNodeBoundingBox()

CoordBBox getNodeBoundingBox ( ) const
inline

Return the bounding box of this node, i.e., the full index space spanned by the node regardless of its content.

◆ getNodeLog2Dims()

void getNodeLog2Dims ( std::vector< Index > & dims)
static

Populated an std::vector with the dimension of all the nodes in the branch starting with this node.

◆ getNodes() [1/2]

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]

void getNodes ( ArrayT & array) const
inline

◆ getTable()

const UnionType * getTable ( ) const
inline

◆ getValue()

const ChildT::ValueType & getValue ( const Coord & xyz) const
inline

◆ getValueAndCache() [1/3]

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/3]

const ChildT::ValueType & getValueAndCache ( const Coord & xyz,
AccessorT & acc ) const
inline

◆ getValueAndCache() [3/3]

const ChildT::ValueType & getValueAndCache ( const Coord & xyz,
AccessorT & acc ) const
inline

◆ getValueLevel()

Index getValueLevel ( const Coord & xyz) const
inline

Return the level of the tree (0 = leaf) at which the value at the given coordinates resides.

◆ getValueLevelAndCache()

Index getValueLevelAndCache ( const Coord & xyz,
AccessorT & acc ) const
inline

Return the level of the tree (0 = leaf) at which the value at the given coordinates resides.

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.

◆ getValueMask()

const NodeMaskType & getValueMask ( ) const
inline

◆ getValueOffMask()

NodeMaskType getValueOffMask ( ) const
inline

◆ getValueUnsafe() [1/2]

const ChildT::ValueType & getValueUnsafe ( Index offset) const
inline

Return the tile value at offset.

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

◆ getValueUnsafe() [2/2]

bool getValueUnsafe ( Index offset,
ValueType & value ) const
inline

Return the tile value and active state at offset.

Note
Use probeValue(const Coord&, ValueType&) for a safer alternative.
Warning
This method should only be used by experts seeking low-level optimizations.

◆ hasActiveTiles()

bool hasActiveTiles ( ) const
inline

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

◆ hasSameTopology()

bool hasSameTopology ( const InternalNode< OtherChildNodeType, OtherLog2Dim > * other) const
inline

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

◆ InternalNode() [1/8]

InternalNode ( )
inline

Default constructor.

Warning
The resulting InternalNode is uninitialized

◆ InternalNode() [2/8]

InternalNode ( const Coord & origin,
const ValueType & fillValue,
bool active = false )
inline

Constructs an InternalNode with dense tiles.

Parameters
originThe location in index space of the fist tile value
fillValueValue assigned to all the tiles
activeState assigned to all the tiles

◆ InternalNode() [3/8]

InternalNode ( const InternalNode & other)
inline

Deep copy constructor.

Note
This method is multi-threaded!

◆ InternalNode() [4/8]

InternalNode ( const InternalNode< OtherChildNodeType, Log2Dim > & other)
inlineexplicit

Value conversion copy constructor.

Note
This method is multi-threaded!

◆ InternalNode() [5/8]

InternalNode ( const InternalNode< OtherChildNodeType, Log2Dim > & other,
const ValueType & background,
TopologyCopy  )
inline

Topology copy constructor.

Note
This method is multi-threaded!

◆ InternalNode() [6/8]

InternalNode ( const InternalNode< OtherChildNodeType, Log2Dim > & other,
const ValueType & offValue,
const ValueType & onValue,
TopologyCopy  )
inline

Topology copy constructor.

Note
This method is multi-threaded!

◆ InternalNode() [7/8]

InternalNode ( const ValueType & offValue)
inlineexplicit

Constructor of an InternalNode with dense inactive tiles of the specified value.

Parameters
offValueBackground value used for inactive values

◆ InternalNode() [8/8]

InternalNode ( PartialCreate ,
const Coord & origin,
const ValueType & fillValue,
bool active = false )
inline

◆ isChildMaskOff() [1/2]

bool isChildMaskOff ( ) const
inline

◆ isChildMaskOff() [2/2]

bool isChildMaskOff ( Index n) const
inline

◆ isChildMaskOn()

bool isChildMaskOn ( Index n) const
inline

◆ isConstant() [1/2]

bool isConstant ( ValueType & firstValue,
bool & state,
const ValueType & tolerance = zeroVal<ValueType>() ) const
inline

Return true if all of this node's table entries have the same active state and the same constant value to within the given tolerance, and return that value in firstValue and the active state in state.

Note
This method also returns false if this node contains any child nodes.

◆ isConstant() [2/2]

bool isConstant ( ValueType & minValue,
ValueType & maxValue,
bool & state,
const ValueType & tolerance = zeroVal<ValueType>() ) const
inline

Return true if all of this node's tables entries have the same active state and the range of its values satisfy (maxValue - minValue) <= tolerance.

Parameters
minValueIs updated with the minimum of all values IF method returns true. Else the value is undefined!
maxValueIs updated with the maximum of all values IF method returns true. Else the value is undefined!
stateIs updated with the state of all values IF method returns true. Else the value is undefined!
toleranceThe tolerance used to determine if values are approximately constant.
Note
This method also returns false if this node contains any child nodes.

◆ isEmpty()

bool isEmpty ( ) const
inline
Returns
True if this node contains no child nodes.

◆ isInactive()

bool isInactive ( ) const
inline

Return true if this node has no children and only contains inactive values.

◆ isValueMaskOff() [1/2]

bool isValueMaskOff ( ) const
inline

◆ isValueMaskOff() [2/2]

bool isValueMaskOff ( Index n) const
inline

◆ isValueMaskOn() [1/2]

bool isValueMaskOn ( ) const
inline

◆ isValueMaskOn() [2/2]

bool isValueMaskOn ( Index n) const
inline

◆ isValueOff() [1/2]

bool isValueOff ( const Coord & xyz) const
inline

Return true if the voxel at the given coordinates is inactive.

◆ isValueOff() [2/2]

bool isValueOff ( Index offset) const
inline

Return true if the voxel at the given offset is inactive.

◆ isValueOn() [1/2]

bool isValueOn ( const Coord & xyz) const
inline

Return true if the voxel at the given coordinates is active.

◆ isValueOn() [2/2]

bool isValueOn ( Index offset) const
inline

Return true if the voxel at the given offset is active.

◆ isValueOnAndCache()

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()

Index64 leafCount ( ) const
inline

◆ makeChildNodeEmpty()

void makeChildNodeEmpty ( Index n,
const ValueType & value )
inlineprotected

◆ memUsage()

Index64 memUsage ( ) const
inline

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

◆ merge() [1/2]

void merge ( const ValueType & tileValue,
bool tileActive )
inline

Merge, using one of several schemes, this node (and its descendants) with a tile of the same dimensions and the given value and active state.

◆ merge() [2/2]

void merge ( InternalNode & other,
const ValueType & background,
const ValueType & otherBackground )
inline

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

Warning
This operation cannibalizes the other tree.

◆ modifyValue()

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()

void modifyValueAndActiveState ( const Coord & xyz,
const ModifyOp & op )
inline

Apply a functor to the voxel at the given coordinates.

◆ modifyValueAndActiveStateAndCache()

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()

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.

◆ negate()

void negate ( )
inline

Change the sign of all the values represented in this node and its child nodes.

◆ nodeCount() [1/2]

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

◆ nodeCount() [2/2]

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

◆ nonLeafCount()

Index64 nonLeafCount ( ) const
inline

◆ offLeafVoxelCount()

Index64 offLeafVoxelCount ( ) const
inline

◆ offsetToGlobalCoord()

Coord offsetToGlobalCoord ( Index n) const
inline

Return the global coordinates for a linear table offset.

◆ offsetToLocalCoord()

void offsetToLocalCoord ( Index n,
Coord & xyz )
inlinestatic

Return the local coordinates for a linear table offset, where offset 0 has coordinates (0, 0, 0).

◆ offVoxelCount()

Index64 offVoxelCount ( ) const
inline

◆ onLeafVoxelCount()

Index64 onLeafVoxelCount ( ) const
inline

◆ onTileCount()

Index64 onTileCount ( ) const
inline

◆ onVoxelCount()

Index64 onVoxelCount ( ) const
inline

◆ operator()()

template<typename _ChildNodeType, Index Log2Dim>
template<typename OtherInternalNode>
void operator() ( const tbb::blocked_range< Index > & r) const
inline

◆ origin()

const Coord & origin ( ) const
inline

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

◆ probeChild() [1/4]

ChildT * probeChild ( const Coord & xyz)
inline

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

◆ probeChild() [2/4]

const ChildNodeType * probeChild ( const Coord & xyz) const
inline

◆ probeChild() [3/4]

ChildT * probeChild ( const Coord & xyz,
ValueType & value,
bool & active )
inline

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

◆ probeChild() [4/4]

const ChildNodeType * probeChild ( const Coord & xyz,
ValueType & value,
bool & active ) const
inline

◆ probeChildUnsafe() [1/4]

ChildT * probeChildUnsafe ( Index offset)
inline

Return a pointer to the child node for a specific offset. If no such node exists, return nullptr.

Warning
This method should only be used by experts seeking low-level optimizations.
Note
Out-of-bounds memory access attempts will wrap around using modulo indexing.

◆ probeChildUnsafe() [2/4]

const ChildNodeType * probeChildUnsafe ( Index offset) const
inline

◆ probeChildUnsafe() [3/4]

ChildT * probeChildUnsafe ( Index offset,
ValueType & value,
bool & active )
inline

Return a pointer to the child node for a specific offset. If no such node exists, return nullptr.

Warning
This method should only be used by experts seeking low-level optimizations.
Note
Out-of-bounds memory access attempts will wrap around using modulo indexing.

◆ probeChildUnsafe() [4/4]

const ChildNodeType * probeChildUnsafe ( Index offset,
ValueType & value,
bool & active ) const
inline

◆ probeConstChild() [1/2]

const ChildT * probeConstChild ( const Coord & xyz) const
inline

◆ probeConstChild() [2/2]

const ChildT * probeConstChild ( const Coord & xyz,
ValueType & value,
bool & active ) const
inline

◆ probeConstChildUnsafe() [1/2]

const ChildT * probeConstChildUnsafe ( Index offset) const
inline

◆ probeConstChildUnsafe() [2/2]

const ChildT * probeConstChildUnsafe ( Index offset,
ValueType & value,
bool & active ) const
inline

◆ probeConstLeaf()

const ChildT::LeafNodeType * probeConstLeaf ( const Coord & xyz) const
inline

◆ probeConstLeafAndCache() [1/3]

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

◆ probeConstLeafAndCache() [2/3]

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

◆ probeConstLeafAndCache() [3/3]

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

◆ probeConstNode() [1/3]

const NodeType * probeConstNode ( const Coord & xyz) const

◆ probeConstNode() [2/3]

const NodeT * probeConstNode ( const Coord & xyz) const
inline

◆ probeConstNode() [3/3]

const NodeT * probeConstNode ( const Coord & xyz) const
inline

◆ probeConstNodeAndCache() [1/3]

const NodeType * probeConstNodeAndCache ( const Coord & xyz,
AccessorT &  ) const

◆ probeConstNodeAndCache() [2/3]

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

◆ probeConstNodeAndCache() [3/3]

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

◆ probeLeaf() [1/2]

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]

const LeafNodeType * probeLeaf ( const Coord & xyz) const

◆ probeLeafAndCache() [1/6]

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

Same as probeLeaf() 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).

◆ probeLeafAndCache() [2/6]

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

◆ probeLeafAndCache() [3/6]

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

◆ probeLeafAndCache() [4/6]

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

◆ probeLeafAndCache() [5/6]

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

◆ probeLeafAndCache() [6/6]

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

◆ probeNode() [1/4]

NodeType * probeNode ( const Coord & xyz)

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

◆ probeNode() [2/4]

NodeT * probeNode ( const Coord & xyz)
inline

◆ probeNode() [3/4]

NodeT * probeNode ( const Coord & xyz)
inline

◆ probeNode() [4/4]

const NodeType * probeNode ( const Coord & xyz) const
inline

◆ probeNodeAndCache() [1/3]

NodeType * probeNodeAndCache ( const Coord & xyz,
AccessorT &  )

Same as probeNode() 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).

◆ probeNodeAndCache() [2/3]

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

◆ probeNodeAndCache() [3/3]

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

◆ probeValue()

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

◆ probeValueAndCache()

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()

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.

◆ readBuffers() [1/2]

void readBuffers ( std::istream & is,
bool fromHalf = false )
inline

◆ readBuffers() [2/2]

void readBuffers ( std::istream & is,
const CoordBBox & clipBBox,
bool fromHalf = false )
inline

◆ readTopology()

void readTopology ( std::istream & is,
bool fromHalf = false )
inline

◆ resetBackground()

void resetBackground ( const ValueType & oldBackground,
const ValueType & newBackground )
inline

Change inactive tiles or voxels with value oldBackground to newBackground or -oldBackground to -newBackground. Active values are unchanged.

◆ resetChildNode()

void resetChildNode ( Index i,
ChildNodeType * child )
inlineprotected

◆ resetChildUnsafe()

void resetChildUnsafe ( Index offset,
ChildNodeType * child )
inline

Replace a child node at offset with the given child node.

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

◆ setActiveState()

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()

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.

◆ setActiveStateUnsafe()

void setActiveStateUnsafe ( Index offset,
bool on )
inline

Set the tile active state at offset but don't change its value.

Note
Use setActiveState(const Coord&, bool) for a safer alternative.
Warning
This method should only be used by experts seeking low-level optimizations.

◆ setChildNode()

void setChildNode ( Index i,
ChildNodeType * child )
inlineprotected

◆ setChildUnsafe()

void setChildUnsafe ( Index offset,
ChildNodeType * child )
inline

Replace a tile at offset with the given child node.

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

◆ setOrigin()

void setOrigin ( const Coord & origin)
inline

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

◆ setTransientData()

void setTransientData ( Index32 transientData)
inline

Set the transient data value.

◆ setValueAndCache()

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.

◆ setValueMask()

void setValueMask ( Index n,
bool on )
inlineprotected

Use a mask accessor to ensure consistency between the child and value masks; i.e., the value mask should always be off wherever the child mask is on.

◆ setValueOff() [1/2]

void setValueOff ( const Coord & xyz)
inline

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

◆ setValueOff() [2/2]

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()

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.

◆ setValueOffUnsafe() [1/2]

void setValueOffUnsafe ( Index offset)
inline

Mark the tile inactive at offset but don't change its value.

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

◆ setValueOffUnsafe() [2/2]

void setValueOffUnsafe ( Index offset,
const ValueType & value )
inline

Set the tile value at offset and mark the voxel as inactive.

Note
Use setValueOff(const Coord&, const ValueType&) for a safer alternative.
Warning
This method should only be used by experts seeking low-level optimizations.

◆ setValueOn() [1/2]

void setValueOn ( const Coord & xyz)
inline

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

◆ setValueOn() [2/2]

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()

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()

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.

◆ setValueOnlyUnsafe()

void setValueOnlyUnsafe ( Index offset,
const ValueType & value )
inline

Set the tile value at offset but don't change its value.

Note
Use setValueOnly(const Coord&, const ValueType&) for a safer alternative.
Warning
This method should only be used by experts seeking low-level optimizations.

◆ setValueOnUnsafe() [1/2]

void setValueOnUnsafe ( Index offset)
inline

Mark the tile active at offset but don't change its value.

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

◆ setValueOnUnsafe() [2/2]

void setValueOnUnsafe ( Index offset,
const ValueType & value )
inline

Set the tile value at offset and mark the voxel as active.

Note
Use setValueOn(const Coord&, const ValueType&) for a safer alternative.
Warning
This method should only be used by experts seeking low-level optimizations.

◆ setValuesOn()

void setValuesOn ( )
inline

Mark all values (both tiles and voxels) as active.

◆ stealChildUnsafe()

ChildT * stealChildUnsafe ( Index offset,
const ValueType & value,
bool active )
inline

Replace a child node at offset with the given value and active state.

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

◆ stealNode()

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()

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);

◆ topologyDifference() [1/3]

void topologyDifference ( const InternalNode< OtherChildNodeType, Log2Dim > & other,
const ValueType & background )

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

The last dummy argument is required to match the signature for InternalNode::topologyDifference.

Note
This operation modifies only active states, not values. Also note that this operation can result in all voxels being inactive so consider subsequently calling prune.

◆ topologyDifference() [2/3]

void topologyDifference ( const InternalNode< OtherChildT, Log2Dim > & other,
const ValueType & background )
inline

◆ topologyDifference() [3/3]

void topologyDifference ( const InternalNode< OtherChildT, Log2Dim > & other,
const ValueType & background )
inline

◆ topologyIntersection() [1/3]

void topologyIntersection ( const InternalNode< OtherChildNodeType, Log2Dim > & other,
const ValueType & background )

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.

◆ topologyIntersection() [2/3]

void topologyIntersection ( const InternalNode< OtherChildT, Log2Dim > & other,
const ValueType & background )
inline

◆ topologyIntersection() [3/3]

void topologyIntersection ( const InternalNode< OtherChildT, Log2Dim > & other,
const ValueType & background )
inline

◆ topologyUnion() [1/3]

void topologyUnion ( const InternalNode< OtherChildNodeType, Log2Dim > & other,
const bool preserveTiles = false )

Union this branch's set of active values with the other branch's active values. The value type of the other branch can 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.

Specifically, active tiles and voxels in this branch are not changed, and tiles or voxels that were inactive in this branch but active in the other branch are marked as active in this branch but left with their original values.

◆ topologyUnion() [2/3]

void topologyUnion ( const InternalNode< OtherChildT, Log2Dim > & other,
const bool preserveTiles )
inline

◆ topologyUnion() [3/3]

void topologyUnion ( const InternalNode< OtherChildT, Log2Dim > & other,
const bool preserveTiles )
inline

◆ touchLeaf()

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.

◆ touchLeafAndCache() [1/3]

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

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

◆ touchLeafAndCache() [2/3]

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

◆ touchLeafAndCache() [3/3]

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

◆ transientData()

Index32 transientData ( ) const
inline

Return the transient data value.

◆ unsetChildNode()

ChildT * unsetChildNode ( Index i,
const ValueType & value )
inlineprotected

◆ voxelizeActiveTiles()

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).
See also
denseFill()

◆ writeBuffers()

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

◆ writeTopology()

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

Friends And Related Symbol Documentation

◆ InternalNode

friend class InternalNode
friend

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

◆ IteratorBase< MaskDenseIterator, InternalNode >

friend class IteratorBase< MaskDenseIterator, InternalNode >
friend

◆ IteratorBase< MaskOffIterator, InternalNode >

friend class IteratorBase< MaskOffIterator, InternalNode >
friend

◆ IteratorBase< MaskOnIterator, InternalNode >

friend class IteratorBase< MaskOnIterator, InternalNode >
friend

Allow iterators to call mask accessor methods (setValueMask(), setChildMask(), etc.).

Member Data Documentation

◆ DIM

const Index DIM
static

◆ LEVEL

const Index LEVEL
static

◆ LOG2DIM

const Index LOG2DIM
static

◆ mChildMask

NodeMaskType mChildMask
protected

◆ mNodes

UnionType mNodes[NUM_VALUES]
protected

◆ mOrigin

Coord mOrigin
protected

Global grid index coordinates (x,y,z) of the local origin of this node.

◆ mTransientData

Index32 mTransientData
protected

Transient data (not serialized)

◆ mValueMask

NodeMaskType mValueMask
protected

◆ NUM_VALUES

const Index NUM_VALUES
static

◆ NUM_VOXELS

const Index64 NUM_VOXELS
static

◆ offV

template<typename _ChildNodeType, Index Log2Dim>
template<typename OtherInternalNode>
const ValueType& offV

◆ onV

template<typename _ChildNodeType, Index Log2Dim>
template<typename OtherInternalNode>
const ValueType & onV

◆ s

template<typename _ChildNodeType, Index Log2Dim>
template<typename OtherInternalNode>
const OtherInternalNode* s

◆ t

template<typename _ChildNodeType, Index Log2Dim>
template<typename OtherInternalNode>
InternalNode* t

◆ TOTAL

const Index TOTAL
static