Thread: Rotation matrix

  1. #1
    Registered User Drogin's Avatar
    Join Date
    Oct 2005
    Location
    Norway
    Posts
    105

    Rotation matrix

    I read in my math book about rotation matrices.

    I read about how you derive the formula for making a matrix to rotate about an arbitary axis.
    I understood how they made it, and understood the concept of how to do it.

    What I don't quite understand, is how to derive the matrices for the "normal" x, y and z axis.

    For example, to rotate about the x-axis, the rotation matrix are:
    Code:
    | 1     0           0 |
    | 0  cos(x)   -sin(x) |
    | 0  sin(x)    cos(x) |
    The book didnt say how they derived thease matrices.
    Of course, to derive them, you could just use the arbitary formula with the basis-vectors.
    And that's my question. How did they derive the rotation-matrices for the x, y and z axis?
    Is it so simple that they figured it out in their head? Can they see it visually/geometricaly?
    Or did they derive the formulas using the arbitary formula?

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Have you seen a derivation for rotations in 2-D? (Obviously you would get a 2x2 matrix out of that.) This is just the same -- the x-axis doesn't move, since it's being rotated about, so the x-column gets the identity; the y- and z-columns get the 2x2 matrix developed in 2-D. Same for the rotations about y- and z-axes.

  3. #3
    Registered User Drogin's Avatar
    Join Date
    Oct 2005
    Location
    Norway
    Posts
    105
    I've seen 2D-matrices, yes.
    But what I was wondering about, wasnt the "identity vector"-part of the 3D-matrix. That I understand easily
    What I was wondering about was, how did they find out that it should be -sin(x), and not sin(x), and how did they find out it should be sin(x) on the "x-coordinate" of the y-vector, and cos(x) on the y-coordinate of the y-vector.

    I understand why when I insert the basis vectors(x, y and z) in the formula for rotation around an arbitary axsis.
    But I was wondering if this was how they found out the 2D-matrices for the axis-vectors as well, or if they did something else, like used some weird geometry rules or visualised a rotated unit-circle or something.
    Last edited by Drogin; 08-02-2008 at 11:39 AM.

  4. #4

    Join Date
    May 2005
    Posts
    1,042
    All a rotation matrix *really* does is re-plot the point with respect to a new coordinate system. It rotates the 'i,j,k' unit vectors used to describe the point in question. I'm a bit surprised that you found the arbitrary axis rotation formulas straightforward but got stumped on the x,y,z axis rotation matrices.

    http://cboard.cprogramming.com/showt...light=rotation
    I'm not immature, I'm refined in the opposite direction.

  5. #5
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    I'm a bit surprised that you found the arbitrary axis rotation formulas straightforward but got stumped on the x,y,z axis rotation matrices.
    Agreed. The axis-angle rotation matrix is about three times as complex as the standard x,y and z rotation matrices. In fact axis-angle rotation matrix is extremely similar to what quaternions are doing if I recall correctly.

    As for quaternions I just started using them and take for granted that they um...'work' since I'm baffled by the underlying math.

  6. #6
    Registered User Drogin's Avatar
    Join Date
    Oct 2005
    Location
    Norway
    Posts
    105
    In fact axis-angle rotation matrix is extremely similar to what quaternions are doing if I recall correctly.
    The book I'm reading are dealing with rotation-matrices before quaternions...perhaps that's the reason.

    And the fact that the book explained the underlying math behind the arbitary formula, but didnt explain how they made the roation around the x,y and z axis

    Offtopic:
    "Those who sacrifice freedom for security deserve neither."
    That's Abraham Lincoln, isnt it?

  7. #7
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by Drogin View Post
    I've seen 2D-matrices, yes.
    But what I was wondering about, wasnt the "identity vector"-part of the 3D-matrix. That I understand easily
    What I was wondering about was, how did they find out that it should be -sin(x), and not sin(x), and how did they find out it should be sin(x) on the "x-coordinate" of the y-vector, and cos(x) on the y-coordinate of the y-vector.
    Then you haven't seen 2D rotation matrices.

    Sit down with a piece of paper, pick a point (x,y), draw the ray from origin to there, rotate the ray counterclockwise by some angle theta, and find the coordinates of new point. You'll find the coordinates are familiar.

    Note: The arbitrary basis vector method is simply to decide ahead of time to use the points (1,0) and (0,1), since they make things cancel (i.e., all the y-terms cancel in the first, all the x-terms cancel in the second). You can then use those straight down in the columns of the rotation matrix.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C - access violation
    By uber in forum C Programming
    Replies: 2
    Last Post: 07-08-2009, 01:30 PM
  2. camera rotation matrix
    By Vick jr in forum Game Programming
    Replies: 5
    Last Post: 05-26-2009, 08:16 AM
  3. Matrix Help
    By HelpmeMark in forum C++ Programming
    Replies: 27
    Last Post: 03-06-2008, 05:57 PM
  4. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM