[Closed] oriented bounding box (obb) and coordsys
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
you could temporary reset the rotationpart of the transform matrix of the object.
read the min max values and restore the transformation …
Georg
prettyPixel, as you might have guessed, i’ve been running into the same problem
haven’t found a solution yet…
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
sorry that is not right …
Georg
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