OpenVDB  0.104.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
LeafNode< T, Log2Dim > Class Template Reference

Templated block class to hold specific data types and a fixed number of values determined by Log2Dim. More...

#include <LeafNode.h>

Classes

class  Buffer
 
struct  ChildAll
 
struct  ChildIter
 Leaf nodes have no children, so their child iterators have no get/set accessors. More...
 
struct  ChildOff
 
struct  ChildOn
 
struct  DenseIter
 
struct  ValueAll
 
struct  ValueConverter
 ValueConverter<T>::Type is the type of a LeafNode having the same child hierarchy and dimensions as this node but a different value type, T. More...
 
struct  ValueIter
 
struct  ValueOff
 
struct  ValueOn
 

Public Types

typedef T ValueType
 
typedef LeafNode< ValueType,
Log2Dim > 
LeafNodeType
 
typedef boost::shared_ptr
< LeafNode
Ptr
 
typedef util::NodeMask< Log2Dim > NodeMaskType
 
typedef ValueIter
< MaskOnIterator, LeafNode,
const ValueType, ValueOn
ValueOnIter
 
typedef ValueIter
< MaskOnIterator, const
LeafNode, const ValueType,
ValueOn
ValueOnCIter
 
typedef ValueIter
< MaskOffIterator, LeafNode,
const ValueType, ValueOff
ValueOffIter
 
typedef ValueIter
< MaskOffIterator, const
LeafNode, const ValueType,
ValueOff
ValueOffCIter
 
typedef ValueIter
< MaskDenseIterator, LeafNode,
const ValueType, ValueAll
ValueAllIter
 
typedef ValueIter
< MaskDenseIterator, const
LeafNode, const ValueType,
ValueAll
ValueAllCIter
 
typedef ChildIter
< MaskOnIterator, LeafNode,
ChildOn
ChildOnIter
 
typedef ChildIter
< MaskOnIterator, const
LeafNode, ChildOn
ChildOnCIter
 
typedef ChildIter
< MaskOffIterator, LeafNode,
ChildOff
ChildOffIter
 
typedef ChildIter
< MaskOffIterator, const
LeafNode, ChildOff
ChildOffCIter
 
typedef DenseIter< LeafNode,
ValueType, ChildAll
ChildAllIter
 
typedef DenseIter< const
LeafNode, const ValueType,
ChildAll
ChildAllCIter
 

Public Member Functions

 LeafNode ()
 Default constructor. More...
 
 LeafNode (const Coord &coords, const ValueType &value=zeroVal< ValueType >(), bool active=false)
 Constructor. More...
 
 LeafNode (const LeafNode &)
 Deep copy constructor. More...
 
template<typename OtherValueType >
 LeafNode (const LeafNode< OtherValueType, Log2Dim > &other, const ValueType &offValue, const ValueType &onValue, TopologyCopy)
 Topology copy constructor. More...
 
template<typename OtherValueType >
 LeafNode (const LeafNode< OtherValueType, Log2Dim > &other, const ValueType &background, TopologyCopy)
 Topology copy constructor. More...
 
 ~LeafNode ()
 Destructor. More...
 
Index64 onVoxelCount () const
 Return the number of voxels marked On. More...
 
Index64 offVoxelCount () const
 Return the number of voxels marked Off. More...
 
Index64 onLeafVoxelCount () const
 
Index64 offLeafVoxelCount () const
 
bool isEmpty () const
 Return true if this node has no active voxels. More...
 
bool isDense () const
 Return true if this node contains only active voxels. More...
 
Index64 memUsage () const
 Return the memory in bytes occupied by this node. More...
 
void evalActiveVoxelBoundingBox (CoordBBox &) const
 Expand the given bounding box so that it includes this leaf node's active voxels. More...
 
CoordBBox getNodeBoundingBox () const
 Return the bounding box of this node, i.e., the full index space spanned by this leaf node. More...
 
const CoordgetOrigin () const
 Get the grid index coordinates of this node's local origin. More...
 
void getOrigin (Coord &origin) const
 
void getOrigin (Int32 &x, Int32 &y, Int32 &z) const
 
Coord offset2globalCoord (Index n) const
 Get the global coordinates for a linear table offset. More...
 
std::string str () const
 Return a string representation of this node. More...
 
template<typename OtherType , Index OtherLog2Dim>
bool hasSameTopology (const LeafNode< OtherType, OtherLog2Dim > *other) const
 Return true if the given node (which may have a different ValueType than this node) has the same active value topology as this node. More...
 
bool operator== (const LeafNode &other) const
 Check for buffer, state and origin equivalence. More...
 
bool operator!= (const LeafNode &other) const
 
ValueOnCIter cbeginValueOn () const
 
ValueOnCIter beginValueOn () const
 
ValueOnIter beginValueOn ()
 
ValueOffCIter cbeginValueOff () const
 
ValueOffCIter beginValueOff () const
 
ValueOffIter beginValueOff ()
 
ValueAllCIter cbeginValueAll () const
 
ValueAllCIter beginValueAll () const
 
ValueAllIter beginValueAll ()
 
ValueOnCIter cendValueOn () const
 
ValueOnCIter endValueOn () const
 
