Game Development Reference
In-Depth Information
translation was not considered. Armed with 4 × 4 transform matrices,
though, we can now create more general a ne transformations that contain
translation, such as:
rotation about an axis that does not pass through the origin,
scale about a plane that does not pass through the origin,
reflection about a plane that does not pass through the origin, and
orthographic projection onto a plane that does not pass through the
origin.
The basic idea is to translate the “center” of the transformation to the
origin, perform the linear transformation by using the techniques developed
in Chapter 5, and then transform the center back to its original location.
We start with a translation matrix T that translates the point p to the
origin, and a linear transform matrix R from Chapter 5 that performs
the linear transformation. The final a ne transformation matrix A will
be equal to the matrix product TR ( T
−1 ), where T
−1
is the translation
matrix with the opposite translation amount as T .
It is interesting to observe the general form of such a matrix. Let's first
write T , R , and T
−1 in the partitioned form we used earlier:
2
4 1
3
0
0
0
5
0
1
0
0
I 0
p 1
T =
=
;
0
0
1
0
−p x
−p y
−p z
1
2
4 r 11 r 12 r 13
3
5
0
r 21 r 22 r 23
0
R 3×3 0
0
R 4×4 =
=
;
r 31 r 32 r 33
0
1
0
0
0
1
2
4 1
3
5
0
0
0
0
1
0
0
I 0
p 1
−1 =
T
=
.
0
0
1
0
p x p y p z
1
Evaluating the matrix multiplication, we get
I
0
R 3×3 0
0
I 0
p 1
R 3×3
0
−1 =
=
.
TR 4×4 T
p 1
1
p ( R 3×3 ) + p 1
Thus, the extra translation in an a ne transformation changes only the
last row of the 4 × 4 matrix. The upper 3 × 3 portion, which contains the
linear transformation, is not affected.
Search WWH ::




Custom Search