Find tile bounding box?

121 views
Skip to first unread message

David Hahn

unread,
May 27, 2014, 3:02:14 AM5/27/14
to openvd...@googlegroups.com

Hi!
 
I was wondering what is the fastest way of finding a tile's bounding box given some Coord ijk within the tile (and hence knowing its value-depth)?
 
Atm I'm using probeNode and getNodeBoundingBox but that seems to be problematic as sometimes the node needs to be created first (tile value stored in the parent node?).
 
Also I'd like to have a generic way of doing this, without assuming the tree-configuration first.
 
Best,
David

edward

unread,
May 28, 2014, 7:28:20 PM5/28/14
to openvd...@googlegroups.com
The tile's bbox (and whether the coord is in a leaf or tile) is dependent on the tree itself, so you can only calculate this given a tree. The openvdb/tools/MeshToVolume.h has a code snippet which does this but I'm on my iPad right now but hopefully this at least gives you a hint.

Best Regards,
-Edward

edward

unread,
May 28, 2014, 7:44:10 PM5/28/14
to openvd...@googlegroups.com
PS. In particular, look at how "mStepSize" is computed which can be then used to determine the bbox when acc.probeConstLeaf() returns NULL. Then you know you're at a tile, and thus can index into mStepSize using acc.getValueDepth(). I also suggest that you read the OpenVDB paper to understand what "mStepSize" represents.

Ken Museth

unread,
May 28, 2014, 7:50:17 PM5/28/14
to openvd...@googlegroups.com
Hi David,

This code produces the bounding box of a (virtual) tile of type NodeT that contains the Coord ijk:

CoordBBox
::createCube(ijk & ~(NodeT::DIM-1), NodeT::DIM);

Is this what you're looking for? Clearly this approach does not check if the tile in question actually
exists in any tree. To do that you can use probeConstNode which is guaranteed to not modify the tree - a
return value of NULL means the tile (or node) does not exist.

Cheers,
Ken


Ken Museth

unread,
May 28, 2014, 7:55:46 PM5/28/14
to openvd...@googlegroups.com
Sorry Edward - I forgot to refresh my browser before I responded :) Your reply is probably more relevant then mine.

-Ken

David Hahn

unread,
Jun 2, 2014, 6:23:17 AM6/2/14
to openvd...@googlegroups.com
Thanks guys!
Reply all
Reply to author
Forward
0 new messages