#ifndef __JROTATOR2D__
#define __JROTATOR2D__

#include <vector>

#include "JGeometry2D/JMatrix2D.hh"
#include "JGeometry2D/JOmega2D.hh"


/**
 * \author mdejong
 */

namespace JGEOMETRY2D {}
namespace JPP { using namespace JGEOMETRY2D; }

namespace JGEOMETRY2D {


  /**
   * Type definition of rotation set.
   */
  typedef std::vector<JRotation2D>  JRotator2D_t;


  /**
   * Rotation set.
   */
  class JRotator2D :
    public JRotator2D_t
  {
  public:
    /**
     * Default constructor.
     */
    JRotator2D() :
      JRotator2D_t()
    {}


    /**
     * Constructor.
     *
     * \param  omega         direction set
     */
    JRotator2D(const JOmega2D_t& omega) :
      JRotator2D_t()
    {
      if (!omega.empty()) {

        JRotation2D R(*omega.begin());

        push_back(R);

        for (JOmega2D_t::const_iterator i = omega.begin(); ++i != omega.end(); ) {

          JRotation2D r(*i);

          push_back(r.mul(R.transpose()));

          R = JRotation2D(*i);
        }

        push_back(R.transpose());
      }
    }    
  };
}

#endif