00001 /**************************************************************************** 00002 * Copyright 2007 Evan Drumwright 00003 * This library is distributed under the terms of the GNU General Public 00004 * License (found in COPYING). 00005 ****************************************************************************/ 00006 00007 #ifndef _EULER_ANGLES_H 00008 #define _EULER_ANGLES_H 00009 00010 #include <string> 00011 #include <Physsim/Base.h> 00012 #include <Physsim/Quat.h> 00013 #include <Physsim/Matrix3.h> 00014 #include <Physsim/Matrix4.h> 00015 #include <Physsim/Vector3.h> 00016 00017 namespace Physsim { 00018 00019 class Quat; 00020 class Matrix3; 00021 class Matrix4; 00022 class Vector3; 00023 class Vector4; 00024 00026 00032 class EulerAngles : public Base 00033 { 00034 public: 00036 enum EulerAngleType { eRollPitchYaw }; 00037 00038 EulerAngles(); 00039 EulerAngles(EulerAngleType type); 00040 EulerAngles(const EulerAngles& source); 00041 EulerAngles(const Quat* q, EulerAngleType type); 00042 EulerAngles(Real alpha, Real beta, Real gamma, EulerAngleType type); 00043 EulerAngles(const Matrix3* m, EulerAngleType type); 00044 bool epsilon_equals(const EulerAngles& e, Real epsilon) const; 00045 static bool epsilon_equals(const EulerAngles& a1, const EulerAngles& a2, Real epsilon); 00046 void set(const Matrix3* m); 00047 void set(const Quat* q); 00048 void operator=(const EulerAngles& source); 00049 EulerAngles operator*(const EulerAngles& e) const; 00050 void operator*=(const EulerAngles& e); 00051 void to_quat(Quat* q) const; 00052 void to_matrix(Matrix3* m) const; 00053 void to_axis_angle(AAngle* a) const; 00054 void set_type(EulerAngleType type); 00055 00057 EulerAngleType get_type() const { return _type; } 00058 00059 Real _alpha; 00060 Real _beta; 00061 Real _gamma; 00062 00063 private: 00064 EulerAngleType _type; 00065 }; 00066 00067 std::ostream& operator<<(std::ostream& out, const EulerAngles& a); 00068 00069 } 00070 00071 #endif 00072
1.5.1