ValueOnIter endValueOn ()
 
ValueOffCIter cendValueOff () const
 
ValueOffCIter endValueOff () const
 
ValueOffIter endValueOff ()
 
ValueAllCIter cendValueAll () const
 
ValueAllCIter endValueAll () const
 
ValueAllIter endValueAll ()
 
ChildOnCIter cbeginChildOn () const
 
ChildOnCIter beginChildOn () const
 
ChildOnIter beginChildOn ()
 
ChildOffCIter cbeginChildOff () const
 
ChildOffCIter beginChildOff () const
 
ChildOffIter beginChildOff ()
 
ChildAllCIter cbeginChildAll () const
 
ChildAllCIter beginChildAll () const
 
ChildAllIter beginChildAll ()
 
ChildOnCIter cendChildOn () const
 
ChildOnCIter endChildOn () const
 
ChildOnIter endChildOn ()
 
ChildOffCIter cendChildOff () const
 
ChildOffCIter endChildOff () const
 
ChildOffIter endChildOff ()
 
ChildAllCIter cendChildAll () const
 
ChildAllCIter endChildAll () const
 
ChildAllIter endChildAll ()
 
void swap (Buffer &other)
 Exchange this node's data buffer with the given data buffer without changing the active states of the values. More...
 
OPENVDB_DEPRECATED const BuffergetBuffer () const
 
const Bufferbuffer () const
 
Bufferbuffer ()
 
void readTopology (std::istream &, bool fromHalf=false)
 Read in just the topology. More...
 
void writeTopology (std::ostream &, bool toHalf=false) const
 Write out just the topology. More...
 
void readBuffers (std::istream &, bool fromHalf=false)
 Read buffers from a stream. More...
 
void writeBuffers (std::ostream &, bool toHalf=false) const
 Write buffers to a stream. More...
 
size_t streamingSize (bool toHalf=false) const
 
const ValueTypegetValue (const Coord &xyz) const
 Return the value of the voxel at the given coordinates. More...
 
const ValueTypegetValue (Index offset) const
 Return the value of the voxel at the given linear offset. More...
 
bool probeValue (const Coord &xyz, ValueType &val) const
 Return true if the voxel at the given coordinates is active. More...
 
bool probeValue (Index offset, ValueType &val) const
 Return true if the voxel at the given offset is active. More...
 
void setActiveState (const Coord &xyz, bool on)
 Set the active state 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 (Index offset)
 Mark the voxel at the given offset as inactive, but don't change its value. More...
 
void setValueOff (const Coord &xyz, const ValueType &val)
 Change the value of the voxel at the given coordinates and mark the voxel as inactive. More...
 
void setValueOff (Index offset, const ValueType &val)
 Change the value of the voxel at the given offset and mark the voxel as inactive. More...
 
void setValueOn (const Coord &xyz)
 Mark the voxel at the given coordinates as active, but don't change its value. More...
 
void setValueOn (Index offset)
 Mark the voxel at the given offset as active, but don't change its value. More...
 
void setValueOn (const Coord &xyz, const ValueType &val)
 Set the value of the voxel at the given coordinates and mark the voxel as active. More...
 
void setValue (const Coord &xyz, const ValueType &val)
 Identical to setValueOn. More...
 
void setValueOn (Index offset, const ValueType &val)
 Change the value of the voxel at the given offset and mark the voxel as active. More...
 
void setValueOnMin (const Coord &xyz, const ValueType &val)
 Set the value of the voxel at the given coordinates to the minimum of its current value and the given value, and mark the voxel as active. More...
 
void setValueOnMin (Index offset, const ValueType &val)
 Set the value of the voxel at the given offset to the minimum of its current value and the given value, and mark the voxel as active. More...
 
void setValueOnMax (const Coord &xyz, const ValueType &val)
 Set the value of the voxel at the given coordinates to the maximum of its current value and the given value, and mark the voxel as active. More...
 
void setValueOnMax (Index offset, const ValueType &val)
 Set the value of the voxel at the given offset to the maximum of its current value and the given value, and mark the voxel as active. More...
 
void setValueOnSum (const Coord &xyz, const ValueType &val)
 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. More...
 
void setValueOnSum (Index offset, const ValueType &val)
 Set the value of the voxel at the given offset to the sum of its current value and the given value, and mark the voxel as active. More...
 
OPENVDB_DEPRECATED void resetValue (const Coord &xyz, const ValueType &val)
 
void setValueOnly (const Coord &xyz, const ValueType &val)
 Change the value of the voxel at the given coordinates without altering the voxel's active state. More...
 
void setValueOnly (Index offset, const ValueType &val)
 Change the value of the voxel at the given offset without altering the voxel's active state. More...
 
OPENVDB_DEPRECATED void resetValue (Index offset, const ValueType &val)
 
void addValue (const ValueType &val)
 Add the given value to all active voxels, leaving inactive voxels unchanged. More...
 
void scaleValue (const ValueType &scale)
 Multiply all active voxels by the given value, leaving inactive voxels unchanged. More...
 
OPENVDB_DEPRECATED void setValueMaskOn ()
 Mark all voxels as active, but don't change their values. More...
 
