i4n
i4n

Reputation: 220

How to convert euler xyz to euler zxy using javascript

I am trying to convert euler rotation order from existing xyz to zxy. Could anyone please help me in doing this? Thanks.

Edit: I found this really useful article, thinking it may help others on the same path - http://knol.google.com/k/matrices-for-3d-applications-translation-rotation#Rotation_matrices_for_Euler_angles(C2)(A0)_(28)rotation_round_X(2C)Y_and_Z_axis(29)

Upvotes: 5

Views: 5036

Answers (2)

AndrewBloom
AndrewBloom

Reputation: 2408

In your particular case, there's an easy way to do it. that's because you are changing the x->z, the y->x and z->y, so in a circular way that mantains the right hand order of axis. So if the matrix is:

m[0] m[3] m[6]
m[1] m[4] m[7]
m[2] m[5] m[8]

you have to rotate the columns so the 3rd becomes 1st,

m[6] m[0] m[3]
m[7] m[1] m[4]
m[8] m[2] m[5]

and after exchange the coords in the rows:

m[8] m[2] m[5]
m[6] m[0] m[3]
m[7] m[1] m[4]

so the correspondence is between first and third matrix, for example:

m[0] --> m[8]
m[4] --> m[0]
m[8] --> m[4]

and so on.

substitute the matrix elements in your formulas and that's all, folks!

Upvotes: 1

Ghostoy
Ghostoy

Reputation: 2759

See this link: http://en.wikipedia.org/wiki/Euler_angles#Matrix_orientation. Make 9 equations from xyz to zxy matrix and solve them.

Upvotes: 3

Related Questions