Game Development Reference

In-Depth Information

F
IGURE
9.6

A matrix has its basis changed.

then the change can also involve a shift in the origin. We used this transformation to

convert a vector from one basis to another.

We will also meet a situation in which we need to transform a whole matrix from

one basis to another. This can be a little more difficult to visualize.

Let's say we have a matrix
M
t
that performs some transformation, as shown in

the first part of figure 9.6. (The figure is in 2D for ease of illustration, but the same

principles apply in 3D.) It performs a small rotation around the origin; part A of the

figure shows an object being rotated.

Now let's say we have a different basis, but we want exactly the same transforma-

tion. In our new basis we'd like to find a transformation that has the same effect (i.e.,

it leaves the object at the same final position), but works with the new coordinate

system. This is shown in part B of figure 9.6; now the origin has moved (we're in a

different basis), but we'd like the effect of the transformation to be the same. Clearly,

if we applied
M
t
in the new basis, it would give a different end result.

Let'sassumewehaveatransformation
M
b
between our original basis

B
1
and our

new basis

B
2
. Is there some way we can create a new transformation from
M
t
and
M
b

that would replicate the behavior that
M
t
gave us in

B
1
but in the new

B
2
?

Thesolutionistouse
M
b
and
M
−
1

b

in a three-stage process:

1.
We perform the transformation
M
−
1

b

B
1
.

2.
We then perform the original transform
M
t
, since we are now in the basis

, which takes us from

B
2
back into

B
1
,

where it was originally correct.

3.
We then need to get back into basis

B
2
, so we apply transformation
M
b
.