OPENVDB_DEPRECATED void setValueMaskOff ()
 Mark all voxels as inactive, but don't change their values. More...
 
void setValuesOn ()
 Mark all voxels as active, but don't change their values. More...
 
void setValuesOff ()
 Mark all voxels as inactive, but don't change their values. More...
 
bool isValueOn (const Coord &xyz) const
 Return true if the voxel at the given coordinates is active. More...
 
bool isValueOn (Index offset) const
 Return true if the voxel at the given offset is active. More...
 
void fill (const CoordBBox &bbox, const ValueType &, bool active=true)
 Set all voxels within an axis-aligned box to a constant value. (The bbox coordinates are inclusive.) More...
 
void fill (const ValueType &value)
 Sets all values to the specified value. Their state is unchanged. More...
 
void fill (const ValueType &value, bool active)
 Sets all values to the specified value and state. More...
 
template<typename AccessorT >
const ValueTypegetValueAndCache (const Coord &xyz, AccessorT &) const
 Return the value of the voxel at the given coordinates. More...
 
template<typename AccessorT >
bool isValueOnAndCache (const Coord &xyz, AccessorT &) const
 Return true if the voxel at the given coordinates is active. More...
 
template<typename AccessorT >
void setValueAndCache (const Coord &xyz, const ValueType &val, AccessorT &)
 Change the value of the voxel at the given coordinates and mark it as active. More...
 
template<typename AccessorT >
void setValueOnlyAndCache (const Coord &xyz, const ValueType &val, AccessorT &)
 Change the value of the voxel at the given coordinates but preserve its state. More...
 
template<typename AccessorT >
void setValueOnSumAndCache (const Coord &xyz, const ValueType &val, AccessorT &)
 
template<typename AccessorT >
void setValueOffAndCache (const Coord &xyz, const ValueType &value, AccessorT &)
 Change the value of the voxel at the given coordinates and mark it as inactive. More...
 
template<typename AccessorT >
void setActiveStateAndCache (const Coord &xyz, bool on, AccessorT &)
 Set the active state of the voxel at the given coordinates without changing its value. More...
 
template<typename AccessorT >
bool probeValueAndCache (const Coord &xyz, ValueType &val, AccessorT &) const
 Return true if the voxel at the given coordinates is active and return the voxel value in val. More...
 
template<typename AccessorT >
const ValueTypegetValue (const Coord &xyz, bool &state, int &level, AccessorT &) const
 Return the value of the voxel at the given coordinates and return its active state and level (i.e., 0) in state and level. More...
 
template<typename ProbeType , typename AccessorT >
OPENVDB_DEPRECATED const
ValueType
probe (const Coord &xyz, ProbeType &p, AccessorT &) const
 
template<bool State, bool Level, typename AccessorT >
OPENVDB_DEPRECATED const
ValueType
probe (const Coord &xyz, bool &state, int &level, AccessorT &) const
 
template<typename AccessorT >
OPENVDB_DEPRECATED void updateCache (const Coord &, AccessorT &) const
 
const ValueTypegetFirstValue () const
 Return a const reference to the first value in the buffer. More...
 
const ValueTypegetLastValue () const
 Return a const reference to the last value in the buffer. More...
 
void resetBackground (const ValueType &oldBackground, const ValueType &newBackground)
 Replace inactive occurrences of oldBackground with newBackground, and inactive occurrences of -oldBackground with -newBackground. More...
 
void signedFloodFill (const ValueType &background)
 Propagates the sign from a narrow-band LEVEL SET into the inactive voxels. Note this method should only be use on narrow-band level sets!!! More...
 
void negate ()
 
void merge (const LeafNode &)
 
void merge (const LeafNode &other, const ValueType &, const ValueType &)
 
void voxelizeActiveTiles ()
 
template<typename OtherType >
void topologyUnion (const LeafNode< OtherType, Log2Dim > &other)
 Union this node's set of active values with the active values of the other node, whose ValueType may be different. More...
 
template<typename OtherType >
void topologyIntersection (const LeafNode< OtherType, Log2Dim > &other, const ValueType &)
 Intersect this node's set of active values with the active values of the other node, whose ValueType may be different. More...
 
template<typename CombineOp >
void combine (const LeafNode &other, CombineOp &op)
 
template<typename CombineOp >
void combine (const ValueType &value, bool valueIsActive, CombineOp &op)
 
template<typename CombineOp >
void combine2 (const LeafNode &other, const ValueType &, bool valueIsActive, CombineOp &)
 
template<typename CombineOp >
void combine2 (const ValueType &, const LeafNode &other, bool valueIsActive, CombineOp &)
 
template<typename CombineOp >
void combine2 (const LeafNode &b0, const LeafNode &b1, CombineOp &)
 
template<typename BBoxOp >
void visitActiveBBox (BBoxOp &) const
 Calls the templated functor BBoxOp with bounding box information. An additional level argument is provided to the callback. More...
 
template<typename VisitorOp >
void visit (VisitorOp &)
 
template<typename VisitorOp >
void visit (VisitorOp &) const
 
template<typename OtherLeafNodeType , typename VisitorOp >
void visit2Node (OtherLeafNodeType &other, VisitorOp &)
 
