Ignore:
Timestamp:
07/04/17 09:38:26 (6 years ago)
Author:
Sanahuja Guillaume
Message:

changement post/pre rotation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.