Rotation matrix help.

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

Rotation matrix help. // Scriptorium

1  |  

Post by Liger ZERO // Dec 5, 2007, 9:32am

Liger ZERO
Total Posts: 124
pic
I have a 3X3 matrix that have unit vectors for xyz. How do I take this values and convert them over to euler angles for trueSpace xyz rotation? I looked all over the internet for this, I just can't understand it. Thanks for any help you can give.

Post by Norm // Dec 5, 2007, 1:40pm

Norm
Total Posts: 862
pic
Expand an object's "Matrix" attribute. When expanded, it will give you ability to change pitch, yaw and roll values. I believe these are the items you are looking for?

Post by Liger ZERO // Dec 5, 2007, 2:50pm

Liger ZERO
Total Posts: 124
pic
Thanks norm but this is what I need help with:
http://en.wikipedia.org/wiki/Rotation_matrix

I'll try to explain a little better. For starters if I say something wrong or confusing sorry, I just don't know much about math. :confused:

I have a 3X3 matrix.
(example)
[Ax, Ay, Az]
[Bx, By, Bz]
[Cx, Cy, Cz]

Each of the values(Ax, Ay, etc.) are a unit vector. I think for the rotation I need a identity matrix like this.
[1, 0, 0]
[0, 1, 0]
[0, 0, 1]

And I think this is how to get the x,y,z angle for trueSpace.
X rotation =
[1, 0, 0]
[0, cos, -sin]
[0, sin, cos]

Y rotation =
[cos, 0, sin]
[0, 1, 0]
[-sin, 0, cos]

Z rotation =
[cos, -sin, 0]
[sin, cos, 0]
[0, 0, 1]

I just don't know how to get one value for x,y,z. For instance at the top of the page here: http://en.wikipedia.org/wiki/Rotation_matrix
There is a matrix that should = 53 degrees for z rotation.
[0.6, -0.8, 0]
[0.8, 0.6, 0]
[0, 0, 1]

Now applying the Zrotation matrix all the values do come up at 53 degrees but how do you just get the one value you need?

I hope this clears up my question.

Post by tomasb // Dec 5, 2007, 11:57pm

tomasb
Total Posts: 261
when you expand multiplications of rotation matrces you get something like this:


Rz * Ry * Rx =

(cy*cz -sz*cx+sx*sy*cz sx*sz+cx*sy*cz)

(cy*sz cz*cx+sx*sy*sz -sx*cz+cx*sy*sz)

(-sy sx*cy cx*cy )



(Rz is rotation matrix around Z axis, cz, sz - cos(z), sin(z))


ow you see that -sy is @1,3, so you get Y angle. then you calculate cy from it, and you have sx ([2,1] / cy) and cx ([3,1] / cy). You get sz,cz similarly...



you can also use decomposition in IRdMatrixf... if you want to use this in your script.
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn