Game Engine Architecture

(Ben Green) #1

4.3. Matrices 157


z the upper 3 × 3 matrix U, which represents the rotation and/or scale,
z a 1 × 3 translation vector t,
z a 3 × 1 vector of zeros 0 = [ 0 0 0 ]T, and
z a scalar 1 in the bott om-right corner of the matrix.

When a point is multiplied by a matrix that has been partitioned like this, the
result is as follows:


4.3.7.1. Translation


The following matrix translates a point by the vector t:


or in partitioned shorthand:


To invert a pure translation matrix, simply negate the vector t (i.e., negate tx ,
ty , and tz).


4.3.7.2. Rotation


All 4 × 4 pure rotation matrices have the form:


The t vector is zero and the upper 3 × 3 matrix R contains cosines and sines of
the rotation angle, measured in radians.
The following matrix represents rotation about the x-axis by an angle φ:


33 31
13 13
13

[ 1] [ 1] [( ) 1].


1


××
××
×

⎡⎤


′ = ⎢⎥=+


⎣⎦


U0


rr rU t
t

1000


0 1 00


[ 1] 0010


1


[( )( )( )1],


xyz

xyz
xxyyzz

rrr

t
rt rt rt

⎡⎤


⎢⎥


+= ⎢⎥


⎢⎥


⎢⎥


⎣⎦


=+ + +


rt

tt

[ 1] [( 1 ) 1].


⎡⎤


⎢⎥=+


⎣⎦


I0


rrt t

[ 1] [ 1].


1


⎡⎤


⎢⎥=


⎣⎦


R0


rrR
0

1 0 00


0 cos sin 0
rotate ( , ) [ 1]. 0 sin cos 0

0 0 01

x rrrxyz

⎡⎤


⎢⎥φφ
φ= ⎢⎥
⎢⎥−φ φ
⎢⎥
⎣⎦

r
Free download pdf