Hello!
I have a rotation matrix that is from a right-handed Z-up coordinate system. I am having no luck converting it into rotation angles that are usable in Houdini via Python.
What I need to know is how to convert the Matrix3 to left-handed Y-up (what I believe Houdini uses).
I'm thinking that after that I should transpose the matrix, convert it to Quaternion, then use extractEulerRotates() to get my rotation angles. Is that also correct?
When I try to reverse engineer the process by converting a scene object's Euler rotations into Quaternion and then into a rotation matrix, only the first rotate matches my initial matrix. I'm not sure where the other two columns are coming from…
Any ideas? Thanks in advance!
Convert rotation matrix from right-handed Z-up
7741 1 1-
- slickowicz
- Member
- 17 posts
- Joined: April 2011
- Offline
-
- slickowicz
- Member
- 17 posts
- Joined: April 2011
- Offline
OK, after a lot of battling I have it working like this:
zup = zUpMatrix
zup = z.transposed()
toYup = hou.Matrix3(((1, 0, 0), (0, 0, 1), (0, -1, 0)))
yup = toYup * zup
yup = instRotation.transposed()
q = hou.Quaternion()
q.setToRotationMatrix(yup)
rotateAngles = q.extractEulerRotates()
Basically the part I was missing was transposing it TWICE. Oh – and Houdini is Y-up right handed, not left-handed as I thought earlier.
zup = zUpMatrix
zup = z.transposed()
toYup = hou.Matrix3(((1, 0, 0), (0, 0, 1), (0, -1, 0)))
yup = toYup * zup
yup = instRotation.transposed()
q = hou.Quaternion()
q.setToRotationMatrix(yup)
rotateAngles = q.extractEulerRotates()
Basically the part I was missing was transposing it TWICE. Oh – and Houdini is Y-up right handed, not left-handed as I thought earlier.
Windows 7 64-bit, GeForce GTX 260, 12 GB RAM
-
- Quick Links
