Ignore:
Timestamp:
Jun 23, 2017, 5:33:03 PM (4 years ago)
Author:
Sanahuja Guillaume
Message:

maj imu

File:
1 edited

Legend:

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

    r167 r186  
    2222#include <Euler.h>
    2323#include <Quaternion.h>
     24#include <math.h>
    2425
    2526using std::string;
     
    4142OneAxisRotation_impl::~OneAxisRotation_impl() {}
    4243
    43 // compute rotation of each axis through ComputeRotation(Vector3D& vector)
    4444void OneAxisRotation_impl::ComputeRotation(Quaternion &quat) const {
    45   Vector3Df rot = Vector3Df(quat.q1, quat.q2, quat.q3);
    46   ComputeRotation(rot);
    47   quat.q1 = rot.x;
    48   quat.q2 = rot.y;
    49   quat.q3 = rot.z;
     45  Quaternion rot;
     46  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      break;
     50    case 1:
     51      rot=Quaternion(cosf(Euler::ToRadian(rot_value->Value()/2)),0,sinf(Euler::ToRadian(rot_value->Value()/2)),0);
     52      break;
     53    case 2:
     54      rot=Quaternion(cosf(Euler::ToRadian(rot_value->Value()/2)),0,0,sinf(Euler::ToRadian(rot_value->Value()/2)));
     55      break;
     56  }
     57  quat=quat*rot;
    5058}
    5159
Note: See TracChangeset for help on using the changeset viewer.