Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Integrating a 3x3 orientation matrix

  1. Apr 10, 2005 #1
    Hi there, (I hope this post is in the right forum)

    I'm trying to integrate a 3x3 orientation matrix using a vector representing rotational velocity (in 3d)

    This is the formula i'm using:

    newOrientation = orientation + (dt)(~w)(orientation)

    where w is the vector rotational velocity, and the tilde operator creates a “skew-symmetric” matrix out of w.

    The problem is, I don't see how this could possibly produce a legitimate orientation matrix. I'm using column-major matricies, so each column of an orientation matrix should contain a normalized vector, right?

    I understand that over time, error will creep into things, and the result orientation matrix will begin to be *not quite* orthogonal, and not quite normalized, but what it seems to be producing for me is an orientation matrix containing vectors that arn't REMOTELY normalized.

    because of this, when I try to transform a 3d object with it, the object stretches, and essentially tears itself apart.

    Am I screwing this up some how? Any help is EXTREMELY appreciated.
  2. jcsd
  3. Apr 10, 2005 #2


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Let me restate the problem, just to be sure:

    You have a matrix function A(t). That is, you have a matrix whose entries are a function of time.

    Then, you are updating the matrix via:
    A(t + dt) = A + dt W A(t)

    Your problem is that you're accumulating both roundoff error, and approximation error. It's directly analogous to trying to compute 1^2 by starting with 0^2 and trying to use the differential approximation (x + dx)^2 = x + 2x dx to step from 0 to 1 in small increments.

    What you really want to do is simply multiply A by a rotation matrix. You know the axis of rotation, you know the angular velocity, and you know the time elapsed. From these, you can determine the angle of rotation, and then compute the appropriate rotation matrix.

    There are ways to directly compute the rotation matrix from W, but they're not pretty... if the above is at all possible, that's what you want to do.
  4. Apr 10, 2005 #3
    Thanks for the response...

    Yes, you reworded my question correctly (and better :) )
    I'm afraid I don't follow the big about differential approximation, it only stirs up memories of a high-school calculus course almost 1 year ago... But as it turns out, I managed to solve the problem. For others reading, here is what I came up with:

    From what I had read, this "tilde" operator nonsense, when applied to a vector, produces a matrix (we'll call it A). if this matrix is then multiplied against another (B), the resulting matrix is the cross product of the original vector and matrix B.

    this is supposed to be the same as taking the original vector, and doing a cross product with each column of matrix B. So this is what I did (the three manual cross products), and now it works like a charm. So I guess I must not have been implementing the tilde thing right...

    Thanks for the help though
  5. Apr 10, 2005 #4


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    For the record, I think you're still accumulating approximation error... but I guess it's small enough that it doesn't matter. :smile:
  6. Apr 10, 2005 #5
    I do have to "orthonormalize" the rotation matrix every now and then... what you say interests me though, because for physics simulations, I would think one would want to minimize the accumulation of error...
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook