Thursday, July 16, 2009

orthogonal basis transform

basis_transform
Here's a trick I learnt from Strang - to convert (rotation/translation) between two arbitrary frames:
  1. convert both to orthonormal bases (A,B above), ignoring the translation component for now.
  2. use the inverse == transpose trick to find the inverse of the first transform (AT), then apply (multiply by) the second transform(B)
  3. (...fudge the translation component (not shown)...)
It's even better if you want to axis-align something, you just need the transposed matrix. This got a post of it's own because I've been told by several professors over the years to move it to the origin, calculate the x and y rotational components and multiply together - this takes lots of multiplication, and you end up with a hideous zombie-like matrix.

The transpose is equal to the inverse only if it's an orthonormal matrix - to project vector line onto another, it's a simple dot product. What's more each axis in an orthogonal frame is independent, so that's all we need - 9 dot products, or one matrix multiplication.

2 comments:

  1. Anonymous11:35

    Sounds neat!
    Any chance of a worked example to make things crystaline?

    ReplyDelete
  2. Say you have the standard frame - x,y,z
    (1,0,0)(0,1,0)(0,0,1)
    Then to convert a point into the standard frame, from the standard frame, multiply by:
    1000 T
    0100
    0010
    0001

    =

    1000
    0100
    0010
    0001


    :P

    ReplyDelete