Jump to content

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
Link to comment
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
Link to comment
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
Link to comment
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?

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

Link to comment
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?

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...