# Loose octrees

This topic is 3267 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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?

##### Share on other sites
Quote:
 Original post by johnstanpCan 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:

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 &&

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]

##### Share on other sites
Thank you Deliverance for your time...
I didn't take the time to read if someone actually posted an answer, because I found it.

1. 1
2. 2
Rutin
20
3. 3
A4L
15
4. 4
5. 5
khawk
14

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633739
• Total Posts
3013619
×