00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 #ifndef _Orientation_h
00077 #define _Orientation_h
00078
00079 #if !defined(_WIN32)
00080 #define EXPORT_SRM_CPP_DLL
00081 #elif defined(BUILD_SRM_CPP)
00082 #if !defined(EXPORT_SRM_CPP_DLL)
00083 #if defined(_LIB)
00084 #define EXPORT_SRM_CPP_DLL
00085 #elif defined(_USRDLL)
00086 #define EXPORT_SRM_CPP_DLL __declspec(dllexport)
00087 #else
00088 #define EXPORT_SRM_CPP_DLL __declspec(dllimport)
00089 #endif
00090 #endif
00091 #else
00092 #define EXPORT_SRM_CPP_DLL
00093 #endif
00094
00095 #include "Exception.h"
00096 #include <string>
00097
00098 namespace srm
00099 {
00103 class EXPORT_SRM_CPP_DLL Orientation
00104 {
00105 public:
00108 static const SRM_Long_Float epsilon;
00109
00112 virtual Orientation & operator=(const Orientation &other);
00113
00116 virtual SRM_Matrix_3x3 getMatrix3x3() const;
00117
00120 virtual SRM_Axis_Angle_Params getAxisAngle() const;
00121
00124 virtual SRM_Euler_Angles_ZXZ_Params getEulerAnglesZXZ() const;
00125
00128 virtual SRM_Tait_Bryan_Angles_Params getTaitBryanAngles() const;
00129
00132 virtual SRM_Quaternion_Params getQuaternion() const;
00133
00138 virtual void setMatrix3x3(const SRM_Matrix_3x3 & params);
00139
00144 virtual void setMatrix3x3
00145 (SRM_Long_Float a11, SRM_Long_Float a12, SRM_Long_Float a13,
00146 SRM_Long_Float a21, SRM_Long_Float a22, SRM_Long_Float a23,
00147 SRM_Long_Float a31, SRM_Long_Float a32, SRM_Long_Float a33);
00148
00154 virtual void setAxisAngle(const SRM_Axis_Angle_Params & params);
00155
00162 virtual void setAxisAngle(const SRM_Vector_3D & axis, SRM_Long_Float angle);
00163
00170 virtual void setEulerAnglesZXZ(const SRM_Euler_Angles_ZXZ_Params & params);
00171
00181 virtual void setEulerAnglesZXZ
00182 (
00183 SRM_Long_Float spin,
00184 SRM_Long_Float nutation,
00185 SRM_Long_Float precession
00186 );
00187
00194 virtual void setTaitBryanAngles
00195 (
00196 const SRM_Tait_Bryan_Angles_Params & params
00197 );
00198
00208 virtual void setTaitBryanAngles
00209 (
00210 SRM_Long_Float roll,
00211 SRM_Long_Float pitch,
00212 SRM_Long_Float yaw
00213 );
00214
00220 virtual void setQuaternion(const SRM_Quaternion_Params & params );
00221
00231 virtual void setQuaternion
00232 (
00233 SRM_Long_Float e0,
00234 SRM_Long_Float e1,
00235 SRM_Long_Float e2,
00236 SRM_Long_Float e3
00237 );
00238
00241 virtual std::string toString() const = 0;
00242
00245 virtual SRM_Ori_Rep_Type getOriRep() const = 0;
00246
00251 virtual SRM_Vector_3D transformVector(const SRM_Vector_3D &vec ) const;
00252
00253 static bool equivalence
00254 (
00255 const Orientation &instance1,
00256 const Orientation &instance2,
00257 SRM_Long_Float tolerance = Orientation::epsilon
00258 );
00259
00260 virtual bool equivalence
00261 (
00262 const Orientation &compare_instance,
00263 SRM_Long_Float tolerance = Orientation::epsilon
00264 ) const
00265 {
00266 return equivalence(*this, compare_instance, tolerance);
00267 }
00268
00272 bool operator==( Orientation & rhs );
00273
00274 private:
00277 mutable SRM_Matrix_3x3 _matrix_base;
00281 mutable bool _internal_data_is_current;
00282
00283 protected:
00284 Orientation();
00287 const SRM_Matrix_3x3 & _get_matrix_base() const;
00288 const SRM_Matrix_3x3 & _get_matrix_base_unch() const;
00289 void _set_matrix_base(const SRM_Matrix_3x3 & matrix_base ) const;
00293 bool _get_internal_data_is_current() const;
00294 void _set_internal_data_is_current( bool internal_data_is_current) const;
00298 virtual void _updateIntData() const = 0;
00302 virtual void _updateRepData() = 0;
00303 };
00304
00305
00310 class EXPORT_SRM_CPP_DLL OrientationMatrix : public Orientation
00311 {
00312 public:
00315 OrientationMatrix();
00316
00321 OrientationMatrix
00322 (SRM_Long_Float a11, SRM_Long_Float a12, SRM_Long_Float a13,
00323 SRM_Long_Float a21, SRM_Long_Float a22, SRM_Long_Float a23,
00324 SRM_Long_Float a31, SRM_Long_Float a32, SRM_Long_Float a33);
00325
00330 OrientationMatrix(const SRM_Matrix_3x3 ¶ms);
00331
00334 OrientationMatrix(const Orientation &other);
00335
00338 virtual Orientation & operator=(const Orientation &other);
00339
00342 virtual std::string toString() const;
00343
00346 virtual SRM_Ori_Rep_Type getOriRep() const
00347 {
00348 return SRM_ORI_REP_MATRIX_3X3;
00349 }
00350
00353 static bool isValidParams(const SRM_Matrix_3x3 ¶ms);
00354
00359 static OrientationMatrix compose
00360 (
00361 const Orientation &left,
00362 const Orientation &right
00363 );
00364
00367 static bool equivParams
00368 (
00369 const SRM_Matrix_3x3 ¶ms1,
00370 const SRM_Matrix_3x3 ¶ms2,
00371 SRM_Long_Float tolerance = 0.0
00372 );
00373
00374 protected:
00375 SRM_Matrix_3x3 _matrix;
00376
00377 virtual void _updateIntData() const;
00378 virtual void _updateRepData();
00379 };
00380
00381
00386 class EXPORT_SRM_CPP_DLL OrientationAxisAngle : public Orientation
00387 {
00388 public:
00391 OrientationAxisAngle();
00392
00399 OrientationAxisAngle(const SRM_Axis_Angle_Params & params);
00400
00407 OrientationAxisAngle(const SRM_Vector_3D & axis, SRM_Long_Float angle );
00408
00411 OrientationAxisAngle(const Orientation &other);
00412
00415 virtual Orientation & operator=(const Orientation &other);
00416
00419 virtual SRM_Axis_Angle_Params getAxisAngle() const
00420 {
00421 return _axis_angle;
00422 }
00423
00429 virtual void setAxisAngle(const SRM_Axis_Angle_Params & params);
00430
00437 virtual void setAxisAngle(const SRM_Vector_3D & axis, SRM_Long_Float angle)
00438 {
00439 Orientation::setAxisAngle(axis, angle);
00440 }
00441
00444 virtual std::string toString() const;
00445
00448 virtual SRM_Ori_Rep_Type getOriRep() const
00449 {
00450 return SRM_ORI_REP_AXIS_ANGLE;
00451 }
00452
00455 static bool isValidParams(const SRM_Axis_Angle_Params & params );
00456
00461 static OrientationAxisAngle compose
00462 (
00463 const Orientation &left,
00464 const Orientation &right
00465 );
00466
00469 static bool equivParams
00470 (
00471 const SRM_Axis_Angle_Params ¶ms1,
00472 const SRM_Axis_Angle_Params ¶ms2,
00473 SRM_Long_Float tolerance = 0.0
00474 );
00475
00476 protected:
00477 SRM_Axis_Angle_Params _axis_angle;
00478
00479 virtual void _updateIntData() const;
00480 virtual void _updateRepData();
00481 };
00482
00483
00488 class EXPORT_SRM_CPP_DLL OrientationEulerAnglesZXZ : public Orientation
00489 {
00490 public:
00493 OrientationEulerAnglesZXZ();
00494
00501 OrientationEulerAnglesZXZ(const SRM_Euler_Angles_ZXZ_Params & params );
00502
00512 OrientationEulerAnglesZXZ
00513 (
00514 SRM_Long_Float spin,
00515 SRM_Long_Float nutation,
00516 SRM_Long_Float precession
00517 );
00518
00521 OrientationEulerAnglesZXZ(const Orientation &other);
00522
00525 virtual Orientation & operator=(const Orientation &other);
00526
00529 virtual SRM_Euler_Angles_ZXZ_Params getEulerAnglesZXZ() const
00530 {
00531 return _euler_angles;
00532 }
00533
00540 virtual void setEulerAnglesZXZ
00541 (
00542 const SRM_Euler_Angles_ZXZ_Params & params
00543 );
00544
00554 virtual void setEulerAnglesZXZ
00555 (
00556 SRM_Long_Float spin,
00557 SRM_Long_Float nutation,
00558 SRM_Long_Float precession
00559 )
00560 {
00561 Orientation::setEulerAnglesZXZ(spin, nutation, precession);
00562 }
00563
00566 virtual std::string toString() const;
00567
00570 virtual SRM_Ori_Rep_Type getOriRep() const
00571 {
00572 return SRM_ORI_REP_EULER_ANGLES_ZXZ;
00573 }
00574
00578 static bool isValidParams(const SRM_Euler_Angles_ZXZ_Params ¶ms);
00579
00584 static OrientationEulerAnglesZXZ compose
00585 (
00586 const Orientation &left,
00587 const Orientation &right
00588 );
00589
00592 static bool equivParams
00593 (
00594 const SRM_Euler_Angles_ZXZ_Params ¶ms1,
00595 const SRM_Euler_Angles_ZXZ_Params ¶ms2,
00596 SRM_Long_Float tolerance = 0.0
00597 );
00598
00599 protected:
00600 SRM_Euler_Angles_ZXZ_Params _euler_angles;
00601
00602 virtual void _updateIntData() const;
00603 virtual void _updateRepData();
00604 };
00605
00606
00611 class EXPORT_SRM_CPP_DLL OrientationTaitBryanAngles : public Orientation
00612 {
00613 public:
00616 OrientationTaitBryanAngles();
00617
00624 OrientationTaitBryanAngles(const SRM_Tait_Bryan_Angles_Params ¶ms);
00625
00635 OrientationTaitBryanAngles
00636 (
00637 SRM_Long_Float roll,
00638 SRM_Long_Float pitch,
00639 SRM_Long_Float yaw
00640 );
00641
00644 OrientationTaitBryanAngles(const Orientation &other);
00645
00648 virtual Orientation & operator=(const Orientation &other);
00649
00652 virtual SRM_Tait_Bryan_Angles_Params getTaitBryanAngles() const
00653 {
00654 return _tait_bryan_angles;
00655 }
00656
00663 virtual void setTaitBryanAngles
00664 (
00665 const SRM_Tait_Bryan_Angles_Params & params
00666 );
00667
00677 virtual void setTaitBryanAngles
00678 (
00679 SRM_Long_Float roll,
00680 SRM_Long_Float pitch,
00681 SRM_Long_Float yaw
00682 )
00683 {
00684 Orientation::setTaitBryanAngles(roll, pitch, yaw);
00685 }
00686
00689 virtual std::string toString() const;
00690
00693 virtual SRM_Ori_Rep_Type getOriRep() const
00694 {
00695 return SRM_ORI_REP_TAIT_BRYAN_ANGLES;
00696 }
00697
00701 static bool isValidParams(const SRM_Tait_Bryan_Angles_Params & params );
00702
00707 static OrientationTaitBryanAngles compose
00708 (
00709 const Orientation &left,
00710 const Orientation &right
00711 );
00712
00715 static bool equivParams
00716 (
00717 const SRM_Tait_Bryan_Angles_Params ¶ms1,
00718 const SRM_Tait_Bryan_Angles_Params ¶ms2,
00719 SRM_Long_Float tolerance = 0.0
00720 );
00721
00722 protected:
00723 SRM_Tait_Bryan_Angles_Params _tait_bryan_angles;
00724
00725 virtual void _updateIntData() const;
00726 virtual void _updateRepData();
00727 };
00728
00729
00734 class EXPORT_SRM_CPP_DLL OrientationQuaternion : public Orientation
00735 {
00736 public:
00739 OrientationQuaternion();
00740
00746 OrientationQuaternion(const SRM_Quaternion_Params ¶ms);
00747
00757 OrientationQuaternion
00758 (
00759 SRM_Long_Float e0,
00760 SRM_Long_Float e1,
00761 SRM_Long_Float e2,
00762 SRM_Long_Float e3
00763 );
00764
00767 OrientationQuaternion(const Orientation &other);
00768
00771 virtual Orientation & operator=(const Orientation &other);
00772
00775 virtual SRM_Quaternion_Params getQuaternion() const
00776 {
00777 return _quaternion;
00778 }
00779
00785 virtual void setQuaternion(const SRM_Quaternion_Params & params );
00786
00796 virtual void setQuaternion
00797 (
00798 SRM_Long_Float e0,
00799 SRM_Long_Float e1,
00800 SRM_Long_Float e2,
00801 SRM_Long_Float e3
00802 )
00803 {
00804 Orientation::setQuaternion(e0, e1, e2, e3);
00805 }
00806
00809 virtual std::string toString() const;
00810
00813 virtual SRM_Ori_Rep_Type getOriRep() const
00814 {
00815 return SRM_ORI_REP_QUATERNION;
00816 }
00817
00820 static bool isValidParams(const SRM_Quaternion_Params ¶ms );
00821
00826 static OrientationQuaternion compose
00827 (
00828 const Orientation &left,
00829 const Orientation &right
00830 );
00831
00834 static bool equivParams
00835 (
00836 const SRM_Quaternion_Params ¶ms1,
00837 const SRM_Quaternion_Params ¶ms2,
00838 SRM_Long_Float tolerance = 0.0
00839 );
00840
00841 protected:
00842 SRM_Quaternion_Params _quaternion;
00843
00844 virtual void _updateIntData() const;
00845 virtual void _updateRepData();
00846 };
00847
00848 }
00849
00850 #endif // _Orientation_h