Rotation.h
Go to the documentation of this file.
00001 /*
00002  * This file is part of ALVAR, A Library for Virtual and Augmented Reality.
00003  *
00004  * Copyright 2007-2012 VTT Technical Research Centre of Finland
00005  *
00006  * Contact: VTT Augmented Reality Team <alvar.info@vtt.fi>
00007  *          <http://www.vtt.fi/multimedia/alvar.html>
00008  *
00009  * ALVAR is free software; you can redistribute it and/or modify it under the
00010  * terms of the GNU Lesser General Public License as published by the Free
00011  * Software Foundation; either version 2.1 of the License, or (at your option)
00012  * any later version.
00013  *
00014  * This library is distributed in the hope that it will be useful, but WITHOUT
00015  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00016  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
00017  * for more details.
00018  *
00019  * You should have received a copy of the GNU Lesser General Public License
00020  * along with ALVAR; if not, see
00021  * <http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html>.
00022  */
00023 
00024 #ifndef ROTATION_H
00025 #define ROTATION_H
00026 
00027 #include <iostream>
00028 
00035 #include "Alvar.h"
00036 #include "Util.h"
00037 
00038 namespace alvar {
00039 
00043 class ALVAR_EXPORT Rotation
00044 {
00045 
00046 public: 
00047         CvMat quaternion_mat;
00048         double quaternion[4];
00049         
00053         enum RotationType {QUAT, MAT, EUL, ROD};
00054 
00055         Rotation();
00056         Rotation(const Rotation& r);
00057         
00063         Rotation(CvMat *data, RotationType t);
00064 
00065         Rotation& operator  = (const Rotation& p);
00066         Rotation& operator += (const Rotation& v);
00067         //Rotation& operator +  () {return *this;}
00068 
00069         void Transpose();
00070         
00078         static void MirrorMat(CvMat *mat, bool x, bool y, bool z);
00079         
00086         void Mirror(bool x, bool y, bool z);
00087 
00091         void Reset();
00092 
00098         static void Mat9ToRod(double *mat, double *rod);
00099 
00105         static void RodToMat9(double *rod, double *mat);
00106 
00112         static void QuatInv(const double *q, double *qi);
00113         
00118         static void QuatNorm(double *q);
00119         
00126         static void QuatMul(const double *q1, const double *q2, double *q3);
00127 
00128         //%  The quaternion has to be normalized!!!
00134         static void QuatToMat9(const double *quat, double *mat);
00135 
00136         // TODO: Now we don't want to eliminate the translation part from the matrix here. Did this change break something???
00142         static void QuatToMat16(const double *quat, double *mat);
00143         
00149         static void QuatToEul(const double *q, double *eul);
00150         
00156         static void Mat9ToQuat(const double *mat, double *quat);
00157         
00163         static void EulToQuat(const double *eul, double *quat);
00164         
00169         void SetQuaternion(CvMat *mat);
00170         
00175         void SetQuaternion(const double *quat);
00176         
00181         void SetEuler(const CvMat *mat);
00182         
00187         void SetRodriques(const CvMat *mat);
00188         
00193         void SetMatrix(const CvMat *mat);
00194         
00199         void GetMatrix(CvMat *mat) const;
00200         
00205         void GetRodriques(CvMat *mat) const;
00206         
00211         void GetEuler(CvMat *mat) const;
00212         
00217         void GetQuaternion(CvMat *mat) const;
00218 };
00219 
00220 } // namespace alvar
00221 
00222 #endif


ar_track_alvar
Author(s): Scott Niekum
autogenerated on Thu Jun 6 2019 21:12:54