#ifndef __JEULERMATRIX3D__ #define __JEULERMATRIX3D__ #include #include "JGeometry3D/JRotation3D.hh" #include "JGeometry3D/JEulerAngle3D.hh" namespace JGEOMETRY3D { /** * Euler matrix * * The Euler matrix is a genuine 3D rotation matrix, i.e. * the inverse of an Euler mtarix is equal to its tranpose. * * The Euler angles are defined as follows: * * 1/ alpha 2D rotation around Z -axis; * 2/ beta 2D rotation around X' -axis; * 3/ gamma 2D rotation around Z''-axis; */ class JEulerMatrix3D : public JRotation3D { public: /** * Default constructor (= identity matrix). */ JEulerMatrix3D() : JRotation3D() {} /** * Constructor. * * \param euler Euler angles */ JEulerMatrix3D(const JEulerAngle3D& euler) : JRotation3D() { const double ca = cos(euler.getAlpha()); const double sa = sin(euler.getAlpha()); const double cb = cos(euler.getBeta()); const double sb = sin(euler.getBeta()); const double cg = cos(euler.getGamma()); const double sg = sin(euler.getGamma()); a00_ = cg*ca - sg*cb*sa; a01_ = -cg*sa - sg*cb*ca; a02_ = sg*sb; a10_ = sg*ca + cg*cb*sa; a11_ = -sg*sa + cg*cb*ca; a12_ = -cg*sb; a20_ = sb*sa; a21_ = sb*ca; a22_ = cb; } }; } #endif