simd_quat.hpp
Go to the documentation of this file.
1 
38 #pragma once
39 
40 // Dependency:
41 #include "../glm.hpp"
42 #include "../gtc/quaternion.hpp"
43 #include "../gtx/fast_trigonometry.hpp"
44 
45 #if(GLM_ARCH != GLM_ARCH_PURE)
46 
47 #if(GLM_ARCH & GLM_ARCH_SSE2)
48 # include "../gtx/simd_mat4.hpp"
49 #else
50 # error "GLM: GLM_GTX_simd_quat requires compiler support of SSE2 through intrinsics"
51 #endif
52 
53 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
54 # pragma message("GLM: GLM_GTX_simd_quat extension included")
55 #endif
56 
57 
58 // Warning silencer for nameless struct/union.
59 #if (GLM_COMPILER & GLM_COMPILER_VC)
60 # pragma warning(push)
61 # pragma warning(disable:4201) // warning C4201: nonstandard extension used : nameless struct/union
62 #endif
63 
64 
65 namespace glm{
66 namespace detail
67 {
70  GLM_ALIGNED_STRUCT(16) fquatSIMD
71  {
72  enum ctor{null};
73  typedef __m128 value_type;
74  typedef std::size_t size_type;
75  static size_type value_size();
76 
77  typedef fquatSIMD type;
78  typedef tquat<bool, defaultp> bool_type;
79 
80 #ifdef GLM_SIMD_ENABLE_XYZW_UNION
81  union
82  {
83  __m128 Data;
84  struct {float x, y, z, w;};
85  };
86 #else
87  __m128 Data;
88 #endif
89 
91  // Implicit basic constructors
92 
93  fquatSIMD();
94  fquatSIMD(__m128 const & Data);
95  fquatSIMD(fquatSIMD const & q);
96 
98  // Explicit basic constructors
99 
100  explicit fquatSIMD(
101  ctor);
102  explicit fquatSIMD(
103  float const & w,
104  float const & x,
105  float const & y,
106  float const & z);
107  explicit fquatSIMD(
108  quat const & v);
109  explicit fquatSIMD(
110  vec3 const & eulerAngles);
111 
112 
114  // Unary arithmetic operators
115 
116  fquatSIMD& operator =(fquatSIMD const & q);
117  fquatSIMD& operator*=(float const & s);
118  fquatSIMD& operator/=(float const & s);
119  };
120 
121 
123  // Arithmetic operators
124 
125  detail::fquatSIMD operator- (
126  detail::fquatSIMD const & q);
127 
128  detail::fquatSIMD operator+ (
129  detail::fquatSIMD const & q,
130  detail::fquatSIMD const & p);
131 
132  detail::fquatSIMD operator* (
133  detail::fquatSIMD const & q,
134  detail::fquatSIMD const & p);
135 
136  detail::fvec4SIMD operator* (
137  detail::fquatSIMD const & q,
138  detail::fvec4SIMD const & v);
139 
140  detail::fvec4SIMD operator* (
141  detail::fvec4SIMD const & v,
142  detail::fquatSIMD const & q);
143 
144  detail::fquatSIMD operator* (
145  detail::fquatSIMD const & q,
146  float s);
147 
148  detail::fquatSIMD operator* (
149  float s,
150  detail::fquatSIMD const & q);
151 
152  detail::fquatSIMD operator/ (
153  detail::fquatSIMD const & q,
154  float s);
155 
156 }//namespace detail
157 
158  typedef glm::detail::fquatSIMD simdQuat;
159 
162 
165  quat quat_cast(
166  detail::fquatSIMD const & x);
167 
170  detail::fquatSIMD quatSIMD_cast(
171  detail::fmat4x4SIMD const & m);
172 
175  template <typename T, precision P>
176  detail::fquatSIMD quatSIMD_cast(
177  detail::tmat4x4<T, P> const & m);
178 
181  template <typename T, precision P>
182  detail::fquatSIMD quatSIMD_cast(
183  detail::tmat3x3<T, P> const & m);
184 
187  detail::fmat4x4SIMD mat4SIMD_cast(
188  detail::fquatSIMD const & q);
189 
192  mat4 mat4_cast(
193  detail::fquatSIMD const & q);
194 
195 
199  float length(
200  detail::fquatSIMD const & x);
201 
205  detail::fquatSIMD normalize(
206  detail::fquatSIMD const & x);
207 
211  float dot(
212  detail::fquatSIMD const & q1,
213  detail::fquatSIMD const & q2);
214 
225  detail::fquatSIMD mix(
226  detail::fquatSIMD const & x,
227  detail::fquatSIMD const & y,
228  float const & a);
229 
238  detail::fquatSIMD lerp(
239  detail::fquatSIMD const & x,
240  detail::fquatSIMD const & y,
241  float const & a);
242 
251  detail::fquatSIMD slerp(
252  detail::fquatSIMD const & x,
253  detail::fquatSIMD const & y,
254  float const & a);
255 
256 
267  detail::fquatSIMD fastMix(
268  detail::fquatSIMD const & x,
269  detail::fquatSIMD const & y,
270  float const & a);
271 
279  detail::fquatSIMD fastSlerp(
280  detail::fquatSIMD const & x,
281  detail::fquatSIMD const & y,
282  float const & a);
283 
284 
288  detail::fquatSIMD conjugate(
289  detail::fquatSIMD const & q);
290 
294  detail::fquatSIMD inverse(
295  detail::fquatSIMD const & q);
296 
303  detail::fquatSIMD angleAxisSIMD(
304  float const & angle,
305  vec3 const & axis);
306 
315  detail::fquatSIMD angleAxisSIMD(
316  float const & angle,
317  float const & x,
318  float const & y,
319  float const & z);
320 
321 
322  // TODO: Move this to somewhere more appropriate. Used with fastMix() and fastSlerp().
324  __m128 fastSin(__m128 x);
325 
326 
328 }//namespace glm
329 
330 #include "simd_quat.inl"
331 
332 
333 #if (GLM_COMPILER & GLM_COMPILER_VC)
334 # pragma warning(pop)
335 #endif
336 
337 
338 #endif//(GLM_ARCH != GLM_ARCH_PURE)
w
RowVector3d w
glm::length
GLM_FUNC_DECL genType::value_type length(genType const &x)
glm::mat4
mat4x4 mat4
Definition: type_mat.hpp:441
glm::axis
GLM_FUNC_DECL detail::tvec3< T, P > axis(detail::tquat< T, P > const &x)
glm::quat
highp_quat quat
Quaternion of default single-precision floating-point numbers.
Definition: fwd.hpp:68
type
detail
glm::vec3
highp_vec3 vec3
Definition: type_vec.hpp:392
y
Matrix3f y
operator*=
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 & operator*=(bfloat16 &a, const bfloat16 &b)
glm::normalize
GLM_FUNC_DECL genType normalize(genType const &x)
glm::quat_cast
GLM_FUNC_DECL detail::tquat< T, P > quat_cast(detail::tmat3x3< T, P > const &x)
GLM_ALIGNED_STRUCT
#define GLM_ALIGNED_STRUCT(x)
Definition: setup.hpp:793
glm::fastMix
GLM_FUNC_DECL detail::tquat< T, P > fastMix(detail::tquat< T, P > const &x, detail::tquat< T, P > const &y, T const &a)
glm::fastSin
GLM_FUNC_DECL T fastSin(const T &angle)
glm::dot
GLM_FUNC_DECL T dot(vecType< T, P > const &x, vecType< T, P > const &y)
glm::detail::operator+
GLM_FUNC_DECL tmat2x2< T, P > operator+(tmat2x2< T, P > const &m, T const &s)
glm::detail::operator/
GLM_FUNC_DECL tmat2x2< T, P > operator/(tmat2x2< T, P > const &m, T const &s)
glm::detail::operator*
GLM_FUNC_DECL tmat2x2< T, P > operator*(tmat2x2< T, P > const &m, T const &s)
glm::lerp
GLM_FUNC_DECL detail::tquat< T, P > lerp(detail::tquat< T, P > const &x, detail::tquat< T, P > const &y, T const &a)
glm::mat4_cast
GLM_FUNC_DECL detail::tmat4x4< T, P > mat4_cast(detail::tquat< T, P > const &x)
glm
Definition: _literals.hpp:31
glm::mix
GLM_FUNC_DECL vecType< T, P > mix(vecType< T, P > const &x, vecType< T, P > const &y, vecType< U, P > const &a)
z
z
x
x
glm::angle
GLM_FUNC_DECL T angle(detail::tquat< T, P > const &x)
glm::eulerAngles
GLM_FUNC_DECL detail::tvec3< T, P > eulerAngles(detail::tquat< T, P > const &x)
glm::detail::operator-
GLM_FUNC_DECL tmat2x2< T, P > operator-(tmat2x2< T, P > const &m, T const &s)
glm::slerp
GLM_FUNC_DECL detail::tquat< T, P > slerp(detail::tquat< T, P > const &x, detail::tquat< T, P > const &y, T const &a)
operator/=
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 & operator/=(bfloat16 &a, const bfloat16 &b)
glm::conjugate
GLM_FUNC_DECL detail::tquat< T, P > conjugate(detail::tquat< T, P > const &q)
glm::inverse
GLM_FUNC_DECL matType< T, P > inverse(matType< T, P > const &m)


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:16