quaternion.h
Go to the documentation of this file.
00001 // HOG-Man - Hierarchical Optimization for Pose Graphs on Manifolds
00002 // Copyright (C) 2010 G. Grisetti, R. Kümmerle, C. Stachniss
00003 // 
00004 // HOG-Man is free software: you can redistribute it and/or modify
00005 // it under the terms of the GNU Lesser General Public License as published
00006 // by the Free Software Foundation, either version 3 of the License, or
00007 // (at your option) any later version.
00008 // 
00009 // HOG-Man is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU Lesser General Public License for more details.
00013 // 
00014 // You should have received a copy of the GNU Lesser General Public License
00015 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
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);  // Enable cast from quaternions with other, but compatible base
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   //this function normalizes the quaternion and ensures thar w>0.
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
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


hogman_minimal
Author(s): Maintained by Juergen Sturm
autogenerated on Wed Dec 26 2012 15:36:49