template<typename OtherLeafNodeType , typename VisitorOp >
void visit2Node (OtherLeafNodeType &other, VisitorOp &) const
 
template<typename IterT , typename VisitorOp >
void visit2 (IterT &otherIter, VisitorOp &, bool otherIsLHS=false)
 
template<typename IterT , typename VisitorOp >
void visit2 (IterT &otherIter, VisitorOp &, bool otherIsLHS=false) const
 
bool isConstant (ValueType &constValue, bool &state, const ValueType &tolerance=zeroVal< ValueType >()) const
 
bool isInactive () const
 Return true if all of this node's values are inactive. More...
 
bool isValueMaskOn (Index n) const
 
bool isValueMaskOn () const
 
bool isValueMaskOff (Index n) const
 
bool isValueMaskOff () const
 
const NodeMaskTypegetValueMask () const
 
NodeMaskTypegetValueMask ()
 
bool isChildMaskOn (Index) const
 
bool isChildMaskOff (Index) const
 
bool isChildMaskOff () const
 
template<typename NodeT , typename VisitorOp , typename ChildAllIterT >
void doVisit (NodeT &self, VisitorOp &op)
 
template<typename NodeT , typename OtherNodeT , typename VisitorOp , typename ChildAllIterT , typename OtherChildAllIterT >
void doVisit2Node (NodeT &self, OtherNodeT &other, VisitorOp &op)
 
template<typename NodeT , typename VisitorOp , typename ChildAllIterT , typename OtherChildAllIterT >
void doVisit2 (NodeT &self, OtherChildAllIterT &otherIter, VisitorOp &op, bool otherIsLHS)
 
template<typename PruneOp >
void pruneOp (PruneOp &)
 This function exists only to enable template instantiation. More...
 
void prune (const ValueType &=zeroVal< ValueType >())
 This function exists only to enable template instantiation. More...
 
void pruneInactive (const ValueType &)
 This function exists only to enable template instantiation. More...
 
LeafNodetouchLeaf (const Coord &)
 return a pointer to itself More...
 
template<typename AccessorT >
LeafNodetouchLeafAndCache (const Coord &, AccessorT &)
 return a pointer to itself More...
 
LeafNodeprobeLeaf (const Coord &)
 return a pointer to itself More...
 
template<typename AccessorT >
LeafNodeprobeLeafAndCache (const Coord &, AccessorT &)
 return a pointer to itself More...
 
const LeafNodeprobeConstLeaf (const Coord &) const
 return a const pointer to itself More...
 
template<typename AccessorT >
const LeafNodeprobeConstLeafAndCache (const Coord &, AccessorT &) const
 return a const pointer to itself More...
 

Static Public Member Functions

static Index log2dim ()
 Return log2 of the size of the buffer storage. More...
 
static Index dim ()
 Return the number of voxels in each dimension. More...
 
static Index size ()
 
static Index numValues ()
 
static Index getLevel ()
 
static void getNodeLog2Dims (std::vector< Index > &dims)
 
static Index getChildDim ()
 
static Index32 leafCount ()
 
static Index32 nonLeafCount ()
 
static Index coord2offset (const Coord &xyz)
 Return the linear table offset of the given coordinates. More...
 
static void offset2coord (Index n, Coord &xyz)
 Get the local coordinates for a linear table offset. More...
 
static Index getValueLevel (const Coord &)
 Return the level (i.e., 0) at which leaf node values reside. More...
 
static bool hasActiveTiles ()
 Return false since leaf nodes never contain tiles. More...
 
template<typename AccessorT >
static Index getValueLevelAndCache (const Coord &, AccessorT &)
 Return the LEVEL (=0) at which leaf node values reside. More...
 

Static Public Attributes

static const Index LOG2DIM = Log2Dim
 
static const Index TOTAL = Log2Dim
 
static const Index DIM = 1 << TOTAL
 
static const Index NUM_VALUES = 1 << 3 * Log2Dim
 
static const Index NUM_VOXELS = NUM_VALUES
 
static const Index SIZE = NUM_VALUES
 
static const Index LEVEL = 0
 

Protected Types

typedef NodeMaskType::OnIterator MaskOnIterator
 
typedef NodeMaskType::OffIterator MaskOffIterator
 
typedef NodeMaskType::DenseIterator MaskDenseIterator
 

Protected Member Functions

void setValueMask (Index n, bool on)
 
void setValueMaskOn (Index n)
 
void setValueMaskOff (Index n)
 

Static Protected Member Functions

static void evalNodeOrigin (Coord &xyz)
 Compute the origin of the leaf node that contains the voxel with the given coordinates. More...
 
template<typename NodeT , typename VisitorOp , typename ChildAllIterT >
static void doVisit (NodeT &, VisitorOp &)
 
template<typename NodeT , typename OtherNodeT , typename VisitorOp , typename ChildAllIterT , typename OtherChildAllIterT >
static void doVisit2Node (NodeT &self, OtherNodeT &other, VisitorOp &)
 
template<typename NodeT , typename VisitorOp , typename ChildAllIterT , typename OtherChildAllIterT >
static void doVisit2 (NodeT &self, OtherChildAllIterT &, VisitorOp &, bool otherIsLHS)
 

