Flow Visualisation
quaternion.hpp
Go to the documentation of this file.
1 
40 #ifndef GLM_GTC_quaternion
41 #define GLM_GTC_quaternion GLM_VERSION
42 
43 // Dependency:
44 #include "../glm.hpp"
45 #include "../gtc/half_float.hpp"
46 #include "../gtc/constants.hpp"
47 
48 #if(defined(GLM_MESSAGES) && !defined(glm_ext))
49 # pragma message("GLM: GLM_GTC_quaternion extension included")
50 #endif
51 
52 namespace glm{
53 namespace detail
54 {
55  template <typename T>
56  struct tquat// : public genType<T, tquat>
57  {
58  enum ctor{null};
59 
60  typedef T value_type;
61  typedef std::size_t size_type;
62 
63  public:
64  value_type x, y, z, w;
65 
66  GLM_FUNC_DECL size_type length() const;
67 
68  // Constructors
69  tquat();
70  explicit tquat(
71  value_type const & s,
72  glm::detail::tvec3<T> const & v);
73  explicit tquat(
74  value_type const & w,
75  value_type const & x,
76  value_type const & y,
77  value_type const & z);
78 
79  // Convertions
80 
82  explicit tquat(
83  tvec3<T> const & eulerAngles);
84  explicit tquat(
85  tmat3x3<T> const & m);
86  explicit tquat(
87  tmat4x4<T> const & m);
88 
89  // Accesses
90  value_type & operator[](int i);
91  value_type const & operator[](int i) const;
92 
93  // Operators
94  tquat<T> & operator*=(value_type const & s);
95  tquat<T> & operator/=(value_type const & s);
96  };
97 
98  template <typename T>
100  detail::tquat<T> const & q);
101 
102  template <typename T>
104  detail::tquat<T> const & q,
105  detail::tquat<T> const & p);
106 
107  template <typename T>
109  detail::tquat<T> const & q,
110  detail::tquat<T> const & p);
111 
112  template <typename T>
114  detail::tquat<T> const & q,
115  detail::tvec3<T> const & v);
116 
117  template <typename T>
119  detail::tvec3<T> const & v,
120  detail::tquat<T> const & q);
121 
122  template <typename T>
124  detail::tquat<T> const & q,
125  detail::tvec4<T> const & v);
126 
127  template <typename T>
129  detail::tvec4<T> const & v,
130  detail::tquat<T> const & q);
131 
132  template <typename T>
134  detail::tquat<T> const & q,
135  typename detail::tquat<T>::value_type const & s);
136 
137  template <typename T>
139  typename detail::tquat<T>::value_type const & s,
140  detail::tquat<T> const & q);
141 
142  template <typename T>
144  detail::tquat<T> const & q,
145  typename detail::tquat<T>::value_type const & s);
146 
147 } //namespace detail
148 
151 
155  template <typename T>
156  T length(
157  detail::tquat<T> const & q);
158 
162  template <typename T>
164  detail::tquat<T> const & q);
165 
169  template <typename T>
170  T dot(
171  detail::tquat<T> const & q1,
172  detail::tquat<T> const & q2);
173 
184  template <typename T>
186  detail::tquat<T> const & x,
187  detail::tquat<T> const & y,
188  T const & a);
189 
198  template <typename T>
200  detail::tquat<T> const & x,
201  detail::tquat<T> const & y,
202  T const & a);
203 
212  template <typename T>
214  detail::tquat<T> const & x,
215  detail::tquat<T> const & y,
216  T const & a);
217 
221  template <typename T>
223  detail::tquat<T> const & q);
224 
228  template <typename T>
230  detail::tquat<T> const & q);
231 
239  template <typename T>
241  detail::tquat<T> const & q,
242  typename detail::tquat<T>::value_type const & angle,
243  detail::tvec3<T> const & axis);
244 
248  template <typename T>
250  detail::tquat<T> const & x);
251 
255  template <typename valType>
256  valType roll(
257  detail::tquat<valType> const & x);
258 
262  template <typename valType>
263  valType pitch(
264  detail::tquat<valType> const & x);
265 
269  template <typename valType>
270  valType yaw(
271  detail::tquat<valType> const & x);
272 
276  template <typename T>
278  detail::tquat<T> const & x);
279 
283  template <typename T>
285  detail::tquat<T> const & x);
286 
290  template <typename T>
292  detail::tmat3x3<T> const & x);
293 
297  template <typename T>
299  detail::tmat4x4<T> const & x);
300 
304  template <typename valType>
305  valType angle(
306  detail::tquat<valType> const & x);
307 
311  template <typename valType>
313  detail::tquat<valType> const & x);
314 
323  template <typename valType>
325  valType const & angle,
326  valType const & x,
327  valType const & y,
328  valType const & z);
329 
336  template <typename valType>
338  valType const & angle,
339  detail::tvec3<valType> const & axis);
340 
345 
350 
355 
360 
365 
370 
375 
377 } //namespace glm
378 
379 #include "quaternion.inl"
380 
381 #endif//GLM_GTC_quaternion
detail::tquat< mediump_float > mediump_quat
Definition: quaternion.hpp:369
detail::tquat< T > conjugate(detail::tquat< T > const &q)
Definition: quaternion.inl:530
detail::tquat< valType > angleAxis(valType const &angle, valType const &x, valType const &y, valType const &z)
Definition: quaternion.inl:759
detail::tquat< highp_float > highp_quat
Definition: quaternion.hpp:374
ctor
Definition: quaternion.hpp:58
detail::tmat4x4< T > mat4_cast(detail::tquat< T > const &x)
Definition: quaternion.inl:648
detail::tmat4x4< T > rotate(detail::tmat4x4< T > const &m, T const &angle, detail::tvec3< T > const &axis)
Definition: matrix_transform.inl:45
Definition: type_mat2x2.hpp:45
GLM_FUNC_DECL genType::value_type dot(genType const &x, genType const &y)
Definition: func_geometric.inl:132
Definition: _detail.hpp:38
detail::tquat< T > slerp(detail::tquat< T > const &x, detail::tquat< T > const &y, T const &a)
Returns the slurp interpolation between two quaternions.
Definition: quaternion.inl:492
tquat< T > & operator*=(value_type const &s)
Definition: quaternion.inl:148
valType yaw(detail::tquat< valType > const &x)
Definition: quaternion.inl:614
detail::tvec3< T > eulerAngles(detail::tquat< T > const &x)
Definition: quaternion.inl:579
Definition: _swizzle.hpp:43
value_type z
Definition: quaternion.hpp:64
T value_type
Definition: quaternion.hpp:60
GLM_FUNC_DECL half operator+(half const &s1, half const &s2)
Definition: type_half.inl:330
value_type x
Definition: quaternion.hpp:64
detail::tquat< float > quat
Definition: quaternion.hpp:344
detail::tquat< double > dquat
Definition: quaternion.hpp:359
detail::tquat< float > fquat
Definition: quaternion.hpp:354
GLM_FUNC_DECL half operator-(half const &s1, half const &s2)
Definition: type_half.inl:335
GLM_FUNC_DECL genType normalize(genType const &x)
Definition: func_geometric.inl:213
detail::tquat< T > lerp(detail::tquat< T > const &x, detail::tquat< T > const &y, T const &a)
Definition: quaternion.inl:477
valType roll(detail::tquat< valType > const &x)
Definition: quaternion.inl:588
valType pitch(detail::tquat< valType > const &x)
Definition: quaternion.inl:601
tquat()
Definition: quaternion.inl:41
Definition: quaternion.hpp:56
Definition: type_mat2x2.hpp:39
Definition: quaternion.hpp:58
detail::tquat< detail::half > hquat
Definition: quaternion.hpp:349
GLM_FUNC_DECL half operator*(half const &s1, half const &s2)
Definition: type_half.inl:340
GLM_FUNC_DECL size_type length() const
Definition: quaternion.inl:35
value_type & operator[](int i)
Definition: quaternion.inl:132
value_type w
Definition: quaternion.hpp:64
GLM_FUNC_DECL detail::tmat2x2< valType > inverse(detail::tmat2x2< valType > const &m)
Definition: type_mat2x2.hpp:40
value_type y
Definition: quaternion.hpp:64
detail::tvec3< valType > axis(detail::tquat< valType > const &x)
detail::tquat< T > quat_cast(detail::tmat3x3< T > const &x)
Definition: quaternion.inl:657
std::size_t size_type
Definition: quaternion.hpp:61
GLM_FUNC_DECL genTypeT mix(genTypeT const &x, genTypeT const &y, genTypeU const &a)
GLM_FUNC_DECL half operator/(half const &s1, half const &s2)
Definition: type_half.inl:345
tquat< T > & operator/=(value_type const &s)
Definition: quaternion.inl:161
GLM_FUNC_DECL genType::value_type length(genType const &x)
Definition: func_geometric.inl:34
Definition: type_mat2x2.hpp:49
valType angle(detail::tquat< valType > const &x)
detail::tmat3x3< T > mat3_cast(detail::tquat< T > const &x)
Definition: quaternion.inl:627
detail::tquat< lowp_float > lowp_quat
Definition: quaternion.hpp:364
#define GLM_FUNC_DECL
Definition: setup.hpp:678