Closed YoshuaNava closed 8 months ago
Hi @YoshuaNava, the decision was made early in the design of VDB to not store bi-directional pointers. Although there are some small memory benefits, this is mainly because any topology-changing operation would otherwise require additional bookkeeping work that we want to avoid.
Instead, we provide bottom-up traversal using the NodeManager which also offers parallel access to the nodes at each level of the tree:
With an example of doing this being the pruning tools:
https://github.com/AcademySoftwareFoundation/openvdb/blob/master/openvdb/openvdb/tools/Prune.h
In all cases where an algorithm has needed the access pattern you describe, we've been able to re-engineer it to use an alternative approach like that provided by foreachBottomUp()
.
@danrbailey Thank you very much for the prompt reply. From our development team, we appreciate it a lot :pray:
Is your feature request related to a problem? Please describe.
The OpenVDB library provides functions to traverse the tree from top to bottom, through leafs, through active nodes, etc.
However, it doesn't seem to provide any primitives that, given a voxel or a leaf node, allow you to traverse the tree up to the root. This would be very useful to propagate value updates from denser storage units to sparser ones.
Describe the solution you'd like
Functions that allow you to either:
Describe alternatives you've considered
Searching for the parent of a node using its Indices (integer coordinates). But this is inefficient, because it requires a search for each level we go up.
Additional context
I would warmly value feedback on the idea of having pointers to parent in the Tree. I would be happy to implement this feature and share it with the community if it's seen positively.