//----------------------------------------------------------------------- void Matrix3::FromEulerAnglesZYX(const Radian& fYAngle, const Radian& fPAngle, const Radian& fRAngle) { double fCos, fSin; fCos = Math::Cos(fYAngle); fSin = Math::Sin(fYAngle); Matrix3 kZMat(fCos, -fSin, 0.0, fSin, fCos, 0.0, 0.0, 0.0, 1.0); fCos = Math::Cos(fPAngle); fSin = Math::Sin(fPAngle); Matrix3 kYMat(fCos, 0.0, fSin, 0.0, 1.0, 0.0, -fSin, 0.0, fCos); fCos = Math::Cos(fRAngle); fSin = Math::Sin(fRAngle); Matrix3 kXMat(1.0, 0.0, 0.0, 0.0, fCos, -fSin, 0.0, fSin, fCos); *this = kZMat * (kYMat * kXMat); }
//---------------------------------------------------------------------------- Matrix3 Matrix3::fromEulerAnglesZYX (float fYAngle, float fPAngle, float fRAngle) { float fCos, fSin; fCos = cos(fYAngle); fSin = sin(fYAngle); Matrix3 kZMat(fCos, -fSin, 0.0, fSin, fCos, 0.0, 0.0, 0.0, 1.0); fCos = cos(fPAngle); fSin = sin(fPAngle); Matrix3 kYMat(fCos, 0.0, fSin, 0.0, 1.0, 0.0, -fSin, 0.0, fCos); fCos = cos(fRAngle); fSin = sin(fRAngle); Matrix3 kXMat(1.0, 0.0, 0.0, 0.0, fCos, -fSin, 0.0, fSin, fCos); return kZMat * (kYMat * kXMat); }
//---------------------------------------------------------------------------- Matrix3 Matrix3::fromEulerAnglesXYZ (float fYAngle, float fPAngle, float fRAngle) { float fCos, fSin; fCos = cosf(fYAngle); fSin = sinf(fYAngle); Matrix3 kXMat(1.0f, 0.0f, 0.0f, 0.0f, fCos, -fSin, 0.0, fSin, fCos); fCos = cosf(fPAngle); fSin = sinf(fPAngle); Matrix3 kYMat(fCos, 0.0f, fSin, 0.0f, 1.0f, 0.0f, -fSin, 0.0f, fCos); fCos = cosf(fRAngle); fSin = sinf(fRAngle); Matrix3 kZMat(fCos, -fSin, 0.0f, fSin, fCos, 0.0f, 0.0f, 0.0f, 1.0f); return kXMat * (kYMat * kZMat); }