Changeset 187 in flair-src for trunk/lib/FlairCore/src
- Timestamp:
- Jul 4, 2017, 9:38:26 AM (7 years ago)
- Location:
- trunk/lib/FlairCore/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairCore/src/OneAxisRotation.cpp
r167 r187 34 34 template void OneAxisRotation::ComputeRotation(core::Vector3D<double> &) const; 35 35 36 OneAxisRotation::OneAxisRotation(const gui::LayoutPosition *position, 37 string name) 36 OneAxisRotation::OneAxisRotation(const gui::LayoutPosition *position,string name,RotationType_t rotationType) 38 37 : gui::GroupBox(position, name) { 39 pimpl_ = new OneAxisRotation_impl(this );38 pimpl_ = new OneAxisRotation_impl(this,(int)rotationType); 40 39 } 41 40 -
trunk/lib/FlairCore/src/OneAxisRotation.h
r167 r187 37 37 */ 38 38 class 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 }; 40 48 /*! 41 49 * \brief Constructor … … 46 54 * \param name name 47 55 */ 48 OneAxisRotation(const gui::LayoutPosition *position, std::string name l);56 OneAxisRotation(const gui::LayoutPosition *position, std::string name,RotationType_t rotationType); 49 57 50 58 /*! -
trunk/lib/FlairCore/src/OneAxisRotation_impl.cpp
r186 r187 17 17 18 18 #include "OneAxisRotation_impl.h" 19 #include "OneAxisRotation.h" 19 20 #include "GroupBox.h" 20 21 #include "ComboBox.h" … … 31 32 template void OneAxisRotation_impl::ComputeRotation(Vector3D<double>&) const; 32 33 33 OneAxisRotation_impl::OneAxisRotation_impl(GroupBox *box ) {34 OneAxisRotation_impl::OneAxisRotation_impl(GroupBox *box,int rotationType) { 34 35 rot_value = 35 36 new DoubleSpinBox(box->NewRow(), "value", " deg", -180., 180., 10., 1); … … 38 39 rot_axe->AddItem("y"); 39 40 rot_axe->AddItem("z"); 41 this->rotationType=rotationType; 40 42 } 41 43 … … 45 47 Quaternion rot; 46 48 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); 49 51 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); 52 54 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))); 55 57 break; 56 58 } 57 quat=quat*rot; 59 if(rotationType==OneAxisRotation::RotationType_t::PreRotation) { 60 quat=rot*quat; 61 } else { //post rotation 62 quat=quat*rot; 63 } 58 64 } 59 65 -
trunk/lib/FlairCore/src/unexported/OneAxisRotation_impl.h
r167 r187 35 35 class OneAxisRotation_impl { 36 36 public: 37 OneAxisRotation_impl(flair::gui::GroupBox *box );37 OneAxisRotation_impl(flair::gui::GroupBox *box,int rotationType); 38 38 ~OneAxisRotation_impl(); 39 39 template <typename T> void ComputeRotation(flair::core::Vector3D<T> &point) const; … … 47 47 flair::gui::ComboBox *rot_axe; 48 48 flair::gui::DoubleSpinBox *rot_value; 49 int rotationType; 49 50 }; 50 51
Note:
See TracChangeset
for help on using the changeset viewer.