Ignore:
Timestamp:
Apr 8, 2016, 3:40:57 PM (5 years ago)
Author:
Bayard Gildas
Message:

sources reformatted with flair-format-dir script

File:
1 edited

Legend:

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

    r2 r15  
    2828using namespace flair::gui;
    2929
    30 OneAxisRotation_impl::OneAxisRotation_impl(GroupBox* box)
    31 {
    32     rot_value=new DoubleSpinBox(box->NewRow(),"value"," deg",-180.,180.,10.,1);
    33     rot_axe=new ComboBox(box->LastRowLastCol(),"axis");
    34     rot_axe->AddItem("x");
    35     rot_axe->AddItem("y");
    36     rot_axe->AddItem("z");
     30OneAxisRotation_impl::OneAxisRotation_impl(GroupBox *box) {
     31  rot_value =
     32      new DoubleSpinBox(box->NewRow(), "value", " deg", -180., 180., 10., 1);
     33  rot_axe = new ComboBox(box->LastRowLastCol(), "axis");
     34  rot_axe->AddItem("x");
     35  rot_axe->AddItem("y");
     36  rot_axe->AddItem("z");
    3737}
    3838
    39 OneAxisRotation_impl::~OneAxisRotation_impl()
    40 {
     39OneAxisRotation_impl::~OneAxisRotation_impl() {}
    4140
     41// compute rotation of each axis through ComputeRotation(Vector3D& vector)
     42void OneAxisRotation_impl::ComputeRotation(Quaternion &quat) const {
     43  Vector3D rot = Vector3D(quat.q1, quat.q2, quat.q3);
     44  ComputeRotation(rot);
     45  quat.q1 = rot.x;
     46  quat.q2 = rot.y;
     47  quat.q3 = rot.z;
    4248}
    4349
    44 //compute rotation of each axis through ComputeRotation(Vector3D& vector)
    45 void OneAxisRotation_impl::ComputeRotation(Quaternion& quat) const {
    46     Vector3D rot=Vector3D(quat.q1,quat.q2,quat.q3);
    47     ComputeRotation(rot);
    48     quat.q1=rot.x;
    49     quat.q2=rot.y;
    50     quat.q3=rot.z;
     50void OneAxisRotation_impl::ComputeRotation(RotationMatrix &matrix) const {
     51  printf("not yet implemented\n");
    5152}
    5253
    53 void OneAxisRotation_impl::ComputeRotation(RotationMatrix& matrix) const {
    54 printf("not yet implemented\n");
     54// on utilise la rotation d'un vector pour faire une rotation de repere
     55// d'ou le signe negatif
     56void OneAxisRotation_impl::ComputeRotation(Vector3D &vector) const {
     57  switch (rot_axe->CurrentIndex()) {
     58  case 0:
     59    vector.RotateXDeg(-rot_value->Value());
     60    break;
     61  case 1:
     62    vector.RotateYDeg(-rot_value->Value());
     63    break;
     64  case 2:
     65    vector.RotateZDeg(-rot_value->Value());
     66    break;
     67  }
    5568}
    5669
    57 //on utilise la rotation d'un vector pour faire une rotation de repere
    58 //d'ou le signe negatif
    59 void OneAxisRotation_impl::ComputeRotation(Vector3D& vector) const
    60 {
    61     switch(rot_axe->CurrentIndex())
    62     {
    63         case 0:
    64             vector.RotateXDeg(-rot_value->Value());
    65             break;
    66         case 1:
    67             vector.RotateYDeg(-rot_value->Value());
    68             break;
    69         case 2:
    70             vector.RotateZDeg(-rot_value->Value());
    71             break;
    72     }
     70void OneAxisRotation_impl::ComputeRotation(Euler &euler) const {
     71  Quaternion quat;
     72  euler.ToQuaternion(quat);
     73  ComputeRotation(quat);
     74  quat.ToEuler(euler);
    7375}
    74 
    75 void OneAxisRotation_impl::ComputeRotation(Euler& euler) const
    76 {
    77     Quaternion quat;
    78     euler.ToQuaternion(quat);
    79     ComputeRotation(quat);
    80     quat.ToEuler(euler);
    81 }
    82 
Note: See TracChangeset for help on using the changeset viewer.