Skip to content

openvdb::tools::foreach iterating through all the voxels in each leaf #1540

Answered by Idclip
drperpen asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @drperpen,

When you say "a triple loop" I assume you're looping over a rectangular domain in the form:

for (int x = minx; x < maxx; ++x)
  for (int y = miny; y < maxy; ++y)
    for (int z = minz; z < maxz; ++z)
      // acc.setValue() ?

If you're then using accessor methods like setValue() then this may produce different behaviour to your ::foreach example. Importantly the ::foreach solution will not modify the volumes topology where as the loop solution will be a) implicitly creating new nodes if they didn't previously exist at the location (x,y,z) and b) densifying tiles to leaf nodes which, from the looks of things, is unnecessary in this case. I'm not sure how you're visualizing th…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@drperpen
Comment options

Answer selected by drperpen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants