Game Development Reference
In-Depth Information
Figure 1.4. Translation and rotation.
The affine transformation will end up adding the vector y to any point we
apply it to, so y achieves translation for us. Rotation is stored in the matrix A .
Because it is for us convenient to keep them separate, we will use the first form
more often. So in three dimensions, translation will be stored as a 3-vector t and
rotation as a 3
3 matrix, which we will call R .
The following equation, also known as the Rodrigues formula, performs a
general rotation of a point p by θ radians around a rotation axis r :
×
cos θ p +[1
cos θ ]( r
·
p ) r +sin θ ( r
×
p ) .
(1.3)
This can be represented as a matrix by
tx 2 + c y
sz
txz + sy
,
ty 2 + c z
R r θ =
txy + sz
sx
tz 2 + c
txz
sy
tyz + sx
where
r
= x, y, z ) ,
c
=cos θ,
s
= in θ,
t
cos θ.
=1
Both translation and rotation are invertible transformations. To invert a trans-
y . To invert a rotation, take the transpose of the matrix.
One useful property of rotation is its interaction with the cross product:
R ( a
×
b )= Ra
×
Rb .
Note that this does not hold true for all linear transformations.