Silvercord

02-26-2003, 10:50 AM

I am using this for a game, but I didn't put it in the game forum because more people view GD. Plus it's math oriented, therefore you don't have to be into game programming to possibly help me.

Anyway, from what I understand from OpenGL Game Programming you can multiply the Z axis rotation matrix by the Y axis rotation by the X axis rotation. It comes right out and says the final equations(the 'concatenation' of the three matrices), but I'm not exactly sure how they got there. I'm going to post the three matrices and then the final equations. Note the delta means the degrees travelled about that axis only. If I made any mistakes please point them out, it was a lot to copy. I tried making this as neat as possible, but the matrices keep being posted unaligned.

Z axis rotation matrix:

cosDelta -sinDelta 0 0

sinDelta cosDelta 0 0

0 0 1 0

0 0 0 1

Y axis rotation matrix;

cosDelta 0 sinDelta 0

0 1 0 0

-sinDelta 0 cosDelta 0

0 0 0 1

X axis rotation matrix:

1 0 0 0

0 cosDelta -sinDelta 0

0 sinDelta cosDelta 0

0 0 0 1

Here are the final equation describing how the X image, Y image and Z image are related to the concatenation of the 3 matrices above

X' = X[(cosZDelta) * (cosYDelta)] +

Y[cosZDelta) * (sinYDelta) * (sinXDelta) - (sinZDelta) *(cosXDelta] +

Z[(cosZDelta) *(sinYDelta) * (sinYDelta) - (sinZDelta) * (cosXDelta)]

Y' = X[(sinZDelta) * (cosYDelta)]+

Y[(sinZDelta) * (sinYDelta) * (sinXDelta) - (cosZDelta) * (cosXDelta)+

Z[(sinZDelta) *(sinYDelta) * (cosXDelta) - (cosZDelta) * (sinXDelta)]

Z' = -x*(sin?) + z*(cosYDelta)*(sinXDelta)]

I'm not sure if the question mark is a mistake from the book or not, unfortunately I suspect it is, but when I know what I'm doing I'll be able to figure out what it's supposed to be.

As I said I do not know how they multiplied the first three matrices together to get the final equations. I do know how to work with matrices, i.e the image matix will have the number of rows from the first matrix and the number of columns from the second matrix. I know how to multiply two matrices together (Matrix1Row[0][0] * Matrix2Column[0][0] add those together and continue until first column is filled). Anyay if anyone can shed some light onto what is going on I will be very happy.

Anyway, from what I understand from OpenGL Game Programming you can multiply the Z axis rotation matrix by the Y axis rotation by the X axis rotation. It comes right out and says the final equations(the 'concatenation' of the three matrices), but I'm not exactly sure how they got there. I'm going to post the three matrices and then the final equations. Note the delta means the degrees travelled about that axis only. If I made any mistakes please point them out, it was a lot to copy. I tried making this as neat as possible, but the matrices keep being posted unaligned.

Z axis rotation matrix:

cosDelta -sinDelta 0 0

sinDelta cosDelta 0 0

0 0 1 0

0 0 0 1

Y axis rotation matrix;

cosDelta 0 sinDelta 0

0 1 0 0

-sinDelta 0 cosDelta 0

0 0 0 1

X axis rotation matrix:

1 0 0 0

0 cosDelta -sinDelta 0

0 sinDelta cosDelta 0

0 0 0 1

Here are the final equation describing how the X image, Y image and Z image are related to the concatenation of the 3 matrices above

X' = X[(cosZDelta) * (cosYDelta)] +

Y[cosZDelta) * (sinYDelta) * (sinXDelta) - (sinZDelta) *(cosXDelta] +

Z[(cosZDelta) *(sinYDelta) * (sinYDelta) - (sinZDelta) * (cosXDelta)]

Y' = X[(sinZDelta) * (cosYDelta)]+

Y[(sinZDelta) * (sinYDelta) * (sinXDelta) - (cosZDelta) * (cosXDelta)+

Z[(sinZDelta) *(sinYDelta) * (cosXDelta) - (cosZDelta) * (sinXDelta)]

Z' = -x*(sin?) + z*(cosYDelta)*(sinXDelta)]

I'm not sure if the question mark is a mistake from the book or not, unfortunately I suspect it is, but when I know what I'm doing I'll be able to figure out what it's supposed to be.

As I said I do not know how they multiplied the first three matrices together to get the final equations. I do know how to work with matrices, i.e the image matix will have the number of rows from the first matrix and the number of columns from the second matrix. I know how to multiply two matrices together (Matrix1Row[0][0] * Matrix2Column[0][0] add those together and continue until first column is filled). Anyay if anyone can shed some light onto what is going on I will be very happy.