Jump to content
  • Advertisement
Sign in to follow this  
johnstanp

Loose octrees

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
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]

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!