ALBA
albaQuaternion.h
Go to the documentation of this file.
1/*=========================================================================
2
3Program: ALBA (Agile Library for Biomedical Applications)
4Module: albaQuaternion
5Authors: Gianluigi Crimi
6
7Copyright (c) BIC
8All rights reserved. See Copyright.txt or
9
10
11This software is distributed WITHOUT ANY WARRANTY; without even
12the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13PURPOSE. See the above copyright notice for more information.
14
15=========================================================================*/
16
17#ifndef __albaQuaternion_H__
18#define __albaQuaternion_H__
19
20//----------------------------------------------------------------------------
21// includes :
22//----------------------------------------------------------------------------
23#include "albaDefines.h"
24
25//----------------------------------------------------------------------------
26// forward reference
27//----------------------------------------------------------------------------
28class albaVect3d;
29class albaMatrix;
30
36{
37public:
41 albaQuaternion(double w, double x, double y, double z);
43 albaQuaternion(double angle, albaVect3d &axis);
46
49
51 void AngleAxis(double &angle, albaVect3d &axis);
52
54 void Zero();
55
57 void Identity();
58
61
64
66 void Multiply(double s);
67
69 void Divide(double s);
70
73
76
79
81 void Dot( albaQuaternion &q, albaQuaternion &result);
82
85
88
90 double GetLength();
91
93 double GetNorm();
94
96 void Normalize();
97
99 bool Normalized();
100
103
105 void Inverse(albaQuaternion &result) ;
106
109
112
115
116 double& operator [](int i);
117
124
125 bool operator ==( double scalar);
126 bool operator !=( double scalar);
127
128
134
135protected:
136 double m_W;
137 double m_X;
138 double m_Y;
139 double m_Z;
140};
141
142
143
144#endif
albaMatrix - Time stamped 4x4 Matrix.
Definition: albaMatrix.h:44
A quaternion.
albaQuaternion(albaMatrix &matr)
Construct quaternion from rotation albaMatrix.
void Identity()
Set quaternion to identity.
bool Normalized()
return true if the quaternion is normalized
albaQuaternion operator*(double s)
void Subtract(albaQuaternion &q)
Subtract another quaternion from this quaternion.
void Multiply(double s)
Multiply this quaternion by a scalar.
double m_X
x component of quaternion
albaQuaternion Dot(albaQuaternion &q)
Dot product of two quaternions.
static albaQuaternion Slerp(albaQuaternion &a, albaQuaternion &b, double t)
Spherical linear interpolation.
double m_W
w component of quaternion
double & operator[](int i)
void Multiply(albaQuaternion &q)
Multiply this quaternion with another quaternion.
void Multiply(albaQuaternion &q, albaQuaternion &result)
Multiply this quaternion with another quaternion and store result in parameter.
albaQuaternion & operator*=(const albaQuaternion b)
double GetLength()
Calculate and returns the length of quaternion.
void Normalize()
Normalize the quaternion.
albaQuaternion & operator-=(albaQuaternion b)
albaQuaternion Conjugate()
Calculate conjugate of quaternion.
bool operator==(albaQuaternion &other)
Equals operator.
albaQuaternion & operator/=(double s)
bool operator!=(albaQuaternion &other)
Not equals operator.
void Divide(double s)
Divide this quaternion by a scalar.
double m_Z
z component of quaternion
albaQuaternion(double w, double x, double y, double z)
Constructor quaternion from real component w and imaginary x,y,z.
void Dot(albaQuaternion &q, albaQuaternion &result)
Dot product of two quaternions writing result to parameter.
albaQuaternion & operator+=(albaQuaternion b)
albaQuaternion operator-(albaQuaternion b)
albaQuaternion operator+(albaQuaternion b)
albaQuaternion Inverse()
Calculate inverse of quaternion.
void Zero()
Set quaternion to zero.
albaQuaternion(double angle, albaVect3d &axis)
Construct quaternion from angle - axis.
double GetNorm()
Calculate and returns the norm of quaternion.
void Inverse(albaQuaternion &result)
Calculate inverse of quaternion and store result in parameter.
albaQuaternion operator*(albaQuaternion b)
void Conjugate(albaQuaternion &result)
Calculate conjugate of quaternion and store result in parameter.
void Add(albaQuaternion &q)
Add another quaternion to this quaternion.
albaQuaternion()
Default constructor.
albaQuaternion & operator*=(double s)
albaMatrix ToMatrix()
Convert quaternion to albaMatrix.
albaQuaternion operator-()
void AngleAxis(double &angle, albaVect3d &axis)
Convert quaternion to angle - axis.
albaQuaternion operator/(double s)
double m_Y
y component of quaternion
Class Name: albaVect3d.
Definition: albaVect3d.h:35