Game Development Reference

In-Depth Information

* This matrix is not padding to produce an aligned structure, since

* it is most commonly used with a mass (single real) and two

* damping coefficients to make the 12-element characteristics array

* of a rigid body.

*/

class Matrix3

// ... Other Matrix3 code as before ...

};

Matrices as Transformations

Earlier in this chapter I talked about using matrices to represent orientations. In fact

matrices can represent rotations, scaling, sheering, and any number of other trans-

formations.

The elements of the matrix control the transformation being performed, and it is

worth getting to know how they do it. We can think of the matrix

⎡

⎤

abc

def

ghi

⎣

⎦

as being made up of three vectors:

⎡

⎤

⎡

⎤

⎡

⎤

a

d

g

b

e

h

c

f

i

⎣

⎦

⎣

⎦

⎣

⎦

,

,

and

These three vectors represent where each of the three main axes—X, Y, and Z—will

end up pointing after the transformation. For example, if we have a vector pointing

along the positive X axis,

⎡

⎣

⎤

⎦

1

0

0

it will be transformed into the vector

⎡

⎣

⎤

⎦

a

d

g