Protected Attributes

Buffer mBuffer
 Buffer containing the actual data values. More...
 
NodeMaskType mValueMask
 Bitmask that determines which voxels are active. More...
 
Coord mOrigin
 Global grid index coordinates (x,y,z) of the local origin of this node. More...
 

Friends

class ::TestLeaf
 
template<typename >
class ::TestLeafIO
 
template<typename , Index >
class LeafNode
 
struct ValueIter< MaskOnIterator, LeafNode, ValueType, ValueOn >
 
struct ValueIter< MaskOffIterator, LeafNode, ValueType, ValueOff >
 
struct ValueIter< MaskDenseIterator, LeafNode, ValueType, ValueAll >
 
struct ValueIter< MaskOnIterator, const LeafNode, ValueType, ValueOn >
 
struct ValueIter< MaskOffIterator, const LeafNode, ValueType, ValueOff >
 
struct ValueIter< MaskDenseIterator, const LeafNode, ValueType, ValueAll >
 
class IteratorBase< MaskOnIterator, LeafNode >
 
class IteratorBase< MaskOffIterator, LeafNode >
 
class IteratorBase< MaskDenseIterator, LeafNode >
 

Detailed Description

template<typename T, Index Log2Dim>
class openvdb::v0_104_0::tree::LeafNode< T, Log2Dim >

Templated block class to hold specific data types and a fixed number of values determined by Log2Dim.

Member Typedef Documentation

typedef LeafNode<ValueType, Log2Dim> LeafNodeType
typedef util::NodeMask<Log2Dim> NodeMaskType
typedef boost::shared_ptr<LeafNode> Ptr
typedef T ValueType

Constructor & Destructor Documentation

LeafNode ( )
inline

Default constructor.

LeafNode ( const Coord coords,
const ValueType value = zeroVal<ValueType>(),
bool  active = false 
)
inlineexplicit

Constructor.

Parameters
coordsthe grid index coordinates of a voxel
valuea value with which to fill the buffer
activethe active state to which to initialize all voxels
LeafNode ( const LeafNode< T, Log2Dim > &  other)
inline

Deep copy constructor.

LeafNode ( const LeafNode< OtherValueType, Log2Dim > &  other,
const ValueType offValue,
const ValueType onValue,
TopologyCopy   
)
inline

Topology copy constructor.

LeafNode ( const LeafNode< OtherValueType, Log2Dim > &  other,
const ValueType background,
TopologyCopy   
)
inline

Topology copy constructor.

~LeafNode ( )
inline

Destructor.

Member Function Documentation

void addValue ( const ValueType val)
inline

Add the given value to all active voxels, leaving inactive voxels unchanged.

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
const Buffer& buffer ( ) const
inline
Buffer& buffer ( )
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
ChildAllCIter cendChildAll ( ) const
inline
ChildOffCIter cendChildOff ( ) const
inline
ChildOnCIter cendChildOn ( ) const
inline
ValueAllCIter cendValueAll ( ) const
inline
ValueOffCIter cendValueOff ( ) const
inline
ValueOnCIter cendValueOn ( ) const
inline
void combine ( const LeafNode< T, Log2Dim > &  other,
CombineOp &  op 
)
inline
void combine ( const ValueType value,
bool  valueIsActive,
CombineOp &  op 
)
inline
void combine2 ( const LeafNode< T, Log2Dim > &  other,
const ValueType value,
bool  valueIsActive,
CombineOp &  op 
)
inline
void combine2 ( const ValueType value,
const LeafNode< T, Log2Dim > &  other,
bool  valueIsActive,
CombineOp &  op 
)
inline
void combine2 ( const LeafNode< T, Log2Dim > &  b0,
const LeafNode< T, Log2Dim > &  b1,
CombineOp &  op 
)
inline
Index coord2offset ( const Coord xyz)
inlinestatic

Return the linear table offset of the given coordinates.

static Index dim ( )
inlinestatic

Return the number of voxels in each dimension.

static void doVisit ( NodeT &  ,
VisitorOp &   
)
inlinestaticprotected
void doVisit ( NodeT &  self,
VisitorOp &  op 
)
inline
static void doVisit2 ( NodeT &  self,
OtherChildAllIterT &  ,
VisitorOp &  ,
bool  otherIsLHS 
)
inlinestaticprotected
void doVisit2 ( NodeT &  self,
OtherChildAllIterT &  otherIter,
VisitorOp &  op,
bool  otherIsLHS 
)
inline
static void doVisit2Node ( NodeT &  self,
OtherNodeT &  other,
VisitorOp &   
)
inlinestaticprotected
void doVisit2Node ( NodeT &  self,
OtherNodeT &  other,
VisitorOp &  op 
)
inline
ChildAllCIter endChildAll ( ) const
inline
ChildAllIter endChildAll ( )
inline
ChildOffCIter endChildOff ( ) const
inline
ChildOffIter endChildOff ( )
inline
ChildOnCIter endChildOn ( ) const
inline
ChildOnIter endChildOn ( )
inline
ValueAllCIter endValueAll ( ) const
inline
ValueAllIter endValueAll ( )
inline
ValueOffCIter endValueOff ( ) const
inline
ValueOffIter endValueOff ( )
inline
ValueOnCIter endValueOn ( ) const
inline
ValueOnIter endValueOn ( )
inline
void evalActiveVoxelBoundingBox ( CoordBBox bbox) const
inline

