0.9.9 API documentation: type_quat.hpp Source File

| 0.9.9 API documentation

- Main Page
- Modules
- Files

- File List

type_quat.hpp
Go to the documentation of this file.
1
4 #pragma once
5
6 // Dependency:
7 #include "../detail/type_mat3x3.hpp"
8 #include "../detail/type_mat4x4.hpp"
9 #include "../detail/type_vec3.hpp"
10 #include "../detail/type_vec4.hpp"
11 #include "../ext/vector_relational.hpp"
12 #include "../ext/quaternion_relational.hpp"
13 #include "../gtc/constants.hpp"
14 #include "../gtc/matrix_transform.hpp"
15
16 namespace glm
17 {
18 template<typename T, qualifier Q>
19 struct qua
20 {
21 // -- Implementation detail --
22
23 typedef qua<T, Q> type;
24 typedef T value_type;
25
26 // -- Data --
27
28 # if GLM_SILENT_WARNINGS == GLM_ENABLE
29 # if GLM_COMPILER & GLM_COMPILER_GCC
30 # pragma GCC diagnostic push
31 # pragma GCC diagnostic ignored "-Wpedantic"
32 # elif GLM_COMPILER & GLM_COMPILER_CLANG
33 # pragma clang diagnostic push
34 # pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
35 # pragma clang diagnostic ignored "-Wnested-anon-types"
36 # elif GLM_COMPILER & GLM_COMPILER_VC
37 # pragma warning(push)
38 # pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
39 # endif
40 # endif
41
42 # if GLM_LANG & GLM_LANG_CXXMS_FLAG
43 union
44 {
45 struct { T x, y, z, w;};
46
47 typename detail::storage<4, T, detail::is_aligned<Q>::value>::type data;
48 };
49 # else
50 T x, y, z, w;
51 # endif
52
53 # if GLM_SILENT_WARNINGS == GLM_ENABLE
54 # if GLM_COMPILER & GLM_COMPILER_CLANG
55 # pragma clang diagnostic pop
56 # elif GLM_COMPILER & GLM_COMPILER_GCC
57 # pragma GCC diagnostic pop
58 # elif GLM_COMPILER & GLM_COMPILER_VC
59 # pragma warning(pop)
60 # endif
61 # endif
62
63 // -- Component accesses --
64
65 typedef length_t length_type;
66
68 GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 4;}
69
70 GLM_FUNC_DECL GLM_CONSTEXPR T & operator[](length_type i);
71 GLM_FUNC_DECL GLM_CONSTEXPR T const& operator[](length_type i) const;
72
73 // -- Implicit basic constructors --
74
75 GLM_FUNC_DECL GLM_CONSTEXPR qua() GLM_DEFAULT;
76 GLM_FUNC_DECL GLM_CONSTEXPR qua(qua<T, Q> const& q) GLM_DEFAULT;
77 template<qualifier P>
78 GLM_FUNC_DECL GLM_CONSTEXPR qua(qua<T, P> const& q);
79
80 // -- Explicit basic constructors --
81
82 GLM_FUNC_DECL GLM_CONSTEXPR qua(T s, vec<3, T, Q> const& v);
83 GLM_FUNC_DECL GLM_CONSTEXPR qua(T w, T x, T y, T z);
84
85 // -- Conversion constructors --
86
87 template<typename U, qualifier P>
88 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT qua(qua<U, P> const& q);
89
91 # if GLM_HAS_EXPLICIT_CONVERSION_OPERATORS
92 GLM_FUNC_DECL explicit operator mat<3, 3, T, Q>() const;
93 GLM_FUNC_DECL explicit operator mat<4, 4, T, Q>() const;
94 # endif
95
102 GLM_FUNC_DECL qua(vec<3, T, Q> const& u, vec<3, T, Q> const& v);
103
105 GLM_FUNC_DECL GLM_EXPLICIT qua(vec<3, T, Q> const& eulerAngles);
106 GLM_FUNC_DECL GLM_EXPLICIT qua(mat<3, 3, T, Q> const& q);
107 GLM_FUNC_DECL GLM_EXPLICIT qua(mat<4, 4, T, Q> const& q);
108
109 // -- Unary arithmetic operators --
110
111 GLM_FUNC_DECL qua<T, Q>& operator=(qua<T, Q> const& q) GLM_DEFAULT;
112
113 template<typename U>
114 GLM_FUNC_DECL qua<T, Q>& operator=(qua<U, Q> const& q);
115 template<typename U>
116 GLM_FUNC_DECL qua<T, Q>& operator+=(qua<U, Q> const& q);
117 template<typename U>
118 GLM_FUNC_DECL qua<T, Q>& operator-=(qua<U, Q> const& q);
119 template<typename U>
120 GLM_FUNC_DECL qua<T, Q>& operator*=(qua<U, Q> const& q);
121 template<typename U>
122 GLM_FUNC_DECL qua<T, Q>& operator*=(U s);
123 template<typename U>
124 GLM_FUNC_DECL qua<T, Q>& operator/=(U s);
125 };
126
127 // -- Unary bit operators --
128
129 template<typename T, qualifier Q>
130 GLM_FUNC_DECL qua<T, Q> operator+(qua<T, Q> const& q);
131
132 template<typename T, qualifier Q>
133 GLM_FUNC_DECL qua<T, Q> operator-(qua<T, Q> const& q);
134
135 // -- Binary operators --
136
137 template<typename T, qualifier Q>
138 GLM_FUNC_DECL qua<T, Q> operator+(qua<T, Q> const& q, qua<T, Q> const& p);
139
140 template<typename T, qualifier Q>
141 GLM_FUNC_DECL qua<T, Q> operator-(qua<T, Q> const& q, qua<T, Q> const& p);
142
143 template<typename T, qualifier Q>
144 GLM_FUNC_DECL qua<T, Q> operator*(qua<T, Q> const& q, qua<T, Q> const& p);
145
146 template<typename T, qualifier Q>
147 GLM_FUNC_DECL vec<3, T, Q> operator*(qua<T, Q> const& q, vec<3, T, Q> const& v);
148
149 template<typename T, qualifier Q>
150 GLM_FUNC_DECL vec<3, T, Q> operator*(vec<3, T, Q> const& v, qua<T, Q> const& q);
151
152 template<typename T, qualifier Q>
153 GLM_FUNC_DECL vec<4, T, Q> operator*(qua<T, Q> const& q, vec<4, T, Q> const& v);
154
155 template<typename T, qualifier Q>
156 GLM_FUNC_DECL vec<4, T, Q> operator*(vec<4, T, Q> const& v, qua<T, Q> const& q);
157
158 template<typename T, qualifier Q>
159 GLM_FUNC_DECL qua<T, Q> operator*(qua<T, Q> const& q, T const& s);
160
161 template<typename T, qualifier Q>
162 GLM_FUNC_DECL qua<T, Q> operator*(T const& s, qua<T, Q> const& q);
163
164 template<typename T, qualifier Q>
165 GLM_FUNC_DECL qua<T, Q> operator/(qua<T, Q> const& q, T const& s);
166
167 // -- Boolean operators --
168
169 template<typename T, qualifier Q>
170 GLM_FUNC_DECL GLM_CONSTEXPR bool operator==(qua<T, Q> const& q1, qua<T, Q> const& q2);
171
172 template<typename T, qualifier Q>
173 GLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(qua<T, Q> const& q1, qua<T, Q> const& q2);
174 } //namespace glm
175
176 #ifndef GLM_EXTERNAL_TEMPLATE
177 #include "type_quat.inl"
178 #endif//GLM_EXTERNAL_TEMPLATE
glm::eulerAngles
GLM_FUNC_DECL vec< 3, T, Q > eulerAngles(qua< T, Q > const &x)
Returns euler angles, pitch as x, yaw as y, roll as z.
glm::length
GLM_FUNC_DECL T length(qua< T, Q > const &q)
Returns the norm of a quaternions.
glm
Definition: common.hpp:20