Sign in to follow this  
johnstanp

Loose octrees

Recommended Posts

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this