Game Development Reference
In-Depth Information
There are times, however, when you will need to temporarily rotate the coordinate axes to
perform a calculation. This is required, for example, when modeling the collision of a golf club
head and a golf ball. Coordinate axes rotations are typically performed two-dimensionally. The
axis of rotation is taken to be one of the original coordinate axes, and the other two axes are
rotated a given angle from their nominal setting. In Figure 2-4, the x- and y-axes are rotated by
an angle q with the z-axis serving as the axis of rotation.
z
y'
x
θ
y
x'
Figure 2-4. A coordinate axes rotation about the z-axis
A vector quantity such as location or velocity in the original xyz coordinate system can be
expressed in terms of the rotated coordinate system using the sine and cosine of the rotation angle.
v
cos
θ
sin
θ
0
⎤ ⎡
v
x
⎥ ⎢
x
⎥ ⎢
=−
v
sin
θ
cos
θ
0
v
(2.16)
⎥ ⎢
y
y
⎥ ⎢
v
0
0
1
v
⎦ ⎣
z
z
The matrix shown in Equation (2.16) is called a rotation matrix . The rotation angle is also
referred to as an Euler angle after the famous mathematician. Based on what we know about
matrix multiplication, the rotated velocity components can also be written in equation form.
=
vv
cos
θ
+
v
sin
θ
(2.17a)
x
x
y
=−
v
v
sin
θ
+
v
cos
θ
(2.17b)
y
x
y
=
vv
(2.17c)
z
z
Since the rotation was about the z-axis, the rotated z-component of velocity is unchanged.
Similar rotation matrices exist for rotations about the x- and y-axes. What is shown in
Equation (2.16) is a two-dimensional coordinate axis rotation. A three-dimensional coordinate axis
rotation is a much more complicated problem and is usually achieved by performing three
successive two-dimensional rotations. The final rotation matrix will be the result of multiplying
three two-dimensional rotation matrices together, and the matrix elements will be a function
of three separate Euler (rotation) angles.
Search WWH ::




Custom Search