OpenVDB
1.1.0
|
#include <Tree.h>
Inherits TreeBase.
Classes | |
struct | ValueConverter |
ValueConverter<T>::Type is the type of a tree having the same hierarchy as this tree but a different value type, T. More... | |
Public Types | |
typedef boost::shared_ptr< Tree > | Ptr |
typedef boost::shared_ptr < const Tree > | ConstPtr |
typedef _RootNodeType | RootNodeType |
typedef RootNodeType::ValueType | ValueType |
typedef RootNodeType::LeafNodeType | LeafNodeType |
typedef TreeValueIteratorBase < Tree, typename RootNodeType::ValueAllIter > | ValueAllIter |
typedef TreeValueIteratorBase < const Tree, typename RootNodeType::ValueAllCIter > | ValueAllCIter |
typedef TreeValueIteratorBase < Tree, typename RootNodeType::ValueOnIter > | ValueOnIter |
typedef TreeValueIteratorBase < const Tree, typename RootNodeType::ValueOnCIter > | ValueOnCIter |
typedef TreeValueIteratorBase < Tree, typename RootNodeType::ValueOffIter > | ValueOffIter |
typedef TreeValueIteratorBase < const Tree, typename RootNodeType::ValueOffCIter > | ValueOffCIter |
typedef NodeIteratorBase< Tree, typename RootNodeType::ChildOnIter > | NodeIter |
Iterator over all nodes in this tree. More... | |
typedef NodeIteratorBase < const Tree, typename RootNodeType::ChildOnCIter > | NodeCIter |
Iterator over all nodes in this tree. More... | |
typedef LeafIteratorBase< Tree, typename RootNodeType::ChildOnIter > | LeafIter |
Iterator over all leaf nodes in this tree. More... | |
typedef LeafIteratorBase < const Tree, typename RootNodeType::ChildOnCIter > | LeafCIter |
Iterator over all leaf nodes in this tree. More... | |
Public Member Functions | |
Tree () | |
Tree (const Tree &other) | |
Deep copy constructor. More... | |
template<typename OtherTreeType > | |
Tree (const OtherTreeType &other, const ValueType &inactiveValue, const ValueType &activeValue, TopologyCopy) | |
Topology copy constructor from a tree of a different type. More... | |
template<typename OtherTreeType > | |
Tree (const OtherTreeType &other, const ValueType &background, TopologyCopy) | |
Topology copy constructor from a tree of a different type. More... | |
Tree (const ValueType &background) | |
Empty tree constructor. More... | |
virtual | ~Tree () |
virtual TreeBase::Ptr | copy () const |
Return a pointer to a deep copy of this tree. More... | |
virtual Name | valueType () const |
Return the name of the type of a voxel's value (e.g., "float" or "vec3d") More... | |
virtual const Name & | type () const |
Return the name of this type of tree. More... | |
bool | operator== (const Tree &) const |
bool | operator!= (const Tree &) const |
template<typename OtherRootNodeType > | |
bool | hasSameTopology (const Tree< OtherRootNodeType > &other) const |
Return true if the given tree has the same node and active value topology as this tree (but possibly a different ValueType ). More... | |
virtual bool | evalLeafBoundingBox (CoordBBox &bbox) const |
Return in bbox the axis-aligned bounding box of all leaf nodes. More... | |
virtual bool | evalActiveVoxelBoundingBox (CoordBBox &bbox) const |
Return in bbox the axis-aligned bounding box of all active voxels and tiles. This is a tighter bounding box than the leaf node bounding box. More... | |
virtual bool | evalActiveVoxelDim (Coord &dim) const |
Return in dim the dimensions of the axis-aligned bounding box of all active voxels. This is a tighter bounding box than the leaf node bounding box. More... | |
virtual bool | evalLeafDim (Coord &dim) const |
Return in dim the dimensions of the axis-aligned bounding box of all leaf nodes. More... | |
virtual void | readTopology (std::istream &, bool saveFloatAsHalf=false) |
Read the tree topology from a stream. More... | |
virtual void | writeTopology (std::ostream &, bool saveFloatAsHalf=false) const |
Write the tree topology to a stream. More... | |
virtual void | readBuffers (std::istream &, bool saveFloatAsHalf=false) |
Read all data buffers for this tree. More... | |
virtual void | writeBuffers (std::ostream &, bool saveFloatAsHalf=false) const |
Write out all data buffers for this tree. More... | |
virtual void | print (std::ostream &os=std::cout, int verboseLevel=1) const |
Print statistics, memory usage and other information about this tree. More... | |
virtual Index | treeDepth () const |
Return the depth of this tree. More... | |
virtual Index32 | leafCount () const |
Return the number of leaf nodes. More... | |
virtual Index32 | nonLeafCount () const |
Return the number of non-leaf nodes. More... | |
virtual Index64 | activeLeafVoxelCount () const |
Return the number of active voxels stored in leaf nodes. More... | |
virtual Index64 | inactiveLeafVoxelCount () const |
Return the number of inactive voxels stored in leaf nodes. More... | |
virtual Index64 | activeVoxelCount () const |
Return the total number of active voxels. More... | |
virtual Index64 | inactiveVoxelCount () const |
Return the number of inactive voxels within the bounding box of all active voxels. More... | |
void | evalMinMax (ValueType &min, ValueType &max) const |
Return the minimum and maximum active values in this tree. More... | |
virtual Index64 | memUsage () const |
Return the total amount of memory in bytes occupied by this tree. More... | |
const ValueType & | getValue (const Coord &xyz) const |
Return the value of the voxel at the given coordinates. More... | |
template<typename AccessT > | |
const ValueType & | getValue (const Coord &xyz, AccessT &) const |
Return the value of the voxel at the given coordinates and update the given accessor's node cache. More... | |
int | getValueDepth (const Coord &xyz) const |
Return the tree depth (0 = root) at which the value of voxel (x, y, z) resides. More... | |
void | setValue (const Coord &xyz, const ValueType &value) |
Set the value of the voxel at the given coordinates and mark the voxel as active. More... | |
void | setValueOnly (const Coord &xyz, const ValueType &value) |
Set the value of the voxel at the given coordinates but preserve it active state. More... | |
template<typename AccessT > | |
void | setValue (const Coord &xyz, const ValueType &value, AccessT &) |
Set the value of the voxel at the given coordinates, mark the voxel as active, and update the given accessor's node cache. More... | |
void | setValueOn (const Coord &xyz) |
Mark the voxel at the given coordinates as active, but don't change its value. More... | |
void | setValueOn (const Coord &xyz, const ValueType &value) |
Set the value of the voxel at the given coordinates and mark the voxel as active. More... | |
void | setValueOnMin (const Coord &xyz, const ValueType &value) |
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 | setValueOnMax (const Coord &xyz, const ValueType &value) |
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 | setValueOnSum (const Coord &xyz, const ValueType &value) |
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 | setValueOff (const Coord &xyz) |
Mark the voxel at the given coordinates as inactive, but don't change its value. More... | |
void | setValueOff (const Coord &xyz, const ValueType &value) |
Change the value of the voxel at the given coordinates and mark the voxel as inactive. More... | |
void | setActiveState (const Coord &xyz, bool on) |
Set the active state of the voxel at the given coordinates, but don't change its value. More... | |
bool | probeValue (const Coord &xyz, ValueType &value) const |
Get the value of the voxel at the given coordinates. More... | |
bool | isValueOn (const Coord &xyz) const |
Return true if the value at the given coordinates is active. More... | |
bool | isValueOff (const Coord &xyz) const |
Return true if the value at the given coordinates is inactive. More... | |
bool | hasActiveTiles () const |
Return true if this tree has any active tiles. More... | |
void | fill (const CoordBBox &bbox, const ValueType &value, bool active=true) |
Set all voxels within a given axis-aligned box to a constant value. If necessary, subdivide tiles that intersect the box. More... | |
template<typename PruneOp > | |
void | pruneOp (PruneOp &) |
void | prune (const ValueType &tolerance=zeroVal< ValueType >()) |
Reduce the memory footprint of this tree by replacing with tiles any nodes whose values are all the same (optionally to within a tolerance) and have the same active state. More... | |
void | pruneInactive (const ValueType &) |
Reduce the memory footprint of this tree by replacing with tiles of the given value any nodes whose values are all inactive. More... | |
void | pruneInactive () |
Reduce the memory footprint of this tree by replacing with background tiles any nodes whose values are all inactive. More... | |
void | pruneLevelSet () |
Prune any descendants whose values are all inactive and replace them with inactive tiles having a values equal to the first value encountered in the (inactive) child. More... | |
LeafNodeType * | touchLeaf (const Coord &xyz) |
LeafNodeType * | probeLeaf (const Coord &xyz) |
const LeafNodeType * | probeConstLeaf (const Coord &xyz) const |
bool | empty () const |
Return true if this tree contains no nodes other than the root node and no tiles other than background tiles. More... | |
void | clear () |
Remove all tiles from this tree and all nodes other than the root node. More... | |
void | clearAllAccessors () |
Clear all registered accessors. More... | |
virtual Metadata::Ptr | getBackgroundValue () const |
Return this tree's background value wrapped as metadata. More... | |
const ValueType & | background () const |
Return this tree's background value. More... | |
OPENVDB_DEPRECATED ValueType | getBackground () const |
void | setBackground (const ValueType &background) |
Replace this tree's background value. More... | |
virtual void | getIndexRange (CoordBBox &bbox) const |
Min and max are both inclusive. More... | |
void | signedFloodFill () |
Set the values of all inactive voxels and tiles of a narrow-band level set from the signs of the active voxels, setting outside values to +background and inside values to -background. More... | |
void | signedFloodFill (const ValueType &outside, const ValueType &inside) |
Set the values of all inactive voxels and tiles of a narrow-band level set from the signs of the active voxels, setting outside values to "outside" and inside values to "inside. The background value of the grid
will be set to the "outside" value. More... | |
void | merge (Tree &other) |
void | voxelizeActiveTiles () |
Turns active tiles into dense voxels, i.e. active leaf nodes. More... | |
template<typename OtherRootNodeType > | |
void | topologyUnion (const Tree< OtherRootNodeType > &other) |
Union this tree's set of active values with the active values of the other tree, whose ValueType may be different. More... | |
template<typename CombineOp > | |
void | combine (Tree &other, CombineOp &op, bool prune=false) |
template<typename CombineOp > | |
void | combine (Tree &other, const CombineOp &op, bool prune=false) |
template<typename ExtendedCombineOp > | |
void | combineExtended (Tree &other, ExtendedCombineOp &op, bool prune=false) |
template<typename ExtendedCombineOp > | |
void | combineExtended (Tree &other, const ExtendedCombineOp &op, bool prune=false) |
template<typename CombineOp > | |
void | combine2 (const Tree &a, const Tree &b, CombineOp &op, bool prune=false) |
template<typename CombineOp > | |
void | combine2 (const Tree &a, const Tree &b, const CombineOp &op, bool prune=false) |
template<typename ExtendedCombineOp > | |
void | combine2Extended (const Tree &a, const Tree &b, ExtendedCombineOp &op, bool prune=false) |
template<typename ExtendedCombineOp > | |
void | combine2Extended (const Tree &a, const Tree &b, const ExtendedCombineOp &, bool prune=false) |
template<typename BBoxOp > | |
void | visitActiveBBox (BBoxOp &op) const |
template<typename VisitorOp > | |
void | visit (VisitorOp &op) |
template<typename VisitorOp > | |
void | visit (const VisitorOp &op) |
template<typename VisitorOp > | |
void | visit (VisitorOp &op) const |
template<typename VisitorOp > | |
void | visit (const VisitorOp &op) const |
template<typename OtherTreeType , typename VisitorOp > | |
void | visit2 (OtherTreeType &other, VisitorOp &op) |
template<typename OtherTreeType , typename VisitorOp > | |
void | visit2 (OtherTreeType &other, const VisitorOp &op) |
template<typename OtherTreeType , typename VisitorOp > | |
void | visit2 (OtherTreeType &other, VisitorOp &op) const |
template<typename OtherTreeType , typename VisitorOp > | |
void | visit2 (OtherTreeType &other, const VisitorOp &op) const |
template<typename IterT > | |
IterT | begin () |
Return an iterator of type IterT (for example, begin<ValueOnIter>() is equivalent to beginValueOn()). More... | |
template<typename CIterT > | |
CIterT | cbegin () const |
Return a const iterator of type CIterT (for example, cbegin<ValueOnCIter>() is equivalent to cbeginValueOn()). More... | |
template<typename IterT > | |
IterT | cbegin () const |
template<typename AccessT > | |
const RootNodeType::ValueType & | getValue (const Coord &xyz, AccessT &accessor) const |
RootNodeType & | getRootNode () |
Return this tree's root node. More... | |
const RootNodeType & | getRootNode () const |
Return this tree's root node. More... | |
void | attachAccessor (ValueAccessorBase< Tree > &) const |
Register an accessor for this tree. Registered accessors are automatically cleared whenever one of this tree's nodes is deleted. More... | |
void | attachAccessor (ValueAccessorBase< const Tree > &) const |
Register an accessor for this tree. Registered accessors are automatically cleared whenever one of this tree's nodes is deleted. More... | |
void | releaseAccessor (ValueAccessorBase< Tree > &) const |
Deregister an accessor so that it is no longer automatically cleared. More... | |
void | releaseAccessor (ValueAccessorBase< const Tree > &) const |
Deregister an accessor so that it is no longer automatically cleared. More... | |
RootNodeType::ChildOnCIter | beginRootChildren () const |
Return an iterator over children of the root node. More... | |
RootNodeType::ChildOnCIter | cbeginRootChildren () const |
Return an iterator over children of the root node. More... | |
RootNodeType::ChildOnIter | beginRootChildren () |
Return an iterator over children of the root node. More... | |
RootNodeType::ChildOffCIter | beginRootTiles () const |
Return an iterator over non-child entries of the root node's table. More... | |
RootNodeType::ChildOffCIter | cbeginRootTiles () const |
Return an iterator over non-child entries of the root node's table. More... | |
RootNodeType::ChildOffIter | beginRootTiles () |
Return an iterator over non-child entries of the root node's table. More... | |
RootNodeType::ChildAllCIter | beginRootDense () const |
Return an iterator over all entries of the root node's table. More... | |
RootNodeType::ChildAllCIter | cbeginRootDense () const |
Return an iterator over all entries of the root node's table. More... | |
RootNodeType::ChildAllIter | beginRootDense () |
Return an iterator over all entries of the root node's table. More... | |
NodeIter | beginNode () |
Return an iterator over all nodes in this tree. More... | |
NodeCIter | beginNode () const |
Return an iterator over all nodes in this tree. More... | |
NodeCIter | cbeginNode () const |
Return an iterator over all nodes in this tree. More... | |
LeafIter | beginLeaf () |
Return an iterator over all leaf nodes in this tree. More... | |
LeafCIter | beginLeaf () const |
Return an iterator over all leaf nodes in this tree. More... | |
LeafCIter | cbeginLeaf () const |
Return an iterator over all leaf nodes in this tree. More... | |
ValueAllIter | beginValueAll () |
Return an iterator over all values (tile and voxel) across all nodes. More... | |
ValueAllCIter | beginValueAll () const |
Return an iterator over all values (tile and voxel) across all nodes. More... | |
ValueAllCIter | cbeginValueAll () const |
Return an iterator over all values (tile and voxel) across all nodes. More... | |
ValueOnIter | beginValueOn () |
Return an iterator over active values (tile and voxel) across all nodes. More... | |
ValueOnCIter | beginValueOn () const |
Return an iterator over active values (tile and voxel) across all nodes. More... | |
ValueOnCIter | cbeginValueOn () const |
Return an iterator over active values (tile and voxel) across all nodes. More... | |
ValueOffIter | beginValueOff () |
Return an iterator over inactive values (tile and voxel) across all nodes. More... | |
ValueOffCIter | beginValueOff () const |
Return an iterator over inactive values (tile and voxel) across all nodes. More... | |
ValueOffCIter | cbeginValueOff () const |
Return an iterator over inactive values (tile and voxel) across all nodes. More... | |
Static Public Member Functions | |
static const Name & | treeType () |
Return the name of this type of tree. More... | |
static void | getNodeLog2Dims (std::vector< Index > &dims) |
Traverse the type hierarchy of nodes, and return, in dims, a list of the Log2Dims of nodes in order from RootNode to LeafNode. More... | |
Static Public Attributes | |
static const Index | DEPTH = RootNodeType::LEVEL + 1 |
Protected Types | |
typedef tbb::concurrent_hash_map < ValueAccessorBase< Tree > *, bool > | AccessorRegistry |
typedef tbb::concurrent_hash_map < ValueAccessorBase< const Tree > *, bool > | ConstAccessorRegistry |
Protected Member Functions | |
Tree & | operator= (const Tree &) |
void | releaseAllAccessors () |
Notify all registered accessors, by calling ValueAccessor::release(), that this tree is about to be deleted. More... | |
Protected Attributes | |
RootNodeType | mRoot |
AccessorRegistry | mAccessorRegistry |
ConstAccessorRegistry | mConstAccessorRegistry |
|
protected |
|
protected |
typedef LeafIteratorBase<const Tree, typename RootNodeType::ChildOnCIter> LeafCIter |
Iterator over all leaf nodes in this tree.
typedef LeafIteratorBase<Tree, typename RootNodeType::ChildOnIter> LeafIter |
Iterator over all leaf nodes in this tree.
typedef RootNodeType::LeafNodeType LeafNodeType |
typedef NodeIteratorBase<const Tree, typename RootNodeType::ChildOnCIter> NodeCIter |
Iterator over all nodes in this tree.
typedef NodeIteratorBase<Tree, typename RootNodeType::ChildOnIter> NodeIter |
Iterator over all nodes in this tree.
typedef _RootNodeType RootNodeType |
typedef TreeValueIteratorBase<const Tree, typename RootNodeType::ValueAllCIter> ValueAllCIter |
typedef TreeValueIteratorBase<Tree, typename RootNodeType::ValueAllIter> ValueAllIter |
typedef TreeValueIteratorBase<const Tree, typename RootNodeType::ValueOffCIter> ValueOffCIter |
typedef TreeValueIteratorBase<Tree, typename RootNodeType::ValueOffIter> ValueOffIter |
typedef TreeValueIteratorBase<const Tree, typename RootNodeType::ValueOnCIter> ValueOnCIter |
typedef TreeValueIteratorBase<Tree, typename RootNodeType::ValueOnIter> ValueOnIter |
typedef RootNodeType::ValueType ValueType |
|
inline |
|
inline |
Topology copy constructor from a tree of a different type.
Copy the structure, i.e., the active states of tiles and voxels, of another tree of a possibly different type, but don't copy any tile or voxel values. Instead, initialize tiles and voxels with the given active and inactive values.
other | a tree having (possibly) a different ValueType |
inactiveValue | background value for this tree, and the value to which all inactive tiles and voxels are initialized |
activeValue | value to which active tiles and voxels are initialized |
|
inline |
Topology copy constructor from a tree of a different type.
Copy the structure, i.e., the active states of tiles and voxels, of another tree of a possibly different type, but don't copy any tile or voxel values. Instead, initialize tiles and voxels with the given background value.
other | a tree having (possibly) a different ValueType |
background | the value to which tiles and voxels are initialized |
|
inlinevirtual |
|
inlinevirtual |
Return the number of active voxels stored in leaf nodes.
Implements TreeBase.
|
inlinevirtual |
Return the total number of active voxels.
Implements TreeBase.
|
inline |
Register an accessor for this tree. Registered accessors are automatically cleared whenever one of this tree's nodes is deleted.
|
inline |
Register an accessor for this tree. Registered accessors are automatically cleared whenever one of this tree's nodes is deleted.
|
inline |
Return this tree's background value.
|
inline |
Return an iterator of type IterT
(for example, begin<ValueOnIter>() is equivalent to beginValueOn()).
|
inline |
Return an iterator over all leaf nodes in this tree.
|
inline |
Return an iterator over all leaf nodes in this tree.
|
inline |
Return an iterator over all nodes in this tree.
|
inline |
Return an iterator over all nodes in this tree.
|
inline |
Return an iterator over children of the root node.
|
inline |
Return an iterator over children of the root node.
|
inline |
Return an iterator over all entries of the root node's table.
|
inline |
Return an iterator over all entries of the root node's table.
|
inline |
Return an iterator over non-child entries of the root node's table.
|
inline |
Return an iterator over non-child entries of the root node's table.
|
inline |
Return an iterator over all values (tile and voxel) across all nodes.
|
inline |
Return an iterator over all values (tile and voxel) across all nodes.
|
inline |
Return an iterator over inactive values (tile and voxel) across all nodes.
|
inline |
Return an iterator over inactive values (tile and voxel) across all nodes.
|
inline |
Return an iterator over active values (tile and voxel) across all nodes.
|
inline |
Return an iterator over active values (tile and voxel) across all nodes.
CIterT cbegin | ( | ) | const |
Return a const iterator of type CIterT (for example, cbegin<ValueOnCIter>() is equivalent to cbeginValueOn()).
|
inline |
|
inline |
Return an iterator over all leaf nodes in this tree.
|
inline |
Return an iterator over all nodes in this tree.
|
inline |
Return an iterator over children of the root node.
|
inline |
Return an iterator over all entries of the root node's table.
|
inline |
Return an iterator over non-child entries of the root node's table.
|
inline |
Return an iterator over all values (tile and voxel) across all nodes.
|
inline |
Return an iterator over inactive values (tile and voxel) across all nodes.
|
inline |
Return an iterator over active values (tile and voxel) across all nodes.
|
inline |
Remove all tiles from this tree and all nodes other than the root node.
|
inline |
Clear all registered accessors.
|
inline |
For a given function f
, use sparse traversal to compute f(this, other)
over all corresponding pairs of values (tile or voxel) of this tree and the other tree and store the result in this tree. This method is typically more space-efficient than the two-tree combine2(), since it moves rather than copies nodes from the other tree into this tree.
other | a tree of the same type as this tree |
op | a functor of the form void op(const T& a, const T& b, T& result) , where T is this tree's ValueType , that computes result = f(a, b) |
prune | if true, prune the resulting tree one branch at a time (this is usually more space-efficient than pruning the entire tree in one pass) |
aTree
and bTree
, and store the result in aTree
(leaving bTree
empty). f * a + (1 - f) * b
over all voxels of two floating-point trees, aTree
and bTree
, and store the result in aTree
(leaving bTree
empty).
|
inline |
|
inline |
For a given function f
, use sparse traversal to compute f(a, b)
over all corresponding pairs of values (tile or voxel) of trees A and B and store the result in this tree.
a,b | two trees of the same type |
op | a functor of the form void op(const T& a, const T& b, T& result) , where T is this tree's ValueType , that computes result = f(a, b) |
prune | if true, prune the resulting tree one branch at a time (this is usually more space-efficient than pruning the entire tree in one pass) |
aTree
and bTree
, and store the result in a third tree.
|
inline |
|
inline |
Like combine2(), but with
a,b | two trees of the same type |
op | a functor of the form void op(CombineArgs<ValueType>& args) that computes args.setResult(f(args.a(), args.b())) and, optionally, args.setResultIsActive(g(args.aIsActive(), args.bIsActive())) for some functions f and g |
prune | if true, prune the resulting tree one branch at a time (this is usually more space-efficient than pruning the entire tree in one pass) This variant passes not only the a and b values but also the active states of the a and b values to the functor, which may then return, by calling args.setResultIsActive() , a computed active state for the result value. By default, the result is active if either the a or the b value is active. |
aTree
and bTree
, and store the result in a third tree. Set the active state of each output value to that of the larger of the two input values.
|
inline |
|
inline |
Like combine(), but with
other | a tree of the same type as this tree |
op | a functor of the form void op(CombineArgs<ValueType>& args) that computes args.setResult(f(args.a(), args.b())) and, optionally, args.setResultIsActive(g(args.aIsActive(), args.bIsActive())) for some functions f and g |
prune | if true, prune the resulting tree one branch at a time (this is usually more space-efficient than pruning the entire tree in one pass) |
This variant passes not only the a and b values but also the active states of the a and b values to the functor, which may then return, by calling args.setResultIsActive()
, a computed active state for the result value. By default, the result is active if either the a or the b value is active.
aTree
with corresponding values from floating-point bTree
(leaving bTree
empty) wherever the bTree
values are larger. Also, preserve the active states of any transferred values.
|
inline |
|
inlinevirtual |
Return a pointer to a deep copy of this tree.
Implements TreeBase.
|
inline |
Return true
if this tree contains no nodes other than the root node and no tiles other than background tiles.
|
inlinevirtual |
Return in bbox the axis-aligned bounding box of all active voxels and tiles. This is a tighter bounding box than the leaf node bounding box.
false
if the bounding box is empty (in which case the bbox is set to its default value). Implements TreeBase.
|
inlinevirtual |
Return in dim the dimensions of the axis-aligned bounding box of all active voxels. This is a tighter bounding box than the leaf node bounding box.
false
if the bounding box is empty. Implements TreeBase.
|
inlinevirtual |
Return in bbox the axis-aligned bounding box of all leaf nodes.
false
if the bounding box is empty (in which case the bbox is set to its default value). Implements TreeBase.
|
inlinevirtual |
Return in dim the dimensions of the axis-aligned bounding box of all leaf nodes.
false
if the bounding box is empty. Implements TreeBase.
Return the minimum and maximum active values in this tree.
Set all voxels within a given axis-aligned box to a constant value. If necessary, subdivide tiles that intersect the box.
bbox | inclusive coordinates of opposite corners of an axis-aligned box |
value | the value to which to set voxels within the box |
active | if true, mark voxels within the box as active, otherwise mark them as inactive |
|
inline |
|
virtual |
Return this tree's background value wrapped as metadata.
Reimplemented from TreeBase.
|
inlinevirtual |
Min and max are both inclusive.
Implements TreeBase.
|
inlinestatic |
|
inline |
Return this tree's root node.
|
inline |
Return this tree's root node.
|
inline |
Return the value of the voxel at the given coordinates.
Return the value of the voxel at the given coordinates and update the given accessor's node cache.
|
inline |
|
inline |
Return the tree depth (0 = root) at which the value of voxel (x, y, z) resides.
If (x, y, z) isn't explicitly represented in the tree (i.e., it is implicitly a background voxel), return -1.
|
inline |
Return true
if this tree has any active tiles.
|
inline |
Return true
if the given tree has the same node and active value topology as this tree (but possibly a different ValueType
).
|
inlinevirtual |
Return the number of inactive voxels stored in leaf nodes.
Implements TreeBase.
|
virtual |
Return the number of inactive voxels within the bounding box of all active voxels.
Implements TreeBase.
|
inline |
Return true
if the value at the given coordinates is inactive.
|
inline |
Return true
if the value at the given coordinates is active.
|
inlinevirtual |
Return the number of leaf nodes.
Implements TreeBase.
|
inlinevirtual |
Return the total amount of memory in bytes occupied by this tree.
Reimplemented from TreeBase.
|
inline |
Move child nodes from the other tree into this tree wherever those nodes correspond to constant-value tiles in this tree, and replace leaf-level inactive voxels in this tree with corresponding voxels in the other tree that are active.
|
inlinevirtual |
Return the number of non-leaf nodes.
Implements TreeBase.
|
inline |
|
inline |
|
inlinevirtual |
Print statistics, memory usage and other information about this tree.
os | a stream to which to write textual information |
verboseLevel | 1: print tree configuration only; 2: include node and voxel statistics; 3: include memory usage |
Reimplemented from TreeBase.
|
inline |
|
inline |
Get the value of the voxel at the given coordinates.
true
if the value is active. 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.
|
inline |
Reduce the memory footprint of this tree by replacing with tiles of the given value any nodes whose values are all inactive.
|
inline |
Reduce the memory footprint of this tree by replacing with background tiles any nodes whose values are all inactive.
|
inline |
Prune any descendants whose values are all inactive and replace them with inactive tiles having a values equal to the first value encountered in the (inactive) child.
|
inline |
Call the PruneOp
functor for each non-root node in the tree. If the functor returns true
, prune the node and replace it with a tile.
This method is used to implement all of the various pruning algorithms (prune(), pruneInactive(), etc.). It should rarely be called directly.
PruneOp
functor
|
inlinevirtual |
Read all data buffers for this tree.
Implements TreeBase.
|
virtual |
Read the tree topology from a stream.
This will read the tree structure and tile values, but not voxel data.
Reimplemented from TreeBase.
|
inline |
Deregister an accessor so that it is no longer automatically cleared.
|
inline |
Deregister an accessor so that it is no longer automatically cleared.
|
inlineprotected |
Notify all registered accessors, by calling ValueAccessor::release(), that this tree is about to be deleted.
|
inline |
Set the active state of the voxel at the given coordinates, but don't change its value.
|
inline |
Replace this tree's background value.
Set the value of the voxel at the given coordinates and mark the voxel as active.
Set the value of the voxel at the given coordinates, mark the voxel as active, and update the given accessor's node cache.
|
inline |
Mark the voxel at the given coordinates as inactive, but don't change its value.
Change the value of the voxel at the given coordinates and mark the voxel as inactive.
|
inline |
Mark the voxel at the given coordinates as active, but don't change its value.
Set the value of the voxel at the given coordinates and mark the voxel as active.
Set the value of the voxel at the given coordinates but preserve it active state.
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.
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.
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.
|
inline |
Set the values of all inactive voxels and tiles of a narrow-band level set from the signs of the active voxels, setting outside values to +background and inside values to -background.
Set the values of all inactive voxels and tiles of a narrow-band level set from the signs of the active voxels, setting outside values to "outside" and inside values to "inside. The background value of the grid will be set to the "outside" value.
|
inline |
Union this tree's set of active values with the active values of the other tree, whose ValueType
may be different.
The resulting state of a value is active if the corresponding value was already active OR if it is active in the other tree. Also, a resulting value maps to a voxel if the corresponding value already mapped to a voxel OR if it is a voxel in the other tree. Thus, a resulting value can only map to a tile if the corresponding value already mapped to a tile AND if it is a tile value in other tree.
|
inline |
Use this method to preallocate a static tree topology over which to safely perform multithreaded processing.
|
inlinevirtual |
Return the depth of this tree.
A tree with only a root node and leaf nodes has depth 2, for example.
Implements TreeBase.
|
inlinestatic |
Return the name of this type of tree.
|
inlinevirtual |
Return the name of this type of tree.
Implements TreeBase.
|
inlinevirtual |
Return the name of the type of a voxel's value (e.g., "float" or "vec3d")
Implements TreeBase.
|
inline |
Traverse this tree in depth-first order, and at each node call the given functor with a DenseIterator
(see Iterator.h) that points to either a child node or a tile value. If the iterator points to a child node and the functor returns true, do not descend to the child node; instead, continue the traversal at the next iterator position.
op | a functor of the form template<typename IterT> bool op(IterT&) , where IterT is either a RootNode::ChildAllIter, an InternalNode::ChildAllIter or a LeafNode::ChildAllIter |
parent()
of a RootNode::ChildAllIter.
|
inline |
|
inline |
Like visit(), but using const
iterators, i.e., with
op | a functor of the form template<typename IterT> bool op(IterT&) , where IterT is either a RootNode::ChildAllCIter, an InternalNode::ChildAllCIter or a LeafNode::ChildAllCIter |
|
inline |
|
inline |
Traverse this tree and another tree in depth-first order, and for corresponding subregions of index space call the given functor with two DenseIterators
(see Iterator.h), each of which points to either a child node or a tile value of this tree and the other tree. If the A iterator points to a child node and the functor returns a nonzero value with bit 0 set (e.g., 1), do not descend to the child node; instead, continue the traversal at the next A iterator position. Similarly, if the B iterator points to a child node and the functor returns a value with bit 1 set (e.g., 2), continue the traversal at the next B iterator position.
ValueType
and a different topology. other | a tree of the same type as this tree |
op | a functor of the form template<class AIterT, class BIterT> int op(AIterT&, BIterT&) , where AIterT and BIterT are any combination of a RootNode::ChildAllIter, an InternalNode::ChildAllIter or a LeafNode::ChildAllIter with an OtherTreeType::RootNode::ChildAllIter , an OtherTreeType::InternalNode::ChildAllIter or an OtherTreeType::LeafNode::ChildAllIter |
aTree
and bTree
, replace leaf nodes of aTree
with corresponding leaf nodes of bTree
, leaving bTree
partially empty.
|
inline |
|
inline |
Like visit2(), but using const
iterators, i.e., with
other | a tree of the same type as this tree |
op | a functor of the form template<class AIterT, class BIterT> int op(AIterT&, BIterT&) , where AIterT and BIterT are any combination of a RootNode::ChildAllCIter, an InternalNode::ChildAllCIter or a LeafNode::ChildAllCIter with an OtherTreeType::RootNode::ChildAllCIter , an OtherTreeType::InternalNode::ChildAllCIter or an OtherTreeType::LeafNode::ChildAllCIter |
|
inline |
|
inline |
For a given function use sparse traversal to call it with bounding box information for all active tiles and leaf nodes or active voxels in the tree.
op | a template functor of the form template<Index LEVEL> void op(const CoordBBox& bbox) , where bbox defines the bbox of an active tile if LEVEL>0 , and else a LeafNode or active voxel. The functor must also provide a template method of the form template<Index LEVEL> bool descent() that returns false if no bboxes are to be derived below the templated tree level. In such cases of early tree termination a bbox is instead derived from each terminating child node. |
|
inline |
Turns active tiles into dense voxels, i.e. active leaf nodes.
|
inlinevirtual |
Write out all data buffers for this tree.
Implements TreeBase.
|
virtual |
Write the tree topology to a stream.
This will write the tree structure and tile values, but not voxel data.
Reimplemented from TreeBase.
|
static |
|
mutableprotected |
|
mutableprotected |
|
protected |