Expand the given bounding box so that it includes this leaf node's active voxels.

static void evalNodeOrigin ( Coord xyz)
inlinestaticprotected

Compute the origin of the leaf node that contains the voxel with the given coordinates.

void fill ( const CoordBBox bbox,
const ValueType value,
bool  active = true 
)
inline

Set all voxels within an axis-aligned box to a constant value. (The bbox coordinates are inclusive.)

void fill ( const ValueType value)
inline

Sets all values to the specified value. Their state is unchanged.

void fill ( const ValueType value,
bool  active 
)
inline

Sets all values to the specified value and state.

OPENVDB_DEPRECATED const Buffer& getBuffer ( ) const
inline
Deprecated:
Use buffer() instead.
static Index getChildDim ( )
inlinestatic
const ValueType& getFirstValue ( ) const
inline

Return a const reference to the first value in the buffer.

Note
Though it is potentially risky you can convert this to a non-const pointer by means of const_case<ValueType*>&.
const ValueType& getLastValue ( ) const
inline

Return a const reference to the last value in the buffer.

static Index getLevel ( )
inlinestatic
CoordBBox getNodeBoundingBox ( ) const
inline

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

static void getNodeLog2Dims ( std::vector< Index > &  dims)
inlinestatic
const Coord& getOrigin ( ) const
inline

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

void getOrigin ( Coord origin) const
inline
void getOrigin ( Int32 x,
Int32 y,
Int32 z 
) const
inline
const ValueT & getValue ( const Coord xyz) const
inline

Return the value of the voxel at the given coordinates.

const ValueT & getValue ( Index  offset) const
inline

Return the value of the voxel at the given linear offset.

const ValueType& getValue ( const Coord xyz,
bool &  state,
int &  level,
AccessorT &   
) const
inline

Return the value of the voxel at the given coordinates and return its active state and level (i.e., 0) in state and level.

Note
Used internally by ValueAccessor (note last argument is a dummy).
const ValueType& getValueAndCache ( const Coord xyz,
AccessorT &   
) const
inline

Return the value of the voxel at the given coordinates.

Note
Used internally by ValueAccessor (note last argument is a dummy).
static Index getValueLevel ( const Coord )
inlinestatic

Return the level (i.e., 0) at which leaf node values reside.

static Index getValueLevelAndCache ( const Coord ,
AccessorT &   
)
inlinestatic

Return the LEVEL (=0) at which leaf node values reside.

Note
Used internally by ValueAccessor (note last argument is a dummy).
const NodeMaskType& getValueMask ( ) const
inline
NodeMaskType& getValueMask ( )
inline
static bool hasActiveTiles ( )
inlinestatic

Return false since leaf nodes never contain tiles.

bool hasSameTopology ( const LeafNode< OtherType, OtherLog2Dim > *  other) const
inline

Return true if the given node (which may have a different ValueType than this node) has the same active value topology as this node.

bool isChildMaskOff ( Index  ) const
inline
bool isChildMaskOff ( ) const
inline
bool isChildMaskOn ( Index  ) const
inline
bool isConstant ( ValueType constValue,
bool &  state,
const ValueType tolerance = zeroVal<ValueType>() 
) const
inline

Return true if all of this node's values have the same active state and are equal to within the given tolerance, and return the value in constValue and the active state in state.

bool isDense ( ) const
inline

Return true if this node contains only active voxels.

bool isEmpty ( ) const
inline

Return true if this node has no active voxels.

bool isInactive ( ) const
inline

Return true if all of this node's values are inactive.

bool isValueMaskOff ( Index  n) const
inline
bool isValueMaskOff ( ) const
inline
bool isValueMaskOn ( Index  n) const
inline
bool isValueMaskOn ( ) const
inline
bool isValueOn ( const Coord xyz) const
inline

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

bool isValueOn ( Index  offset) const
inline

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

bool isValueOnAndCache ( const Coord xyz,
AccessorT &   
) const
inline

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

Note
Used internally by ValueAccessor (note last argument is a dummy).
static Index32 leafCount ( )
inlinestatic
static Index log2dim ( )
inlinestatic

Return log2 of the size of the buffer storage.

Index64 memUsage ( ) const
inline

Return the memory in bytes occupied by this node.

void merge ( const LeafNode< T, Log2Dim > &  other)
inline
void merge ( const LeafNode< T, Log2Dim > &  other,
const ValueType ,
const ValueType  
)
inline
void negate ( )
inline
static Index32 nonLeafCount ( )
inlinestatic
static Index numValues ( )
inlinestatic
Index64 offLeafVoxelCount ( ) const
inline
void offset2coord ( Index  n,
Coord xyz 
)
inlinestatic

Get the local coordinates for a linear table offset.

Coord offset2globalCoord ( Index  n) const
inline

Get the global coordinates for a linear table offset.

Index64 offVoxelCount ( ) const
inline

Return the number of voxels marked Off.

