Flair
Framework Libre Air
Quaternion.h
Go to the documentation of this file.
1 // %flair:license{
2 // This file is part of the Flair framework distributed under the
3 // CECILL-C License, Version 1.0.
4 // %flair:license}
12 #ifndef QUATERNION_H
13 #define QUATERNION_H
14 
15 #include <Vector3D.h>
16 
17 namespace flair {
18 namespace core {
19 class Euler;
20 class RotationMatrix;
21 
26 class Quaternion {
27 public:
38  Quaternion(float q0 = 1, float q1 = 0, float q2 = 0, float q3 = 0);
39 
44  ~Quaternion();
45 
51  float GetNorm(void) const;
52 
56  void Normalize(void);
57 
65  void GetLogarithm(Vector3Df &logarithm);
66 
74  Vector3Df GetLogarithm(void);
75 
79  void Conjugate(void);
80 
87 
95  Quaternion GetDerivative(const Vector3Df &angularSpeed) const;
96 
102  void Derivate(const Vector3Df &angularSpeed);
103 
109  void ToEuler(Euler &euler) const;
110 
116  Euler ToEuler(void) const;
117 
123  void ToRotationMatrix(RotationMatrix &matrix) const;
124 
128  float q0;
129 
133  float q1;
134 
138  float q2;
139 
143  float q3;
144 
145  Quaternion &operator+=(const Quaternion &quaternion);
146  Quaternion &operator-=(const Quaternion &quaternion);
147  Quaternion &operator=(const Quaternion &quaternion);
148 };
149 
159 Quaternion operator+(Quaternion const &quaterniontA,
160  Quaternion const &quaterniontB);
161 
171 Quaternion operator-(Quaternion const &quaternionA,
172  Quaternion const &quaterniontB);
173 
182 Quaternion operator-(const Quaternion &quaternion);
183 
193 Quaternion operator*(Quaternion const &quaternionA,
194  Quaternion const &quaterniontB);
195 
205 Quaternion operator*(float coeff, Quaternion const &quaternion);
206 
216 Quaternion operator*(Quaternion const &quaternion, float coeff);
217 
218 } // end namespace core
219 } // end namespace flair
220 
221 #endif // QUATERNION_H
float GetNorm(void) const
Norm.
Quaternion(float q0=1, float q1=0, float q2=0, float q3=0)
Constructor.
namespace of the flair Framework
Definition: Ahrs.h:19
void Normalize(void)
Normalize.
void Conjugate(void)
Conjugate.
Class defining euler angles.
Definition: Euler.h:27
float q1
q1
Definition: Quaternion.h:133
Class defining a rotation matrix.
Definition: RotationMatrix.h:26
Class defining a 3D vector.
Quaternion GetDerivative(const Vector3Df &angularSpeed) const
Derivative.
void Derivate(const Vector3Df &angularSpeed)
Derivate.
void ToRotationMatrix(RotationMatrix &matrix) const
Convert to rotation matrix.
Quaternion GetConjugate(void)
Conjugate.
float q2
q2
Definition: Quaternion.h:138
~Quaternion()
Destructor.
Quaternion operator*(Quaternion const &quaternionA, Quaternion const &quaterniontB)
Multiply.
float q0
q0
Definition: Quaternion.h:128
Quaternion operator-(Quaternion const &quaternionA, Quaternion const &quaterniontB)
Substract.
float q3
q3
Definition: Quaternion.h:143
Vector3Df GetLogarithm(void)
Logarithm.
Euler ToEuler(void) const
Convert to euler angles.
Quaternion operator+(Quaternion const &quaterniontA, Quaternion const &quaterniontB)
Add.
Class defining a quaternion.
Definition: Quaternion.h:26