Your question has a lot of possible meanings, but it seems like you are asking how to find a basis function.

When you build a transformation matrix you start with an identity matrix and then add all your translations and rotations and shears to it. You are probably familiar with it:

[ 1, 0, 0, 0 ]

[ 0, 1, 0, 0 ]

[ 0, 0, 1, 0 ]

[ 0, 0, 0, 1 ]

Now the weird part --- all of those values MEAN SOMETHING. They aren't just magical numbers that mathematicians pulled from the ether.

There are actually sets of values usefully embedded in that matrix. You just need to know what they are. I've labeled them A through F:

[ A, A, A, D ]

[ B, B, B, D ]

[ C, C, C, D ]

[ E, E, E, F ]

You might be using row-major or column-major matrix. The three values for "E" should match your translation, or the X,Y,Z coordinates of an un-rotated object. If your coordinates are stored in the "D" vector then you'll need to do some mental work to flip the values along the diagonal. The math still works, it is just stored in columns instead of rows.

If you only have the rotation part of it, parts A through C, everything still applies. You will still need to make sure you have are using row-major rather than column-major matrix types.

A, B, and C are called the "basis vectors". They define where the X axis, Y axis, and Z axis should point. D is the shear vector, it can add some tilt to the world. As mentioned already E should match the translation. F should be either 0 or 1; if it is 0 the matrix is a vector transformation (vectors have no position) meaning that operations should not multiply through the translation, they end up getting multiplied by zero and vanishing, if the value is 1 the matrix is a point transformation meaning that position should be considered.

So if we modify our identity matrix slightly, we get:

[ 1, 0, 0, 0 ]

[ 0, 0, 1, 0 ]

[ 0, 1, 0, 0 ]

[ 0, 0, 0, 1 ]

This means the Y and Z axis are swapped, or in other words, the transformation has rotated the object 90' to face a different axis. Instead of facing up into y, the transformation makes the model face out into z. The second basis function "B" is the Y axis, and it is using the value that used to be in Z. The third basis function "C" is the Z axis, and it is using the value that used to be in Y. So if the top of your model was two meters tall and it was located at [0, 2, 0], it is now laying on its side facing into the world at [0, 0, 2].

So what does that mean to you?

If you have a transformation matrix (or a 3x3 rotation matrix) and want to quickly know where Z is oriented, you can pull out the Z axis basis vector (marked as "C" above) and use that directly. Usually X is sideways ("A") Y is up ("B"), and Z is forward or backward ("C") making it easy to find object-relative directions.

**Edited by frob, 06 March 2014 - 12:11 AM.**