OpenVDB
12.0.0
|
#include <openvdb/tree/Tree.h>
Inherits TreeBase.
Classes | |
struct | DeallocateNodes |
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 | |
using | Ptr = SharedPtr< Tree > |
using | ConstPtr = SharedPtr< const Tree > |
using | RootNodeType = _RootNodeType |
using | ValueType = typename RootNodeType::ValueType |
using | BuildType = typename RootNodeType::BuildType |
using | LeafNodeType = typename RootNodeType::LeafNodeType |
using | Accessor = ValueAccessor< Tree, true > |
using | ConstAccessor = ValueAccessor< const Tree, true > |
using | UnsafeAccessor = ValueAccessor< Tree, false > |
using | ConstUnsafeAccessor = ValueAccessor< const Tree, false > |
using | ValueAllIter = TreeValueIteratorBase< Tree, typename RootNodeType::ValueAllIter > |
using | ValueAllCIter = TreeValueIteratorBase< const Tree, typename RootNodeType::ValueAllCIter > |
using | ValueOnIter = TreeValueIteratorBase< Tree, typename RootNodeType::ValueOnIter > |
using | ValueOnCIter = TreeValueIteratorBase< const Tree, typename RootNodeType::ValueOnCIter > |
using | ValueOffIter = TreeValueIteratorBase< Tree, typename RootNodeType::ValueOffIter > |
using | ValueOffCIter = TreeValueIteratorBase< const Tree, typename RootNodeType::ValueOffCIter > |
using | NodeIter = NodeIteratorBase< Tree, typename RootNodeType::ChildOnIter > |
Iterator over all nodes in this tree. More... | |
using | NodeCIter = NodeIteratorBase< const Tree, typename RootNodeType::ChildOnCIter > |
Iterator over all nodes in this tree. More... | |
using | LeafIter = LeafIteratorBase< Tree, typename RootNodeType::ChildOnIter > |
Iterator over all leaf nodes in this tree. More... | |
using | LeafCIter = LeafIteratorBase< const Tree, typename RootNodeType::ChildOnCIter > |
Iterator over all leaf nodes in this tree. More... | |
Public Member Functions | |
Tree () | |
Tree & | operator= (const Tree &)=delete |
Tree (const Tree &other) | |
Deep copy constructor. More... | |
template<typename OtherRootType > | |
Tree (const Tree< OtherRootType > &other) | |
Value conversion 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... | |
~Tree () override | |
TreeBase::Ptr | copy () const override |
Return a pointer to a deep copy of this tree. More... | |
Name | valueType () const override |
Return the name of the type of a voxel's value (e.g., "float" or "vec3d") More... | |
const Name & | type () const override |
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, whether or not it has the same ValueType . More... | |
bool | evalLeafBoundingBox (CoordBBox &bbox) const override |
Return in bbox the axis-aligned bounding box of all active tiles and leaf nodes with active values. More... | |
bool | evalActiveVoxelBoundingBox (CoordBBox &bbox) const override |
Return in bbox the axis-aligned bounding box of all active voxels and tiles. More... | |
bool | evalActiveVoxelDim (Coord &dim) const override |
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... | |
bool | evalLeafDim (Coord &dim) const override |
Return in dim the dimensions of the axis-aligned bounding box of all leaf nodes. More... | |
void | readTopology (std::istream &, bool saveFloatAsHalf=false) override |
Read the tree topology from a stream. More... | |
void | writeTopology (std::ostream &, bool saveFloatAsHalf=false) const override |
Write the tree topology to a stream. More... | |
void | readBuffers (std::istream &, bool saveFloatAsHalf=false) override |
Read all data buffers for this tree. More... | |
void | readBuffers (std::istream &, const CoordBBox &, bool saveFloatAsHalf=false) override |
Read all of this tree's data buffers that intersect the given bounding box. More... | |
void | readNonresidentBuffers () const override |
Read all of this tree's data buffers that are not yet resident in memory (because delayed loading is in effect). More... | |
void | writeBuffers (std::ostream &, bool saveFloatAsHalf=false) const override |
Write out all data buffers for this tree. More... | |
void | print (std::ostream &os=std::cout, int verboseLevel=1) const override |
Print statistics, memory usage and other information about this tree. More... | |
Index | treeDepth () const override |
Return the depth of this tree. More... | |
Index64 | leafCount () const override |
Return the number of leaf nodes. More... | |
std::vector< Index64 > | nodeCount () const override |
Index64 | nonLeafCount () const override |
Return the number of non-leaf nodes. More... | |
Index64 | activeLeafVoxelCount () const override |
Return the number of active voxels stored in leaf nodes. More... | |
Index64 | inactiveLeafVoxelCount () const override |
Return the number of inactive voxels stored in leaf nodes. More... | |
Index64 | activeVoxelCount () const override |
Return the total number of active voxels. More... | |
Index64 | inactiveVoxelCount () const override |
Return the number of inactive voxels within the bounding box of all active voxels. More... | |
Index64 | activeTileCount () const override |
Return the total number of active tiles. More... | |
void | evalMinMax (ValueType &min, ValueType &max) const |
Return the minimum and maximum active values in this tree. More... | |
Index64 | memUsage () const override |
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 | setActiveState (const Coord &xyz, bool on) |
Set the active state of the voxel at the given coordinates but don't change its value. More... | |
void | setValueOnly (const Coord &xyz, const ValueType &value) |
Set the value of the voxel at the given coordinates but don't change its active state. 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 | setValue (const Coord &xyz, const ValueType &value) |
Set the value of the voxel at the given coordinates and mark the voxel as active. 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 | 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) |
Set the value of the voxel at the given coordinates and mark the voxel as inactive. More... | |
template<typename ModifyOp > | |
void | modifyValue (const Coord &xyz, const ModifyOp &op) |
Apply a functor to the value of the voxel at the given coordinates and mark the voxel as active. More... | |
template<typename ModifyOp > | |
void | modifyValueAndActiveState (const Coord &xyz, const ModifyOp &op) |
Apply a functor to the voxel at the given coordinates. 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 | clip (const CoordBBox &) |
Set all voxels that lie outside the given axis-aligned box to the background. More... | |
void | clipUnallocatedNodes () override |
Replace with background tiles any nodes whose voxel buffers have not yet been allocated. More... | |
Index64 | unallocatedLeafCount () const override |
Return the total number of unallocated leaf nodes residing in this tree. More... | |
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. More... | |
void | voxelizeActiveTiles (bool threaded=true) |
Densify active tiles, i.e., replace them with leaf-level active voxels. More... | |
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 | addLeaf (LeafNodeType *leaf) |
Add the given leaf node to this tree, creating a new branch if necessary. If a leaf node with the same origin already exists, replace it. More... | |
void | addTile (Index level, const Coord &xyz, const ValueType &value, bool active) |
Add a tile containing voxel (x, y, z) at the specified tree level, creating a new branch if necessary. Delete any existing lower-level nodes that contain (x, y, z). More... | |
template<typename NodeT > | |
NodeT * | stealNode (const Coord &xyz, const ValueType &value, bool active) |
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 . More... | |
LeafNodeType * | touchLeaf (const Coord &xyz) |
Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, create one that preserves the values and active states of all voxels. More... | |
template<typename ArrayT > | |
void | stealNodes (ArrayT &array) |
Steals all nodes of a certain type from the tree and adds them to a container with the following API: More... | |
template<typename ArrayT > | |
void | stealNodes (ArrayT &array, const ValueType &value, bool state) |
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... | |
Accessor | getAccessor () |
Return an accessor that provides random read and write access to this tree's voxels. More... | |
UnsafeAccessor | getUnsafeAccessor () |
Return an unsafe accessor that provides random read and write access to this tree's voxels. More... | |
ConstAccessor | getAccessor () const |
Return an accessor that provides random read-only access to this tree's voxels. More... | |
ConstAccessor | getConstAccessor () const |
Return an accessor that provides random read-only access to this tree's voxels. More... | |
ConstUnsafeAccessor | getConstUnsafeAccessor () |
Return an unsafe accessor that provides random read-only access to this tree's voxels. More... | |
void | clearAllAccessors () |
Clear all registered accessors. More... | |
Metadata::Ptr | getBackgroundValue () const override |
Return this tree's background value wrapped as metadata. More... | |
const ValueType & | background () const |
Return this tree's background value. More... | |
void | getIndexRange (CoordBBox &bbox) const override |
Min and max are both inclusive. More... | |
void | merge (Tree &other, MergePolicy=MERGE_ACTIVE_STATES) |
Efficiently merge another tree into this tree using one of several schemes. More... | |
template<typename OtherRootNodeType > | |
void | topologyUnion (const Tree< OtherRootNodeType > &other, const bool preserveTiles=false) |
Union this tree's set of active values with the active values of the other tree, whose ValueType may be different. More... | |
template<typename OtherRootNodeType > | |
void | topologyIntersection (const Tree< OtherRootNodeType > &other) |
Intersects this tree's set of active values with the active values of the other tree, whose ValueType may be different. More... | |
template<typename OtherRootNodeType > | |
void | topologyDifference (const Tree< OtherRootNodeType > &other) |
Difference this tree's set of active values with the active values of the other tree, whose ValueType may be different. So a resulting voxel will be active only if the original voxel is active in this tree and inactive in the other tree. 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 , typename OtherTreeType > | |
void | combine2 (const Tree &a, const OtherTreeType &b, CombineOp &op, bool prune=false) |
template<typename CombineOp , typename OtherTreeType > | |
void | combine2 (const Tree &a, const OtherTreeType &b, const CombineOp &op, bool prune=false) |
template<typename ExtendedCombineOp , typename OtherTreeType > | |
void | combine2Extended (const Tree &a, const OtherTreeType &b, ExtendedCombineOp &op, bool prune=false) |
template<typename ExtendedCombineOp , typename OtherTreeType > | |
void | combine2Extended (const Tree &a, const OtherTreeType &b, const ExtendedCombineOp &, bool prune=false) |
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 |
template<typename TreeType > | |
bool | isType () const |
Return true if this tree is of the same type as the template parameter. More... | |
RootNodeType & | root () |
Return this tree's root node. More... | |
const RootNodeType & | root () const |
Return this tree's root node. More... | |
void | sparseFill (const CoordBBox &bbox, const ValueType &value, bool active=true) |
Set all voxels within a given axis-aligned box to a constant value. 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. More... | |
template<typename NodeType > | |
NodeType * | probeNode (const Coord &xyz) |
Return a pointer to the node of type NodeType that contains voxel (x, y, z). If no such node exists, return nullptr . More... | |
template<typename NodeType > | |
const NodeType * | probeConstNode (const Coord &xyz) const |
Return a pointer to the node of type NodeType that contains voxel (x, y, z). If no such node exists, return nullptr . More... | |
template<typename NodeType > | |
const NodeType * | probeNode (const Coord &xyz) const |
Return a pointer to the node of type NodeType that contains voxel (x, y, z). If no such node exists, return nullptr . More... | |
LeafNodeType * | probeLeaf (const Coord &xyz) |
Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, return nullptr . More... | |
const LeafNodeType * | probeConstLeaf (const Coord &xyz) const |
Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, return nullptr . More... | |
const LeafNodeType * | probeLeaf (const Coord &xyz) const |
Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, return nullptr . More... | |
template<typename ArrayT > | |
void | getNodes (ArrayT &array) |
Adds all nodes of a certain type to a container with the following API: More... | |
template<typename ArrayT > | |
void | getNodes (ArrayT &array) const |
Adds all nodes of a certain type to a container with the following API: More... | |
void | attachAccessor (ValueAccessorBase< Tree, true > &) 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, true > &) 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< Tree, false > &) const |
Dummy implementations. More... | |
void | attachAccessor (ValueAccessorBase< const Tree, false > &) const |
Dummy implementations. More... | |
void | releaseAccessor (ValueAccessorBase< Tree, true > &) const |
Deregister an accessor so that it is no longer automatically cleared. More... | |
void | releaseAccessor (ValueAccessorBase< const Tree, true > &) const |
Deregister an accessor so that it is no longer automatically cleared. More... | |
void | releaseAccessor (ValueAccessorBase< Tree, false > &) const |
Dummy implementations. More... | |
void | releaseAccessor (ValueAccessorBase< const Tree, false > &) const |
Dummy implementations. 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 | |
using | AccessorRegistry = tbb::concurrent_hash_map< ValueAccessorBase< Tree, true > *, bool > |
using | ConstAccessorRegistry = tbb::concurrent_hash_map< ValueAccessorBase< const Tree, true > *, bool > |
Protected Member Functions | |
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 |
using Accessor = ValueAccessor<Tree, true> |
|
protected |
using BuildType = typename RootNodeType::BuildType |
using ConstAccessor = ValueAccessor<const Tree, true> |
|
protected |
using ConstUnsafeAccessor = ValueAccessor<const Tree, false> |
using LeafCIter = LeafIteratorBase<const Tree, typename RootNodeType::ChildOnCIter> |
Iterator over all leaf nodes in this tree.
using LeafIter = LeafIteratorBase<Tree, typename RootNodeType::ChildOnIter> |
Iterator over all leaf nodes in this tree.
using LeafNodeType = typename RootNodeType::LeafNodeType |
using NodeCIter = NodeIteratorBase<const Tree, typename RootNodeType::ChildOnCIter> |
Iterator over all nodes in this tree.
using NodeIter = NodeIteratorBase<Tree, typename RootNodeType::ChildOnIter> |
Iterator over all nodes in this tree.
using RootNodeType = _RootNodeType |
using UnsafeAccessor = ValueAccessor<Tree, false> |
using ValueAllCIter = TreeValueIteratorBase<const Tree, typename RootNodeType::ValueAllCIter> |
using ValueAllIter = TreeValueIteratorBase<Tree, typename RootNodeType::ValueAllIter> |
using ValueOffCIter = TreeValueIteratorBase<const Tree, typename RootNodeType::ValueOffCIter> |
using ValueOffIter = TreeValueIteratorBase<Tree, typename RootNodeType::ValueOffIter> |
using ValueOnCIter = TreeValueIteratorBase<const Tree, typename RootNodeType::ValueOnCIter> |
using ValueOnIter = TreeValueIteratorBase<Tree, typename RootNodeType::ValueOnIter> |
using ValueType = typename RootNodeType::ValueType |
|
inline |
Value conversion deep copy constructor.
Deep copy a tree of the same configuration as this tree type but a different ValueType, casting the other tree's values to this tree's ValueType.
TypeError | if the other tree's configuration doesn't match this tree's or if this tree's ValueType is not constructible from the other tree's ValueType. |
|
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 |
TypeError | if the other tree's configuration doesn't match this tree's. |
|
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 |
TypeError | if the other tree's configuration doesn't match this tree's. |
|
inlineoverride |
|
inlineoverridevirtual |
Return the number of active voxels stored in leaf nodes.
Implements TreeBase.
|
inlineoverridevirtual |
Return the total number of active tiles.
Implements TreeBase.
|
inlineoverridevirtual |
Return the total number of active voxels.
Implements TreeBase.
|
inline |
Add the given leaf node to this tree, creating a new branch if necessary. If a leaf node with the same origin already exists, replace it.
Add a tile containing voxel (x, y, z) at the specified tree level, creating a new branch if necessary. Delete any existing lower-level nodes that contain (x, y, z).
|
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 |
Dummy implementations.
|
inline |
Dummy implementations.
|
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 |
Set all voxels that lie outside the given axis-aligned box to the background.
|
inlineoverridevirtual |
Replace with background tiles any nodes whose voxel buffers have not yet been allocated.
Typically, unallocated nodes are leaf nodes whose voxel buffers are not yet resident in memory because delayed loading is in effect.
Implements TreeBase.
|
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 with the same configuration (levels and node dimensions) as this tree but with the B tree possibly having a different value type |
op | a functor of the form void op(const T1& a, const T2& b, T1& result) , where T1 is this tree's and the A tree's ValueType and T2 is the B 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) |
TypeError | if the B tree's configuration doesn't match this tree's or if this tree's ValueType is not constructible from the B tree's ValueType. |
aTree
and bTree
, and store the result in a third tree.
|
inline |
|
inline |
Like combine2(), but with
a,b | two trees with the same configuration (levels and node dimensions) as this tree but with the B tree possibly having a different value type |
op | a functor of the form void op(CombineArgs<T1, T2>& args) , where T1 is this tree's and the A tree's ValueType and T2 is the B tree's ValueType , 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. |
TypeError | if the B tree's configuration doesn't match this tree's or if this tree's ValueType is not constructible from the B tree's ValueType. |
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. aTree
and bTree
, and store the result in a third, double-precision 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 |
|
inlineoverridevirtual |
Return a pointer to a deep copy of this tree.
Implements TreeBase.
|
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.
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 |
Return true
if this tree contains no nodes other than the root node and no tiles other than background tiles.
|
inlineoverridevirtual |
Return in bbox the axis-aligned bounding box of all active voxels and tiles.
This method produces a more accurate, i.e. tighter, bounding box than evalLeafBoundingBox which is approximate but faster.
false
if the bounding box is empty (in which case the bbox is set to its default value). Implements TreeBase.
|
inlineoverridevirtual |
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.
|
inlineoverridevirtual |
Return in bbox the axis-aligned bounding box of all active tiles and leaf nodes with active values.
This is faster than calling evalActiveVoxelBoundingBox, which visits the individual active voxels, and hence evalLeafBoundingBox produces a less tight, i.e. approximate, bbox.
false
if the bounding box is empty (in which case the bbox is set to its default value). Implements TreeBase.
|
inlineoverridevirtual |
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.
|
inline |
Set all voxels within a given axis-aligned box to a constant value.
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 |
Tree< RootNodeType >::Accessor getAccessor | ( | ) |
Return an accessor that provides random read and write access to this tree's voxels.
The accessor is safe in the sense that it is registered with this tree.
Tree< RootNodeType >::ConstAccessor getAccessor | ( | ) | const |
Return an accessor that provides random read-only access to this tree's voxels.
|
overridevirtual |
Return this tree's background value wrapped as metadata.
Reimplemented from TreeBase.
Tree< RootNodeType >::ConstAccessor getConstAccessor | ( | ) | const |
Return an accessor that provides random read-only access to this tree's voxels.
Tree< RootNodeType >::ConstUnsafeAccessor getConstUnsafeAccessor | ( | ) |
Return an unsafe accessor that provides random read-only access to this tree's voxels.
The accessor is unsafe in the sense that it is not registered with this tree. In some rare cases this can give a performance advantage over a registered accessor, but it is unsafe if the tree topology is modified.
|
inlineoverridevirtual |
Min and max are both inclusive.
Implements TreeBase.
|
inlinestatic |
|
inline |
Adds all nodes of a certain type to a container with the following API:
An example of a wrapper around a c-style array is:
An example that constructs a list of pointer to all leaf nodes is:
|
inline |
Adds all nodes of a certain type to a container with the following API:
An example of a wrapper around a c-style array is:
An example that constructs a list of pointer to all leaf nodes is:
Tree< RootNodeType >::UnsafeAccessor getUnsafeAccessor | ( | ) |
Return an unsafe accessor that provides random read and write access to this tree's voxels.
The accessor is unsafe in the sense that it is not registered with this tree's tree. In some rare cases this can give a performance advantage over a registered accessor, but it is unsafe if the tree topology is modified.
|
inline |
Return the value of the voxel at the given coordinates.
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.
|
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, whether or not it has the same ValueType
.
|
inlineoverridevirtual |
Return the number of inactive voxels stored in leaf nodes.
Implements TreeBase.
|
inlineoverridevirtual |
Return the number of inactive voxels within the bounding box of all active voxels.
Implements TreeBase.
|
inlineinherited |
Return true
if this tree is of the same type as the template parameter.
|
inline |
Return true
if the value at the given coordinates is inactive.
|
inline |
Return true
if the value at the given coordinates is active.
|
inlineoverridevirtual |
Return the number of leaf nodes.
Implements TreeBase.
|
inlineoverridevirtual |
Return the total amount of memory in bytes occupied by this tree.
Reimplemented from TreeBase.
|
inline |
Efficiently merge another tree into this tree using one of several schemes.
This operation is primarily intended to combine trees that are mostly non-overlapping (for example, intermediate trees from computations that are parallelized across disjoint regions of space).
|
inline |
Apply a functor to the value of the voxel at the given coordinates and mark the voxel as active.
Provided that the functor can be inlined, this is typically significantly faster than calling getValue() followed by setValueOn().
xyz | the coordinates of a voxel whose value is to be modified |
op | a functor of the form void op(ValueType&) const that modifies its argument in place |
|
inline |
Apply a functor to the voxel at the given coordinates.
Provided that the functor can be inlined, this is typically significantly faster than calling getValue() followed by setValue().
xyz | the coordinates of a voxel to be modified |
op | a functor of the form void op(ValueType&, bool&) const that modifies its arguments, a voxel's value and active state, in place |
|
inlineoverridevirtual |
Return a vector with node counts. The number of nodes of type NodeType is given as element NodeType::LEVEL in the return vector. Thus, the size of this vector corresponds to the height (or depth) of this tree.
Implements TreeBase.
|
inlineoverridevirtual |
Return the number of non-leaf nodes.
Implements TreeBase.
|
inline |
|
inline |
|
inlineoverridevirtual |
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; 4: include minimum and maximum voxel values |
Reimplemented from TreeBase.
|
inline |
Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, return nullptr
.
|
inline |
Return a pointer to the node of type NodeType
that contains voxel (x, y, z). If no such node exists, return nullptr
.
|
inline |
Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, return nullptr
.
|
inline |
Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, return nullptr
.
|
inline |
Return a pointer to the node of type NodeType
that contains voxel (x, y, z). If no such node exists, return nullptr
.
|
inline |
Return a pointer to the node of type NodeType
that contains voxel (x, y, z). If no such node exists, return nullptr
.
|
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.
|
inlineoverridevirtual |
Read all data buffers for this tree.
Implements TreeBase.
|
inlineoverridevirtual |
Read all of this tree's data buffers that intersect the given bounding box.
Implements TreeBase.
|
inlineoverridevirtual |
Read all of this tree's data buffers that are not yet resident in memory (because delayed loading is in effect).
If this tree was read from a memory-mapped file, this operation disconnects the tree from the file.
Implements TreeBase.
|
overridevirtual |
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.
|
inline |
Dummy implementations.
|
inline |
Dummy implementations.
|
inlineprotected |
Notify all registered accessors, by calling ValueAccessor::release(), that this tree is about to be deleted.
|
inline |
Return this tree's root node.
|
inline |
Return this tree's root node.
|
inline |
Set the active state of the voxel at the given coordinates but don't change its value.
|
inline |
Set the value of the voxel at the given coordinates and mark the voxel as active.
|
inline |
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.
|
inline |
Set 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.
|
inline |
Set the value of the voxel at the given coordinates and mark the voxel as active.
|
inline |
Set the value of the voxel at the given coordinates but don't change its active state.
|
inline |
Set all voxels within a given axis-aligned box to a constant value.
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 |
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
.
|
inline |
Steals all nodes of a certain type from the tree and adds them to a container with the following API:
An example of a wrapper around a c-style array is:
An example that constructs a list of pointer to all leaf nodes is:
|
inline |
|
inline |
Difference this tree's set of active values with the active values of the other tree, whose ValueType
may be different. So a resulting voxel will be active only if the original voxel is active in this tree and inactive in the other tree.
|
inline |
Intersects this tree's set of active values with the active values of the other tree, whose ValueType
may be different.
The resulting state of a value is active only if the corresponding value was already active AND if it is active in the other tree. Also, a resulting value maps to a voxel if the corresponding value already mapped to an active voxel in either of the two grids and it maps to an active tile or voxel in the other grid.
|
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 |
Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, create one that preserves the values and active states of all voxels.
Use this method to preallocate a static tree topology over which to safely perform multithreaded processing.
|
inlineoverridevirtual |
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.
|
inlineoverridevirtual |
Return the name of this type of tree.
Implements TreeBase.
|
inlineoverridevirtual |
Return the total number of unallocated leaf nodes residing in this tree.
Implements TreeBase.
|
inlineoverridevirtual |
Return the name of the type of a voxel's value (e.g., "float" or "vec3d")
Implements TreeBase.
|
inline |
Densify active tiles, i.e., replace them with leaf-level active voxels.
threaded | if true, this operation is multi-threaded (over the internal nodes). |
|
inlineoverridevirtual |
Write out all data buffers for this tree.
Implements TreeBase.
|
overridevirtual |
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 |