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 _ROTATIONMATRIX_H_
00018 #define _ROTATIONMATRIX_H_
00019
00020 #include "matrix_n.h"
00021
00031 template <int N, typename Base=double>
00032 struct _RotationMatrix: public _Matrix<N, N, Base> {
00033 static const int Dimension=N;
00035 _RotationMatrix();
00037 _RotationMatrix<N,Base>& operator*=(const _RotationMatrix<N,Base>& m);
00039 _RotationMatrix<N,Base> operator*(const _RotationMatrix<N,Base>& m) const;
00041 _Vector<N,Base> operator*(const _Vector<N,Base>& v) const;
00043 _RotationMatrix<N,Base> inverse() const;
00044 protected:
00045 _RotationMatrix(const _Matrix<N,N,Base> &m);
00046 };
00047
00049 template < typename Base=double >
00050 struct _RotationMatrix2: public _RotationMatrix<2, Base>{
00051 static const int Angles=1;
00052 _RotationMatrix2();
00054 _RotationMatrix2(Base angle);
00056 _RotationMatrix2(const _Vector<1,Base>& angles);
00057 _RotationMatrix2(const _RotationMatrix<2,Base>& rm) {this->_allocator=rm._allocator;}
00060 _RotationMatrix2<Base> rotationMatrix() const {return *this;}
00062 _Vector<1, Base> angles() const {_Vector<1, Base> v; v[0]=angle(); return v;}
00063 Base angle() const;
00064 };
00065
00067 template <typename Base = double >
00068 struct _RotationMatrix3: public _RotationMatrix<3, Base>{
00069 static const int Angles=3;
00070 _RotationMatrix3();
00072 _RotationMatrix3(const _Vector<3, Base>& angles);
00073 _RotationMatrix3(const _RotationMatrix<3,Base>& rm) {this->_allocator=rm._allocator;}
00075 _RotationMatrix3(Base roll, Base pitch, Base yaw);
00078 _RotationMatrix3<Base> rotationMatrix() const {return *this;}
00080 _Vector<3, Base> angles() const;
00081 };
00083
00084 typedef _RotationMatrix2<double> RotationMatrix2;
00085 typedef _RotationMatrix3<double> RotationMatrix3;
00086 typedef _RotationMatrix2<float> RotationMatrix2f;
00087 typedef _RotationMatrix3<float> RotationMatrix3f;
00088
00089 #include "rotation_matrix.hpp"
00090
00091
00092 #endif