Setting a Rotation Transformation

The SetRotationAboutY function sets the given matrix to a rotation about the y-axis, using the specified number of radians. This function is called as part of the AnimateScene function, documented in Animating the Scene.

static void

SetRotationAboutY(LPD3DMATRIX lpd3dMatrix, double dAngleOfRotation)

{

D3DVALUE dvCos;

D3DVALUE dvSin;

ASSERT(NULL != lpd3dMatrix);

dvCos = D3DVAL(cos(dAngleOfRotation));

dvSin = D3DVAL(sin(dAngleOfRotation));

lpd3dMatrix->_11 = dvCos;

lpd3dMatrix->_12 = D3DVAL(0.0);

lpd3dMatrix->_13 = -dvSin;

lpd3dMatrix->_14 = D3DVAL(0.0);

lpd3dMatrix->_21 = D3DVAL(0.0);

lpd3dMatrix->_22 = D3DVAL(1.0);

lpd3dMatrix->_23 = D3DVAL(0.0);

lpd3dMatrix->_24 = D3DVAL(0.0);

lpd3dMatrix->_31 = dvSin;

lpd3dMatrix->_32 = D3DVAL(0.0);

lpd3dMatrix->_33 = dvCos;

lpd3dMatrix->_34 = D3DVAL(0.0);

lpd3dMatrix->_41 = D3DVAL(0.0);

lpd3dMatrix->_42 = D3DVAL(0.0);

lpd3dMatrix->_43 = D3DVAL(0.0);

lpd3dMatrix->_44 = D3DVAL(1.0);

}