Thread: Problem multiplying rotation matrices together

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Banned
    Join Date
    Jan 2003
    Posts
    1,708

    Problem multiplying rotation matrices together

    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:
    Code:
    cosDelta   -sinDelta 0 0
    sinDelta     cosDelta 0 0
    0 0  1  0
    0 0  0  1
    Y axis rotation matrix;
    Code:
    cosDelta  0 sinDelta  0
    0 1 0 0
    -sinDelta 0 cosDelta 0
    0 0 0 1
    X axis rotation matrix:
    Code:
    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.
    Last edited by Silvercord; 02-26-2003 at 10:56 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. adding matrices, help with switches
    By quiet_forever in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2007, 08:21 AM
  2. Image rotation - doesn't always work
    By ulillillia in forum C Programming
    Replies: 12
    Last Post: 05-03-2007, 12:46 PM
  3. Problem in mouse position
    By Arangol in forum Game Programming
    Replies: 6
    Last Post: 08-08-2006, 07:07 AM
  4. Quaternion Rotation
    By psychopath in forum Game Programming
    Replies: 16
    Last Post: 07-23-2006, 03:28 PM
  5. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM