Bounding Boxes

Recommended Posts

I have an interesting problem and I hope someone can shed light on this.

A while ago I posted this oriented-bounding-box script on sideffects. It orients a bounding box along the "best" axes.

http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&p=88114&highlight=#88114

The problem is that it flips axes with animated objects and, being a statistical method, it can jitter or produce suboptimal results. (The Houdini bounding-box node suffers from the same problem by the way)

Does anybody know if there is an algorithm out there that produces better results?

I have a feeling the whole thing is connected to finding eigenvectors to get the "best" basis for a set of vectors but I am a bit out of my depth here.

Ideas welcome and rewarded with plenty of good karma!

Edited by Macha
Share on other sites

Hey Marc, I am not sure how to help you, but I wish I did. I will keep an eye on this thread though, because I want to see the answer to your problem. Sorry I can't help.

Share on other sites

perhaps you could implement a filtering method that samples over a relative frame range?

Share on other sites

Well, what I"ve tried so far is to attribute transfer a point id from a previous frame. That keeps point numbers constant. The axis still flip "behind the scenes" but I think I can extract a transform from this and drive another box with it. Need to test it though...

By the way, does anybody know how to extract rotation values from a matrix? I tried transform matrix vopsop but it gives no result. Very strange.

Edited by Macha
Share on other sites

...

By the way, does anybody know how to extract rotation values from a matrix?

...

believe it or not there is Extract Transform VOP

there you can extract translates, rotates or scales

Share on other sites

Yes Tomas, I believe you, I am not doubting, but I get strange results.

I have a rotating box. I choose a zero point (offset it to 0,0,0), and then 3 other points so that I get a representation of a coordinate system.

Say,

point 1: 0.3,0.5,0.3

point 2: 0.1,0.23,0.45

point 3: 0.11,0.34,0.34

(I made them up now but imagine they are orthonormal)

I then slot them into a matrix, each point for a column. That should give me a basis, right? And putting that into the extract-transform should give me rotation values. But it doesn't, so I"m going wrong somewhere...

believe it or not there is Extract Transform VOP

there you can extract translates, rotates or scales

Edited by Macha
Share on other sites

here is an example of Extract Transform VOP

Extract_euler_rotation.hip

Share on other sites

Thanks Anim, that"s great. Looks like I messed up something with my point numbers and looping thing.

(So...Houdini's vectors are rows, not columns?)

Edited by Macha
Share on other sites

...

(So...Houdini's vectors are rows, not columns?)

...

yes, that's right for transform matrices in Houdini

Share on other sites

The problem is that it flips axes with animated objects ...

So you need to define some sort of "up vector" like concept? How about orientating your axes such that the origin is the smallest OBB corner position and then sorting the vectors?

Share on other sites

yes, that's right for transform matrices in Houdini

Isn't it the same with Maya?

Share on other sites

It would be nice if Houdini had a simple VEX function, kind of like that in the Rivet Object, where you could supply 2 inputs of three points or a primitive and it would return to you the transform it takes to get to one from the other.

Share on other sites

Yes, something like that. Perhaps if the objects are clearly asymetrical on all axes they won't flip in the first place.

But for now the setup I made is working. The attribute-transfer-id and caluclating the rotation values from the new base seems to do what I had in mind. No flipping and oriented bounding. It just feels a bit of a hack.

So you need to define some sort of "up vector" like concept? How about orientating your axes such that the origin is the smallest OBB corner position and then sorting the vectors?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×