Notifications
Clear all

[Closed] create an accurate bounding box

Hey very nice

I like the function to find the longest diagonal. Find the center, find the further point and find the further point again…

The only problem is the theory used here, it will choose always the longest diagonal. But i persist to think that could be a valid approach. Instead of orienting the box along the axis, we have just to orient his diagonal.
but it is probably not so simple lol

Haha, yea… the quest for the OBB. Its moved beyond my comprehension at this point I think. I suppose the only way I could think of doing it would be to have a set value of the amount of diagonals to calculate, sort of like a “threshold” value. Based on these diagonals we could probably run an axis through them, like you say arketip. Even if we have a set of diagonals to orient our “up” axis through, there’s still the matter of spinning the X and Y axes so that they fit as closely as possible to the selection. I’ll keep thinking… but I think this is a little out of my league mathematically.

i think this thread will be helpful . and the question looks same as urs . d3coy has a idea to do it with codes .
http://forums.cgsociety.org/showthread.php?t=417815
for one object , translate the object matrix back to world axis original . then use the .max .min to caculate the box .

same to the multi_objects , i have show some ideas of my about work with more objects . so if u have points position . u can make many sphere , with radius = 0 . pos = <vertex pos> and then collapse them into one object or just select them into one group . save the transform of the spheres obj, and then the question will turn into how to work with one objects .maybe make it easy to do .

so for the direction , if u get the spheres_obj , and translate its transform matrix into original . world axis , u can rotate it , then work with it . use .max .min .make a bounding box , then link the bounding box back to the sphere_obj or not, and give it the transform matrix backwards process , set it to the positions of the vertexs .

at last , delete the help 0 radius spheres .

 eek

Just thinking you could use the center of every 2 sided face (quad) instead of vert, or do a check for which is the longest either the center of the quad or the vert. Or even do three checks: get the farthest distance of the vertex, tri and quad – then just use the longest.

Hi guys Thx a lot for all your input.

I was away for work for sometime havent much time to get back here.
So I had to order a script from a third party.
I managed to have a script done to do thoses boxes. I’m sorry I can’t release it here as it’s integrated in a copyrighted script.

anyway the method used was taking the vertex cloud and rotated it from 0 to 90° by a step of n degree in the 3 axes.

for optimisation purpose the n step was 10° first then 2° around the best boxe found so far.

This gives nice and abbout fast results.

I was told a better (exact mathematicly) solution exist but this one is easy enough for my math level

the finding the best diagonal method looks pretty nice exercise.

Thx again evryone for your comments and contribution.

I’ll be back soon with more chalanging stuff =)

Page 2 / 2