PDA

View Full Version : oriented bounding box (obb) and coordsys


prettyPixel
09-22-2005, 10:42 AM
I search the bounding box size of an object

myBox=box width:100 length:20 height:20
myBox.max-myBox.min
--> return [100,20,20]
Ok the size is correct


rotate myBox (angleaxis 45 [0,0,1])
myBox.max-myBox.min
--> return [84.8528,84.8528,20]
In world coordinates, the bb size is correct too


(in coordsys local myBox.max) - (in coordsys local myBox.min)
--> return [120,0,20]
Here is the problem. Why it doesn't return [100,20,20] ?
And How to make to have this size ?

has any one in a similar situation come to a solution? thanks

rdg
09-22-2005, 11:03 AM
you could temporary reset the rotationpart of the transform matrix of the object.
read the min max values and restore the transformation ...

Georg

Aearon
09-22-2005, 11:08 AM
prettyPixel, as you might have guessed, i've been running into the same problem ;)

haven't found a solution yet..

rdg
09-22-2005, 11:27 AM
myBox=box width:100 length:20 height:20
myBox.max-myBox.min
rotate myBox (angleaxis 45 [0,1,1])
myBox.max-myBox.min
myStoredTransform=myBox.transform
unrotatedTransform=copy myStoredTransform
rotate myBox -unrotatedTransform.rotationpart
myBox.max-myBox.min
rotate myBox unrotatedTransform.rotationpart

http://forums.cgsociety.org/images/icons/icon9.gif sorry that is not right ...

Georg

prettyPixel
09-22-2005, 11:36 AM
rdg: Your solution is pretty artfull ;)
rotMyBox=myBox.rotation
myBox.rotation=quat 0 0 1 0
myBox.max-myBox.min
--> return [100,20,20]
myBox.rotation=rotMyBox

aearon: I am sure that somebody knows the solution...
In vertex context, 'coordsys local' give the correct result.

well Does somebody know the way of using coordsys?

EDIT:language confusion sorry rdg ;)

CGTalk Moderation
09-22-2005, 11:36 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.