Rotation.h
Go to the documentation of this file.
1 /*
2  * This file is part of ALVAR, A Library for Virtual and Augmented Reality.
3  *
4  * Copyright 2007-2012 VTT Technical Research Centre of Finland
5  *
6  * Contact: VTT Augmented Reality Team <alvar.info@vtt.fi>
7  * <http://www.vtt.fi/multimedia/alvar.html>
8  *
9  * ALVAR is free software; you can redistribute it and/or modify it under the
10  * terms of the GNU Lesser General Public License as published by the Free
11  * Software Foundation; either version 2.1 of the License, or (at your option)
12  * any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
17  * for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with ALVAR; if not, see
21  * <http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html>.
22  */
23 
24 #ifndef ROTATION_H
25 #define ROTATION_H
26 
27 #include <iostream>
28 
35 #include "Alvar.h"
36 #include "Util.h"
37 
38 namespace alvar {
39 
44 {
45 
46 public:
48  double quaternion[4];
49 
53  enum RotationType {QUAT, MAT, EUL, ROD};
54 
55  Rotation();
56  Rotation(const Rotation& r);
57 
63  Rotation(CvMat *data, RotationType t);
64 
65  Rotation& operator = (const Rotation& p);
66  Rotation& operator += (const Rotation& v);
67  //Rotation& operator + () {return *this;}
68 
69  void Transpose();
70 
78  static void MirrorMat(CvMat *mat, bool x, bool y, bool z);
79 
86  void Mirror(bool x, bool y, bool z);
87 
91  void Reset();
92 
98  static void Mat9ToRod(double *mat, double *rod);
99 
105  static void RodToMat9(double *rod, double *mat);
106 
112  static void QuatInv(const double *q, double *qi);
113 
118  static void QuatNorm(double *q);
119 
126  static void QuatMul(const double *q1, const double *q2, double *q3);
127 
128  //% The quaternion has to be normalized!!!
134  static void QuatToMat9(const double *quat, double *mat);
135 
136  // TODO: Now we don't want to eliminate the translation part from the matrix here. Did this change break something???
142  static void QuatToMat16(const double *quat, double *mat);
143 
149  static void QuatToEul(const double *q, double *eul);
150 
156  static void Mat9ToQuat(const double *mat, double *quat);
157 
163  static void EulToQuat(const double *eul, double *quat);
164 
169  void SetQuaternion(CvMat *mat);
170 
175  void SetQuaternion(const double *quat);
176 
181  void SetEuler(const CvMat *mat);
182 
187  void SetRodriques(const CvMat *mat);
188 
193  void SetMatrix(const CvMat *mat);
194 
199  void GetMatrix(CvMat *mat) const;
200 
205  void GetRodriques(CvMat *mat) const;
206 
211  void GetEuler(CvMat *mat) const;
212 
217  void GetQuaternion(CvMat *mat) const;
218 };
219 
220 } // namespace alvar
221 
222 #endif
Main ALVAR namespace.
Definition: Alvar.h:174
CvMat quaternion_mat
Definition: Rotation.h:47
RotationType
Rotation can be represented in four ways: quaternion (QUAT), matrix (MAT), euler angles (EUL) and exp...
Definition: Rotation.h:53
TFSIMD_FORCE_INLINE const tfScalar & y() const
TFSIMD_FORCE_INLINE const tfScalar & x() const
This file implements generic utility functions and a serialization interface.
TFSIMD_FORCE_INLINE const tfScalar & z() const
#define ALVAR_EXPORT
Definition: Alvar.h:168
Rotation structure and transformations between different parameterizations.
Definition: Rotation.h:43
r
This file defines library export definitions, version numbers and build information.


ar_track_alvar
Author(s): Scott Niekum
autogenerated on Mon Jun 10 2019 12:47:04