Changeset 15 in flairsrc for trunk/lib/FlairCore/src/OneAxisRotation_impl.cpp
 Timestamp:
 Apr 8, 2016, 3:40:57 PM (5 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/lib/FlairCore/src/OneAxisRotation_impl.cpp
r2 r15 28 28 using namespace flair::gui; 29 29 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 35 36 30 OneAxisRotation_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"); 37 37 } 38 38 39 OneAxisRotation_impl::~OneAxisRotation_impl() 40 { 39 OneAxisRotation_impl::~OneAxisRotation_impl() {} 41 40 41 // compute rotation of each axis through ComputeRotation(Vector3D& vector) 42 void 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; 42 48 } 43 49 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; 50 void OneAxisRotation_impl::ComputeRotation(RotationMatrix &matrix) const { 51 printf("not yet implemented\n"); 51 52 } 52 53 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 56 void 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 } 55 68 } 56 69 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 } 70 void OneAxisRotation_impl::ComputeRotation(Euler &euler) const { 71 Quaternion quat; 72 euler.ToQuaternion(quat); 73 ComputeRotation(quat); 74 quat.ToEuler(euler); 73 75 } 74 75 void OneAxisRotation_impl::ComputeRotation(Euler& euler) const76 {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.