Changeset 187 in flair-src for trunk/lib/FlairCore/src


Ignore:
Timestamp:
Jul 4, 2017, 9:38:26 AM (7 years ago)
Author:
Sanahuja Guillaume
Message:

changement post/pre rotation

Location:
trunk/lib/FlairCore/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/OneAxisRotation.cpp

    r167 r187  
    3434template void OneAxisRotation::ComputeRotation(core::Vector3D<double> &) const;
    3535 
    36 OneAxisRotation::OneAxisRotation(const gui::LayoutPosition *position,
    37                                  string name)
     36OneAxisRotation::OneAxisRotation(const gui::LayoutPosition *position,string name,RotationType_t rotationType)
    3837    : gui::GroupBox(position, name) {
    39   pimpl_ = new OneAxisRotation_impl(this);
     38  pimpl_ = new OneAxisRotation_impl(this,(int)rotationType);
    4039}
    4140
  • trunk/lib/FlairCore/src/OneAxisRotation.h

    r167 r187  
    3737*/
    3838class OneAxisRotation : public gui::GroupBox {
    39 public:
     39  public:
     40  /*!
     41  \enum RotationType_t
     42  \brief rotation type
     43  */
     44  enum RotationType_t {
     45    PreRotation,//rotation
     46    PostRotation//frame change
     47  };
    4048  /*!
    4149  * \brief Constructor
     
    4654  * \param name name
    4755  */
    48   OneAxisRotation(const gui::LayoutPosition *position, std::string namel);
     56  OneAxisRotation(const gui::LayoutPosition *position, std::string name,RotationType_t rotationType);
    4957
    5058  /*!
  • trunk/lib/FlairCore/src/OneAxisRotation_impl.cpp

    r186 r187  
    1717
    1818#include "OneAxisRotation_impl.h"
     19#include "OneAxisRotation.h"
    1920#include "GroupBox.h"
    2021#include "ComboBox.h"
     
    3132template void OneAxisRotation_impl::ComputeRotation(Vector3D<double>&) const;
    3233
    33 OneAxisRotation_impl::OneAxisRotation_impl(GroupBox *box) {
     34OneAxisRotation_impl::OneAxisRotation_impl(GroupBox *box,int rotationType) {
    3435  rot_value =
    3536      new DoubleSpinBox(box->NewRow(), "value", " deg", -180., 180., 10., 1);
     
    3839  rot_axe->AddItem("y");
    3940  rot_axe->AddItem("z");
     41  this->rotationType=rotationType;
    4042}
    4143
     
    4547  Quaternion rot;
    4648  switch (rot_axe->CurrentIndex()) {
    47     case 0:
    48       rot=Quaternion(cosf(Euler::ToRadian(rot_value->Value()/2)),sinf(Euler::ToRadian(rot_value->Value()/2)), 0,0);
     49    case 0://x
     50      rot=Quaternion(cosf(Euler::ToRadian(-rot_value->Value()/2)),sinf(Euler::ToRadian(-rot_value->Value()/2)),0,0);
    4951      break;
    50     case 1:
    51       rot=Quaternion(cosf(Euler::ToRadian(rot_value->Value()/2)),0,sinf(Euler::ToRadian(rot_value->Value()/2)),0);
     52    case 1://y
     53      rot=Quaternion(cosf(Euler::ToRadian(-rot_value->Value()/2)),0,sinf(Euler::ToRadian(-rot_value->Value()/2)),0);
    5254      break;
    53     case 2:
    54       rot=Quaternion(cosf(Euler::ToRadian(rot_value->Value()/2)),0,0,sinf(Euler::ToRadian(rot_value->Value()/2)));
     55    case 2://z
     56      rot=Quaternion(cosf(Euler::ToRadian(-rot_value->Value()/2)),0,0,sinf(Euler::ToRadian(-rot_value->Value()/2)));
    5557      break;
    5658  }
    57   quat=quat*rot;
     59  if(rotationType==OneAxisRotation::RotationType_t::PreRotation) {
     60    quat=rot*quat;
     61  } else { //post rotation
     62    quat=quat*rot;
     63  }
    5864}
    5965
  • trunk/lib/FlairCore/src/unexported/OneAxisRotation_impl.h

    r167 r187  
    3535class OneAxisRotation_impl {
    3636public:
    37   OneAxisRotation_impl(flair::gui::GroupBox *box);
     37  OneAxisRotation_impl(flair::gui::GroupBox *box,int rotationType);
    3838  ~OneAxisRotation_impl();
    3939  template <typename T> void ComputeRotation(flair::core::Vector3D<T> &point) const;
     
    4747  flair::gui::ComboBox *rot_axe;
    4848  flair::gui::DoubleSpinBox *rot_value;
     49  int rotationType;
    4950};
    5051
Note: See TracChangeset for help on using the changeset viewer.