D3DXMatrixRotationAxis对应的数学公式

D3DXMATRIXA16* MyMatrixRotationAxis(D3DXMATRIXA16* mat, D3DXVECTOR3* vec, float t) { float cost = cos(t), sint = sin(t), one_sub_cost = 1 - cost; D3DXVECTOR3 v(*vec); D3DXVec3Normalize(&v, &v); *mat = D3DXMATRIXA16(v.x * v.x * one_sub_cost + cost, v.x * v.y * one_sub_cost + v.z * sint, v.x * v.z * one_sub_cost - v.y * sint, 0, / v.x * v.y * one_sub_cost - v.z * sint, v.y * v.y * one_sub_cost + cost, v.y * v.z * one_sub_cost + v.x * sint, 0, / v.x * v.z * one_sub_cost + v.y * sint, v.y * v.z * one_sub_cost - v.x * sint, v.z * v.z * one_sub_cost + cost, 0, / 0, 0, 0, 1); return mat; }

你可能感兴趣的:(float)