Index64 onLeafVoxelCount ( ) const
inline
Index64 onVoxelCount ( ) const
inline

Return the number of voxels marked On.

bool operator!= ( const LeafNode< T, Log2Dim > &  other) const
inline
bool operator== ( const LeafNode< T, Log2Dim > &  other) const
inline

Check for buffer, state and origin equivalence.

OPENVDB_DEPRECATED const ValueType& probe ( const Coord xyz,
ProbeType &  p,
AccessorT &   
) const
inline
OPENVDB_DEPRECATED const ValueType& probe ( const Coord xyz,
bool &  state,
int &  level,
AccessorT &   
) const
inline
const LeafNode* probeConstLeaf ( const Coord ) const
inline

return a const pointer to itself

const LeafNode* probeConstLeafAndCache ( const Coord ,
AccessorT &   
) const
inline

return a const pointer to itself

LeafNode* probeLeaf ( const Coord )
inline

return a pointer to itself

LeafNode* probeLeafAndCache ( const Coord ,
AccessorT &   
)
inline

return a pointer to itself

bool probeValue ( const Coord xyz,
ValueType val 
) const
inline

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

Parameters
xyzthe coordinates of the voxel to be probed
[out]valthe value of the voxel at the given coordinates
bool probeValue ( Index  offset,
ValueType val 
) const
inline

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

Parameters
offsetthe linear offset of the voxel to be probed
[out]valthe value of the voxel at the given coordinates
bool probeValueAndCache ( const Coord xyz,
ValueType val,
AccessorT &   
) const
inline

Return true if the voxel at the given coordinates is active and return the voxel value in val.

Note
Used internally by ValueAccessor (note last argument is a dummy).
void prune ( const ValueType = zeroVal<ValueType>())
inline

This function exists only to enable template instantiation.

void pruneInactive ( const ValueType )
inline

This function exists only to enable template instantiation.

void pruneOp ( PruneOp &  )
inline

This function exists only to enable template instantiation.

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

Read buffers from a stream.

Parameters
fromHalfif true, floating-point input values are assumed to be 16-bit
void readTopology ( std::istream &  is,
bool  fromHalf = false 
)
inline

Read in just the topology.

Parameters
fromHalfif true, floating-point input values are assumed to be 16-bit
void resetBackground ( const ValueType oldBackground,
const ValueType newBackground 
)
inline

Replace inactive occurrences of oldBackground with newBackground, and inactive occurrences of -oldBackground with -newBackground.

OPENVDB_DEPRECATED void resetValue ( const Coord xyz,
const ValueType val 
)
inline
OPENVDB_DEPRECATED void resetValue ( Index  offset,
const ValueType val 
)
inline
void scaleValue ( const ValueType scale)
inline

Multiply all active voxels by the given value, leaving inactive voxels unchanged.

void setActiveState ( const Coord xyz,
bool  on 
)
inline

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

void setActiveStateAndCache ( const Coord xyz,
bool  on,
AccessorT &   
)
inline

Set the active state of the voxel at the given coordinates without changing its value.

Note
Used internally by ValueAccessor (note last argument is a dummy).
void setValue ( const Coord xyz,
const ValueType val 
)
inline

Identical to setValueOn.

void setValueAndCache ( const Coord xyz,
const ValueType val,
AccessorT &   
)
inline

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

Note
Used internally by ValueAccessor (note last argument is a dummy).
void setValueMask ( Index  n,
bool  on 
)
inlineprotected
OPENVDB_DEPRECATED void setValueMaskOff ( )
inline

Mark all voxels as inactive, but don't change their values.

Deprecated:
Use setValuesOff() instead.
void setValueMaskOff ( Index  n)
inlineprotected
OPENVDB_DEPRECATED void setValueMaskOn ( )
inline

Mark all voxels as active, but don't change their values.

Deprecated:
Use setValuesOn() instead.
void setValueMaskOn ( Index  n)
inlineprotected
void setValueOff ( const Coord xyz)
inline

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

void setValueOff ( Index  offset)
inline

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

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

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

void setValueOff ( Index  offset,
const ValueType val 
)
inline

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

void setValueOffAndCache ( const Coord xyz,
const ValueType value,
AccessorT &   
)
inline

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

Note
Used internally by ValueAccessor (note last argument is a dummy).
void setValueOn ( const Coord xyz)
inline

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

void setValueOn ( Index  offset)
inline

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

void setValueOn ( const Coord xyz,
const ValueType val 
)
inline

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

void setValueOn ( Index  offset,
const ValueType val 
)
inline

Change the value of the voxel at the given offset and mark the voxel as active.

void setValueOnly ( const Coord xyz,
const ValueType val 
)
inline

Change the value of the voxel at the given coordinates without altering the voxel's active state.

void setValueOnly ( Index  offset,
const ValueType val 
)
inline

Change the value of the voxel at the given offset without altering the voxel's active state.

This method is very fast since it effectively ignores the active state of the voxel.

void setValueOnlyAndCache ( const Coord xyz,
const ValueType val,
AccessorT &   
)
inline

Change the value of the voxel at the given coordinates but preserve its state.

