#### Archived

This topic is now archived and is closed to further replies.

# OBB tree problem

## Recommended Posts

bah    100
Hi, I have a group of objects stored in a tree (with an arbitrary number of children per node) and I am trying to write a function that calculates every node''s oriented bounding box so that it encloses that node''s polygonal mesh as well as those of its offspring. I just need to calculate the minima and maxima of every child and compare them with that of the parent but I just can''t get my head around (probably because of the recursive nature of the algorithm, even though I''ve done it before with other tree functions). Any help would be greatly appreciated P.S: Initially, I posted this message to the Beginner''s forum but after I did search on OBB I decided to post it here as well.

##### Share on other sites
Karg    133
This may get a bit technical, and it assumes that you are finding eigenvectors to create your OBB:

For the leaf nodes, compute the covariance matrix of the points (just sum(point_i * transpose(point_i)) )
Find the eigenvectors and create the bounding box.

For the internal nodes, add up the already computed covariance matrices of it's imediate children.
Find the eighnvectors and create the bounding box.

karg

[Edit: actually not as technical as I first thought, just need to be able to compute eigenvectors]

[edited by - Karg on May 26, 2004 5:51:53 PM]