Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _QUATERNION_H_
00018 #define _QUATERNION_H_
00019 #include <assert.h>
00020 #include <limits>
00021 #include <iostream>
00022 #include "rotation_matrix.h"
00023
00024 using namespace std;
00025
00028
00034 template <typename Base=double>
00035 struct _Quaternion : public _Vector<4, Base>
00036 {
00037 static const int Angles=3;
00038 static const int Dimension=3;
00039 _Quaternion();
00040 _Quaternion(Base x, Base y, Base z, Base w);
00041 _Quaternion(const _RotationMatrix3<Base>& m);
00042 _Quaternion(const _Vector<3, Base>& vec);
00043 _Quaternion(Base roll, Base pitch, Base yaw);
00044 _Quaternion<Base>& operator*=(const _Quaternion& q);
00045 _Quaternion<Base> operator* (const _Quaternion& q) const;
00046 template <typename Base2>
00047 _Quaternion(const _Quaternion<Base2>& other);
00048 _Vector<3, Base> operator*(const _Vector<3, Base>& v) const;
00049 inline _Quaternion<Base> inverse() const;
00050 inline _Vector<3, Base> angles() const;
00051
00052 _RotationMatrix3<Base> rotationMatrix() const;
00053 _Quaternion<Base> normalized() const;
00054
00055
00056 _Quaternion<Base>& normalize();
00057 Base angle() const;
00058 static inline _Quaternion<Base> slerp(const _Quaternion<Base>& from, const _Quaternion<Base>& to, Base lambda);
00059 protected:
00060 _Quaternion(const _Vector<4, Base>& v);
00061 };
00062
00063 typedef _Quaternion<double> Quaternion;
00064 typedef _Quaternion<float> Quaternionf;
00065
00067
00068 #include "quaternion.hpp"
00069
00070
00071 #endif