Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
mia
3d
quaternion.hh
Go to the documentation of this file.
1
/* -*- mia-c++ -*-
2
*
3
* This file is part of MIA - a toolbox for medical image analysis
4
* Copyright (c) Leipzig, Madrid 1999-2013 Gert Wollny
5
*
6
* MIA is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 3 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with MIA; if not, see <http://www.gnu.org/licenses/>.
18
*
19
*/
20
21
#ifndef mia_3d_quaternion_hh
22
#define mia_3d_quaternion_hh
23
24
#include <ostream>
25
#include <
mia/3d/defines3d.hh
>
26
#include <
mia/3d/vector.hh
>
27
28
29
NS_MIA_BEGIN
30
38
class
EXPORT_3D
Quaternion
{
39
40
public
:
44
Quaternion
();
45
50
Quaternion
(
const
Quaternion
& other) =
default
;
51
57
Quaternion
(
const
C3DDVector
& rot);
58
62
Quaternion
(
double
w,
double
x,
double
y,
double
z);
63
70
friend
bool
operator ==
(
const
Quaternion
& a,
const
Quaternion
& b);
71
73
double
norm()
const
;
74
76
void
normalize
();
77
79
Quaternion
inverse()
const
;
80
82
C3DDVector
get_euler_angles()
const
;
83
89
Quaternion
&
operator +=
(
const
Quaternion
& other);
90
96
Quaternion
& operator -= (
const
Quaternion
& other);
97
104
Quaternion
& operator *= (
const
Quaternion
& other);
105
110
void
print(std::ostream& os)
const
;
111
113
double
w()
const
;
114
116
double
x()
const
;
117
119
double
y()
const
;
120
122
double
z()
const
;
123
124
private
:
125
C3DDVector
m_v;
126
double
m_w;
127
};
128
129
130
bool
EXPORT_3D
operator ==
(
const
Quaternion
& a,
const
Quaternion
& b);
131
bool
EXPORT_3D
operator !=
(
const
Quaternion
& a,
const
Quaternion
& b);
132
133
134
135
136
inline
double
Quaternion::w
()
const
137
{
138
return
m_w;
139
}
140
141
inline
double
Quaternion::x
()
const
142
{
143
return
m_v.
x
;
144
}
145
146
inline
double
Quaternion::y
()
const
147
{
148
return
m_v.
y
;
149
}
150
151
inline
double
Quaternion::z
()
const
152
{
153
return
m_v.
z
;
154
}
155
156
157
158
inline
std::ostream&
operator <<
(std::ostream& os,
const
Quaternion
& a)
159
{
160
a.
print
(os);
161
return
os;
162
}
163
164
NS_MIA_END
165
166
#endif
Generated on Tue Oct 15 2013 13:56:37 by
1.8.4