Main Page
Namespaces
Classes
Files
File List
File Members
quaternion.hpp
Go to the documentation of this file.
1
/*
2
** TP CPE Lyon
3
** Copyright (C) 2013 Damien Rohmer & David Odin
4
**
5
** This program is free software: you can redistribute it and/or modify
6
** it under the terms of the GNU General Public License as published by
7
** the Free Software Foundation, either version 3 of the License, or
8
** (at your option) any later version.
9
**
10
** This program is distributed in the hope that it will be useful,
11
** but WITHOUT ANY WARRANTY; without even the implied warranty of
12
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
** GNU General Public License for more details.
14
**
15
** You should have received a copy of the GNU General Public License
16
** along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#ifndef QUATERNION_HPP
20
#define QUATERNION_HPP
21
22
#include <
vec4.hpp
>
23
24
namespace
cpe
25
{
26
class
matrix3;
27
29
class
quaternion
:
public
vec4
30
{
31
public
:
32
// ********************************************* //
33
// ********************************************* //
34
// CONSTRUCTORS
35
// ********************************************* //
36
// ********************************************* //
37
39
quaternion
();
41
quaternion
(
const
vec3
&
axis
,
float
angle
);
43
quaternion
(
const
vec4
& v);
45
quaternion
(
float
x
,
float
y
,
float
z
,
float
w
);
46
47
48
// ********************************************* //
49
// ********************************************* //
50
// GET
51
// ********************************************* //
52
// ********************************************* //
53
55
vec3
axis
()
const
;
57
float
angle
()
const
;
58
59
// ********************************************* //
60
// ********************************************* //
61
// Math
62
// ********************************************* //
63
// ********************************************* //
64
68
matrix3
matrix
()
const
;
69
71
quaternion
conjugated
()
const
;
72
78
static
quaternion
slerp
(
const
quaternion
& q0,
const
quaternion
& q1,
const
float
alpha);
79
81
vec3
rotate
(
const
vec3
& vec)
const
;
82
83
84
// ********************************************* //
85
// ********************************************* //
86
// Operators
87
// ********************************************* //
88
// ********************************************* //
89
91
quaternion
&
operator*=
(
const
quaternion
& q);
93
quaternion
&
operator*=
(
float
s);
95
quaternion
&
operator+=
(
const
quaternion
& q);
97
quaternion
&
operator-=
(
const
quaternion
& q);
99
quaternion
&
operator/=
(
float
s);
100
102
quaternion
operator*
(
const
quaternion
& q)
const
;
104
quaternion
operator*
(
const
vec3
& v)
const
;
106
quaternion
operator*
(
float
s)
const
;
108
quaternion
operator+
(
const
quaternion
& q)
const
;
110
quaternion
operator-
(
const
quaternion
& q)
const
;
112
quaternion
operator/
(
float
s)
const
;
113
115
quaternion
operator-
()
const
;
116
117
118
119
120
121
122
private
:
123
124
};
125
127
quaternion
operator*
(
float
s,
const
quaternion
& q);
128
129
131
class
exception_quaternion
:
public
exception_vec4
132
{
133
public
:
134
136
exception_quaternion
():
exception_vec4
(){}
138
exception_quaternion
(
const
std::string& msg_param,
const
std::string& file_param,
const
std::string& caller_param,
const
int
& line_param):
exception_vec4
(msg_param,file_param,caller_param,line_param){}
139
};
140
141
142
}
143
144
#endif
lib3d
quaternion.hpp
Generated on Fri Mar 29 2013 22:45:31 by
1.8.3.1