Note
Used internally by ValueAccessor (last argument is a dummy).
void setValueOnMax ( const Coord xyz,
const ValueType val 
)
inline

Set the value of the voxel at the given coordinates to the maximum of its current value and the given value, and mark the voxel as active.

void setValueOnMax ( Index  offset,
const ValueType val 
)
inline

Set the value of the voxel at the given offset to the maximum of its current value and the given value, and mark the voxel as active.

void setValueOnMin ( const Coord xyz,
const ValueType val 
)
inline

Set the value of the voxel at the given coordinates to the minimum of its current value and the given value, and mark the voxel as active.

void setValueOnMin ( Index  offset,
const ValueType val 
)
inline

Set the value of the voxel at the given offset to the minimum of its current value and the given value, and mark the voxel as active.

void setValueOnSum ( const Coord xyz,
const ValueType val 
)
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.

void setValueOnSum ( Index  offset,
const ValueType val 
)
inline

Set the value of the voxel at the given offset to the sum of its current value and the given value, and mark the voxel as active.

void setValueOnSumAndCache ( const Coord xyz,
const ValueType val,
AccessorT &   
)
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.

Note
Used internally by ValueAccessor (note last argument is a dummy).
void setValuesOff ( )
inline

Mark all voxels as inactive, but don't change their values.

void setValuesOn ( )
inline

Mark all voxels as active, but don't change their values.

void signedFloodFill ( const ValueType background)
inline

Propagates the sign from a narrow-band LEVEL SET into the inactive voxels. Note this method should only be use on narrow-band level sets!!!

static Index size ( )
inlinestatic
std::string str ( ) const
inline

Return a string representation of this node.

size_t streamingSize ( bool  toHalf = false) const
void swap ( Buffer other)
inline

Exchange this node's data buffer with the given data buffer without changing the active states of the values.

void topologyIntersection ( const LeafNode< OtherType, Log2Dim > &  other,
const ValueType  
)
inline

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

The last dummy arguemnt is required to match the signature for InternalNode::topologyIntersection.

Note
This operation modifies only active states, not values. Also note that this operation can result in all voxels being inactive so consider subsequnetly calling prune.
void topologyUnion ( const LeafNode< OtherType, Log2Dim > &  other)
inline

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

Note
This operation modifies only active states, not values.
LeafNode* touchLeaf ( const Coord )
inline

return a pointer to itself

LeafNode* touchLeafAndCache ( const Coord ,
AccessorT &   
)
inline

return a pointer to itself

OPENVDB_DEPRECATED void updateCache ( const Coord ,
AccessorT &   
) const
inline
Note
Used internally by ValueAccessor.
void visit ( VisitorOp &  op)
inline
void visit ( VisitorOp &  op) const
inline
void visit2 ( IterT &  otherIter,
VisitorOp &  op,
bool  otherIsLHS = false 
)
inline
void visit2 ( IterT &  otherIter,
VisitorOp &  op,
bool  otherIsLHS = false 
) const
inline
void visit2Node ( OtherLeafNodeType &  other,
VisitorOp &  op 
)
inline
void visit2Node ( OtherLeafNodeType &  other,
VisitorOp &  op 
) const
inline
void visitActiveBBox ( BBoxOp &  op) const
inline

Calls the templated functor BBoxOp with bounding box information. An additional level argument is provided to the callback.

Note
The bounding boxes are guarenteed to be non-overlapping.
void voxelizeActiveTiles ( )
inline
void writeBuffers ( std::ostream &  os,
bool  toHalf = false 
) const
inline

Write buffers to a stream.

Parameters
toHalfif true, output floating-point values as 16-bit half floats
void writeTopology ( std::ostream &  os,
bool  toHalf = false 
) const
inline

Write out just the topology.

Parameters
toHalfif true, output floating-point values as 16-bit half floats

Friends And Related Function Documentation

friend class ::TestLeaf
friend
friend class ::TestLeafIO
friend
friend class IteratorBase< MaskDenseIterator, LeafNode >
friend
friend class IteratorBase< MaskOffIterator, LeafNode >
friend
friend class IteratorBase< MaskOnIterator, LeafNode >
friend
friend class LeafNode
friend
friend struct ValueIter< MaskDenseIterator, const LeafNode, ValueType, ValueAll >
friend
friend struct ValueIter< MaskOffIterator, const LeafNode, ValueType, ValueOff >
friend
friend struct ValueIter< MaskOffIterator, LeafNode, ValueType, ValueOff >
friend
friend struct ValueIter< MaskOnIterator, const LeafNode, ValueType, ValueOn >
friend
friend struct ValueIter< MaskOnIterator, LeafNode, ValueType, ValueOn >
friend

Member Data Documentation

const Index DIM = 1 << TOTAL
static
const Index LEVEL = 0
static
const Index LOG2DIM = Log2Dim
static
Buffer mBuffer
protected

Buffer containing the actual data values.

Coord mOrigin
protected

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

NodeMaskType mValueMask
protected

Bitmask that determines which voxels are active.

const Index NUM_VALUES = 1 << 3 * Log2Dim
static
const Index NUM_VOXELS = NUM_VALUES
static
const Index SIZE = NUM_VALUES
static
const Index TOTAL = Log2Dim
static

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