Game Development Reference
In-Depth Information
Figure 14.8
The teapotahedron rotated
/4 radians around the Y-axis.
−π
This matrix will create a rotation about the Z-axis:
2
4
3
5
cos ð Þ
sin ð Þ 00
sin ð Þ
cos ð Þ 00
0
0
1 0
0
0
0 1
The DirectX code to create those two rotations is exactly what you
'
d expect:
float angle = -D3DX_PI / 4.0f;
D3DXMATRIX rotateX, rotateZ;
D3DXMatrixRotationX( rotateX, angle);
D3DXMatrixRotationZ( rotateZ, angle);
With simple translation and rotation transforms firmly in your brain, you need to
learn how to put multiple transforms into action. It turns out that you can multiply,
or concatenate, matrices. The result encodes every operation into a single matrix. I
know,
s one important part of this wizardry: The
concatenated matrix is sensitive to the order in which you did the original
it seems like magic. There
'
 
Search WWH ::




Custom Search