Houdini's matrices and extracting trans,rot,scale
Mark Story
mstory at xion.org
Fri Oct 29 17:02:30 EDT 2004
Hi Drew,
Yes, I hadn't even considered the values returned would be in Euler
angles, it now makes (more) sense why it's not reflecting the same
values in the GUI. I was also making a mistake with the xformOrder, the
default order is different the default in the GUI, once I corrected
that, the numbers started to look better, but not exactly right.
I don't have a copy of Graphics Gems (I need to order it!), and I've
looked around on the web for some examples of the conversion process,
but haven't found much yet. Would you have an example or know where to
find one?
Thanks!!!!!!
--Mark
Drew Whitehouse wrote:
> This may be due to the fact that mathematically the mapping from
> matrices to euler angles isn't one to one. So even though the numbers
> are different they may still give you the same rotation, just one of the
> joys of euler angles I'm afraid. (btw: there is a good article on euler
> angles by Ken Shoemake in Graphics Gems IV)
>
> -Drew
>
> Mark Story wrote:
>
>> Wooops, I meant to say:
>>
>> current_input_xform =(UT_DMatrix4&)foo_node->getWorldTransform(context);
>>
>> int foo2 = current_input_xform.explode(xformOrder, rot, scale, trans);
>> *OR*
>> current_input_xform.getTranslates(trans);
>>
>> I know the rotation values returned are in radians, but what happens is
>> that when I enter various values in the object's rotation fields, and
>> then examine them using the code I sent they often don't match. For
>> example, here's a bunch rotation x,y,z values entered into the GUI
>> followed by the values returned from explode():
>>
>>
>> 45 0 0
>> rot.x: 45.0000012463633 rot.y: 0 rot.z: 0
>>
>> 90 0 0
>> rot.x: 90.00000249272661 rot.y: 0 rot.z: 0
>>
>> 91 0 0
>> rot.x: -269.000006312118 rot.y: 0 rot.z: 0
>>
>> 181 0 0 rot.x: -178.9999969892022 rot.y: 0 rot.z: 0
>>
>> 90 0 90
>> rot.x: 90.00000249272661 rot.y: 0 rot.z: 90.00000249272661
>>
>> 90 90 0
>> rot.x: 0 rot.y: 90.00000249272661 rot.z: -90.00000249272661
>>
>> 90 180 0
>> rot.x: 90.00000249272661 rot.y: 0 rot.z: 90.00000249272661
>>
>>
>> Freaky ....
>>
>>
>> --Mark
>>
>>
>>
More information about the Sidefx-devkit-list
mailing list