6 #include "qualifier.hpp"
7 #if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
8 # include "_swizzle.hpp"
9 #elif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
10 # include "_swizzle_func.hpp"
16 template<
typename T, qualifier Q>
22 typedef vec<2, T, Q> type;
23 typedef vec<2, bool, Q> bool_type;
27 # if GLM_SILENT_WARNINGS == GLM_ENABLE
28 # if GLM_COMPILER & GLM_COMPILER_GCC
29 # pragma GCC diagnostic push
30 # pragma GCC diagnostic ignored "-Wpedantic"
31 # elif GLM_COMPILER & GLM_COMPILER_CLANG
32 # pragma clang diagnostic push
33 # pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
34 # pragma clang diagnostic ignored "-Wnested-anon-types"
35 # elif GLM_COMPILER & GLM_COMPILER_VC
36 # pragma warning(push)
37 # pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
41 # if GLM_CONFIG_XYZW_ONLY
43 # elif GLM_CONFIG_ANONYMOUS_STRUCT == GLM_ENABLE
50 typename detail::storage<2, T, detail::is_aligned<Q>::value>::type data;
52 # if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
53 GLM_SWIZZLE2_2_MEMBERS(T, Q, x, y)
54 GLM_SWIZZLE2_2_MEMBERS(T, Q, r, g)
55 GLM_SWIZZLE2_2_MEMBERS(T, Q, s, t)
56 GLM_SWIZZLE2_3_MEMBERS(T, Q, x, y)
57 GLM_SWIZZLE2_3_MEMBERS(T, Q, r, g)
58 GLM_SWIZZLE2_3_MEMBERS(T, Q, s, t)
59 GLM_SWIZZLE2_4_MEMBERS(T, Q, x, y)
60 GLM_SWIZZLE2_4_MEMBERS(T, Q, r, g)
61 GLM_SWIZZLE2_4_MEMBERS(T, Q, s, t)
68 # if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
69 GLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, Q)
70 # endif//GLM_CONFIG_SWIZZLE
73 # if GLM_SILENT_WARNINGS == GLM_ENABLE
74 # if GLM_COMPILER & GLM_COMPILER_CLANG
75 # pragma clang diagnostic pop
76 # elif GLM_COMPILER & GLM_COMPILER_GCC
77 # pragma GCC diagnostic pop
78 # elif GLM_COMPILER & GLM_COMPILER_VC
86 typedef length_t length_type;
87 GLM_FUNC_DECL
static GLM_CONSTEXPR length_type
length(){
return 2;}
89 GLM_FUNC_DECL GLM_CONSTEXPR T& operator[](length_type i);
90 GLM_FUNC_DECL GLM_CONSTEXPR T
const& operator[](length_type i)
const;
94 GLM_FUNC_DECL GLM_CONSTEXPR vec() GLM_DEFAULT;
95 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec const& v) GLM_DEFAULT;
97 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, T, P> const& v);
101 GLM_FUNC_DECL GLM_CONSTEXPR explicit vec(T scalar);
102 GLM_FUNC_DECL GLM_CONSTEXPR vec(T x, T y);
106 template<typename U, qualifier P>
107 GLM_FUNC_DECL GLM_CONSTEXPR explicit vec(vec<1, U, P> const& v);
110 template<typename A, typename B>
111 GLM_FUNC_DECL GLM_CONSTEXPR vec(A x, B y);
112 template<typename A, typename B>
113 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, Q> const& x, B y);
114 template<typename A, typename B>
115 GLM_FUNC_DECL GLM_CONSTEXPR vec(A x, vec<1, B, Q> const& y);
116 template<typename A, typename B>
117 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, Q> const& x, vec<1, B, Q> const& y);
122 template<typename U, qualifier P>
123 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<3, U, P> const& v);
125 template<typename U, qualifier P>
126 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<4, U, P> const& v);
129 template<typename U, qualifier P>
130 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<2, U, P> const& v);
133 # if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
134 template<
int E0,
int E1>
135 GLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<2, T, Q, E0, E1,-1,-2>
const& that)
139 # endif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
143 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator=(vec
const& v) GLM_DEFAULT;
146 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator=(vec<2, U, Q>
const& v);
148 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator+=(U scalar);
150 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator+=(vec<1, U, Q>
const& v);
152 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator+=(vec<2, U, Q>
const& v);
154 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator-=(U scalar);
156 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator-=(vec<1, U, Q>
const& v);
158 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator-=(vec<2, U, Q>
const& v);
160 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator*=(U scalar);
162 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator*=(vec<1, U, Q>
const& v);
164 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator*=(vec<2, U, Q>
const& v);
166 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator/=(U scalar);
168 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator/=(vec<1, U, Q>
const& v);
170 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator/=(vec<2, U, Q>
const& v);
174 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator++();
175 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator--();
176 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator++(
int);
177 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator--(
int);
182 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator%=(U scalar);
184 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator%=(vec<1, U, Q>
const& v);
186 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator%=(vec<2, U, Q>
const& v);
188 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator&=(U scalar);
190 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator&=(vec<1, U, Q>
const& v);
192 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator&=(vec<2, U, Q>
const& v);
194 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator|=(U scalar);
196 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator|=(vec<1, U, Q>
const& v);
198 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator|=(vec<2, U, Q>
const& v);
200 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator^=(U scalar);
202 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator^=(vec<1, U, Q>
const& v);
204 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator^=(vec<2, U, Q>
const& v);
206 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator<<=(U scalar);
208 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator<<=(vec<1, U, Q>
const& v);
210 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator<<=(vec<2, U, Q>
const& v);
212 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator>>=(U scalar);
214 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator>>=(vec<1, U, Q>
const& v);
216 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator>>=(vec<2, U, Q>
const& v);
221 template<
typename T, qualifier Q>
222 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<2, T, Q>
const& v);
224 template<
typename T, qualifier Q>
225 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q>
const& v);
229 template<
typename T, qualifier Q>
230 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<2, T, Q>
const& v, T scalar);
232 template<
typename T, qualifier Q>
233 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
235 template<
typename T, qualifier Q>
236 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(T scalar, vec<2, T, Q>
const& v);
238 template<
typename T, qualifier Q>
239 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
241 template<
typename T, qualifier Q>
242 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
244 template<
typename T, qualifier Q>
245 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q>
const& v, T scalar);
247 template<
typename T, qualifier Q>
248 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
250 template<
typename T, qualifier Q>
251 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(T scalar, vec<2, T, Q>
const& v);
253 template<
typename T, qualifier Q>
254 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
256 template<
typename T, qualifier Q>
257 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
259 template<
typename T, qualifier Q>
260 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(vec<2, T, Q>
const& v, T scalar);
262 template<
typename T, qualifier Q>
263 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
265 template<
typename T, qualifier Q>
266 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(T scalar, vec<2, T, Q>
const& v);
268 template<
typename T, qualifier Q>
269 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
271 template<
typename T, qualifier Q>
272 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
274 template<
typename T, qualifier Q>
275 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(vec<2, T, Q>
const& v, T scalar);
277 template<
typename T, qualifier Q>
278 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
280 template<
typename T, qualifier Q>
281 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(T scalar, vec<2, T, Q>
const& v);
283 template<
typename T, qualifier Q>
284 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
286 template<
typename T, qualifier Q>
287 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
289 template<
typename T, qualifier Q>
290 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(vec<2, T, Q>
const& v, T scalar);
292 template<
typename T, qualifier Q>
293 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
295 template<
typename T, qualifier Q>
296 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(T scalar, vec<2, T, Q>
const& v);
298 template<
typename T, qualifier Q>
299 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
301 template<
typename T, qualifier Q>
302 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
304 template<
typename T, qualifier Q>
305 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(vec<2, T, Q>
const& v, T scalar);
307 template<
typename T, qualifier Q>
308 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
310 template<
typename T, qualifier Q>
311 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(T scalar, vec<2, T, Q>
const& v);
313 template<
typename T, qualifier Q>
314 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
316 template<
typename T, qualifier Q>
317 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
319 template<
typename T, qualifier Q>
320 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(vec<2, T, Q>
const& v, T scalar);
322 template<
typename T, qualifier Q>
323 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
325 template<
typename T, qualifier Q>
326 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(T scalar, vec<2, T, Q>
const& v);
328 template<
typename T, qualifier Q>
329 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
331 template<
typename T, qualifier Q>
332 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
334 template<
typename T, qualifier Q>
335 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(vec<2, T, Q>
const& v, T scalar);
337 template<
typename T, qualifier Q>
338 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
340 template<
typename T, qualifier Q>
341 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(T scalar, vec<2, T, Q>
const& v);
343 template<
typename T, qualifier Q>
344 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
346 template<
typename T, qualifier Q>
347 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
349 template<
typename T, qualifier Q>
350 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<2, T, Q>
const& v, T scalar);
352 template<
typename T, qualifier Q>
353 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
355 template<
typename T, qualifier Q>
356 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(T scalar, vec<2, T, Q>
const& v);
358 template<
typename T, qualifier Q>
359 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
361 template<
typename T, qualifier Q>
362 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
364 template<
typename T, qualifier Q>
365 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<2, T, Q>
const& v, T scalar);
367 template<
typename T, qualifier Q>
368 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
370 template<
typename T, qualifier Q>
371 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(T scalar, vec<2, T, Q>
const& v);
373 template<
typename T, qualifier Q>
374 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
376 template<
typename T, qualifier Q>
377 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
379 template<
typename T, qualifier Q>
380 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator~(vec<2, T, Q>
const& v);
384 template<
typename T, qualifier Q>
385 GLM_FUNC_DECL GLM_CONSTEXPR
bool operator==(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
387 template<
typename T, qualifier Q>
388 GLM_FUNC_DECL GLM_CONSTEXPR
bool operator!=(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
390 template<qualifier Q>
391 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, bool, Q> operator&&(vec<2, bool, Q>
const& v1, vec<2, bool, Q>
const& v2);
393 template<qualifier Q>
394 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, bool, Q> operator||(vec<2, bool, Q>
const& v1, vec<2, bool, Q>
const& v2);
397 #ifndef GLM_EXTERNAL_TEMPLATE
398 #include "type_vec2.inl"
399 #endif//GLM_EXTERNAL_TEMPLATE
GLM_FUNC_DECL T length(qua< T, Q > const &q)
Returns the norm of a quaternions.