orthogonal 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.