D3DXQUATERNION quat; D3DXQuaternionIdentity(&quat); D3DXVECTOR3 rot_axis(0.5f,1.2f,0.3f);//hardcoded float angle = D3DXVec3Length(&rot_axis); float halfangle = angle/2.0f; D3DXVec3Normalize(&rot_axis,&rot_axis); float sine_halfangle = sin(halfangle); quat.x = sine_halfangle * rot_axis.x; quat.y = sine_halfangle * rot_axis.y; quat.z = sine_halfangle * rot_axis.z; quat.w = cos(halfangle); D3DXQuaternionNormalize(&quat,&quat); //try to convert it back float angle2; D3DXVECTOR3 axis2; D3DXQuaternionToAxisAngle(&quat,&axis2,&angle2);