#ifndef __JROTATOR3D__ #define __JROTATOR3D__ #include #include "JGeometry3D/JMatrix3D.hh" #include "JGeometry3D/JOmega3D.hh" /** * \author mdejong */ namespace JGEOMETRY3D {} namespace JPP { using namespace JGEOMETRY3D; } namespace JGEOMETRY3D { /** * Type definition of rotation set. */ typedef std::vector JRotator3D_t; /** * Rotation set. */ class JRotator3D : public JRotator3D_t { public: /** * Default constructor. */ JRotator3D() : JRotator3D_t() {} /** * Constructor. * * Any sequence of \<= n rotations is equivalent to a single rotation corresponding * to the nth input direction (i.e.\ X.rotate(JRotation3D(omega[n]))).\n * A final rotation is added to restore the original coordinate system. * * \param omega direction set */ JRotator3D(const JOmega3D_t& omega) : JRotator3D_t() { if (!omega.empty()) { JOmega3D_t::const_iterator dir = omega.begin(); JRotation3D R(*dir); push_back(R); while (++dir != omega.end()) { JRotation3D r(*dir); push_back(r.mul(R.transpose())); R = JRotation3D(*dir); } push_back(R.transpose()); } } }; } #endif