A Matrix3 as an Axis System
 
 
 

A Matrix3 can also be used to specify an axis system. For example, the INode method Rotate() is used to rotate a node about a specified axis system. One of the arguments to this method is a Matrix3 that specifies this axis system. Essentially, a matrix is just an axis system.

For example, if you think of an axis tripod in a viewport, this is basically all the information a matrix has. The axis tripod has three vectors (the directions of the axes: X, Y, Z) and a position in space (the point where the axes converge). A transformation matrix holds this same information. The 0th row of a matrix is the X vector, the 1st row of the matrix is the Y vector, the 2nd row of the matrix is the Z vector, and the 3rd row of the matrix is the position.

You can picture this if you consider the identity matrix. Its 0th row (X) is [ 10 0 ] and this is just a vector along the X axis. Its 1st row (Y) is [ 0 1 0 ] and this is simply a vector along the Y axis. Its 2nd row (Z) is [ 0 0 1 ] and this is just a vector along the Z axis. And the 3rd row (position) is [ 0 0 0] and this is the origin. Therefore the identity matrix is just an axis system without any rotation, positioned at the origin. This same thing holds true for any transformation matrix, it's just not as easy to visualize as it is with the identity matrix. Therefore, any transformation matrix is really just an axis system.

To construct an axis system then, you can simply create an identity matrix, and apply transformations to the matrix to put the matrix into the coordinate system you need. For example, if you had an axis system that was rotated 45 degrees about the Z axis and centered at (10, 20, 30) you could use the following code to build it:

Matrix3 mat(1); // Identity
mat.RotateZ(DegToRad(45.0f));
mat.SetTrans(Point3(10.0f, 20.0f, 30.0f));