Loose octrees

Started by
1 comment, last by johnstanp 14 years, 3 months ago
Can somebody provide the formula to compute the depth level at which a bounding sphere can be inserted in a octree and the indices of the child octree in its parent's array?
Advertisement
Quote:Original post by johnstanp
Can somebody provide the formula to compute the depth level at which a bounding sphere can be inserted in a octree and the indices of the child octree in its parent's array?


Assuming w,h,d are the width, depth and height of the initial node, you have to minimize the following values: wi,hi, di, which represent the dimensions of the node you are seeking:

wi>=radius && hi>=radius && di>=radius

The dimensions for the nodes are calculated like this like this:

wi >= w / 2^depth, for depth=0 we can see that we are at the root, so

w / 2^depth >= radius &&
h / 2^depth >= radius &&
d / 2^depth >= radius

You must observe that if a is the minimum of w,h,d you only need a's corresponding relation to be satisfied, the other two will be satisfied automatically so we have:

a / 2^depth >= radius , we need the depth from here, so we have:

a >= radius * 2^depth so depthReal >= log2(a/radius) = log2(min(w,h,d)/radius). But we need an integer value, it will suffice to take the supperior integer part of depthReal and we have the needed solution.

As for the indicies you need to provide further clarifications of how you store the octree...

Hope this helps!

[Edited by - Deliverance on January 1, 2010 10:12:07 AM]
Thank you Deliverance for your time...
I didn't take the time to read if someone actually posted an answer, because I found it.

This topic is closed to new replies.

Advertisement