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_CONFIG_XYZW_ONLY 29 # elif GLM_CONFIG_ANONYMOUS_STRUCT == GLM_ENABLE 36 typename detail::storage<2, T, detail::is_aligned<Q>::value>::type data;
38 # if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR 39 GLM_SWIZZLE2_2_MEMBERS(T, Q, x, y)
40 GLM_SWIZZLE2_2_MEMBERS(T, Q, r, g)
41 GLM_SWIZZLE2_2_MEMBERS(T, Q, s, t)
42 GLM_SWIZZLE2_3_MEMBERS(T, Q, x, y)
43 GLM_SWIZZLE2_3_MEMBERS(T, Q, r, g)
44 GLM_SWIZZLE2_3_MEMBERS(T, Q, s, t)
45 GLM_SWIZZLE2_4_MEMBERS(T, Q, x, y)
46 GLM_SWIZZLE2_4_MEMBERS(T, Q, r, g)
47 GLM_SWIZZLE2_4_MEMBERS(T, Q, s, t)
54 # if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION 55 GLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, Q)
56 # endif//GLM_CONFIG_SWIZZLE 62 typedef length_t length_type;
63 GLM_FUNC_DECL
static GLM_CONSTEXPR length_type
length(){
return 2;}
65 GLM_FUNC_DECL GLM_CONSTEXPR T& operator[](length_type i);
66 GLM_FUNC_DECL GLM_CONSTEXPR T
const& operator[](length_type i)
const;
70 GLM_FUNC_DECL GLM_CONSTEXPR vec() GLM_DEFAULT;
71 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec const& v) GLM_DEFAULT;
73 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, T, P> const& v);
77 GLM_FUNC_DECL GLM_CONSTEXPR explicit vec(T scalar);
78 GLM_FUNC_DECL GLM_CONSTEXPR vec(T x, T y);
82 template<typename U, qualifier P>
83 GLM_FUNC_DECL GLM_CONSTEXPR explicit vec(vec<1, U, P> const& v);
86 template<typename A, typename B>
87 GLM_FUNC_DECL GLM_CONSTEXPR vec(A x, B y);
88 template<typename A, typename B>
89 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, Q> const& x, B y);
90 template<typename A, typename B>
91 GLM_FUNC_DECL GLM_CONSTEXPR vec(A x, vec<1, B, Q> const& y);
92 template<typename A, typename B>
93 GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, Q> const& x, vec<1, B, Q> const& y);
98 template<typename U, qualifier P>
99 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<3, U, P> const& v);
101 template<typename U, qualifier P>
102 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<4, U, P> const& v);
105 template<typename U, qualifier P>
106 GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<2, U, P> const& v);
109 # if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR 110 template<
int E0,
int E1>
111 GLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<2, T, Q, E0, E1,-1,-2>
const& that)
115 # endif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR 119 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator=(vec
const& v) GLM_DEFAULT;
122 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator=(vec<2, U, Q>
const& v);
124 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator+=(U scalar);
126 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator+=(vec<1, U, Q>
const& v);
128 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator+=(vec<2, U, Q>
const& v);
130 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator-=(U scalar);
132 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator-=(vec<1, U, Q>
const& v);
134 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator-=(vec<2, U, Q>
const& v);
136 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator*=(U scalar);
138 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator*=(vec<1, U, Q>
const& v);
140 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator*=(vec<2, U, Q>
const& v);
142 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator/=(U scalar);
144 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator/=(vec<1, U, Q>
const& v);
146 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator/=(vec<2, U, Q>
const& v);
150 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator++();
151 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator--();
152 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator++(
int);
153 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator--(
int);
158 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator%=(U scalar);
160 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator%=(vec<1, U, Q>
const& v);
162 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator%=(vec<2, U, Q>
const& v);
164 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator&=(U scalar);
166 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator&=(vec<1, U, Q>
const& v);
168 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator&=(vec<2, U, Q>
const& v);
170 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator|=(U scalar);
172 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator|=(vec<1, U, Q>
const& v);
174 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator|=(vec<2, U, Q>
const& v);
176 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator^=(U scalar);
178 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator^=(vec<1, U, Q>
const& v);
180 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator^=(vec<2, U, Q>
const& v);
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);
197 template<
typename T, qualifier Q>
198 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<2, T, Q>
const& v);
200 template<
typename T, qualifier Q>
201 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q>
const& v);
205 template<
typename T, qualifier Q>
206 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<2, T, Q>
const& v, T scalar);
208 template<
typename T, qualifier Q>
209 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
211 template<
typename T, qualifier Q>
212 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(T scalar, vec<2, T, Q>
const& v);
214 template<
typename T, qualifier Q>
215 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
217 template<
typename T, qualifier Q>
218 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
220 template<
typename T, qualifier Q>
221 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q>
const& v, T scalar);
223 template<
typename T, qualifier Q>
224 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
226 template<
typename T, qualifier Q>
227 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(T scalar, vec<2, T, Q>
const& v);
229 template<
typename T, qualifier Q>
230 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
232 template<
typename T, qualifier Q>
233 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
235 template<
typename T, qualifier Q>
236 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(vec<2, T, Q>
const& v, T scalar);
238 template<
typename T, qualifier Q>
239 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
241 template<
typename T, qualifier Q>
242 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(T scalar, vec<2, T, Q>
const& v);
244 template<
typename T, qualifier Q>
245 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
247 template<
typename T, qualifier Q>
248 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
250 template<
typename T, qualifier Q>
251 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(vec<2, T, Q>
const& v, T scalar);
253 template<
typename T, qualifier Q>
254 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
256 template<
typename T, qualifier Q>
257 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(T scalar, vec<2, T, Q>
const& v);
259 template<
typename T, qualifier Q>
260 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
262 template<
typename T, qualifier Q>
263 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
265 template<
typename T, qualifier Q>
266 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(vec<2, T, Q>
const& v, T scalar);
268 template<
typename T, qualifier Q>
269 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
271 template<
typename T, qualifier Q>
272 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(T scalar, vec<2, T, Q>
const& v);
274 template<
typename T, qualifier Q>
275 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
277 template<
typename T, qualifier Q>
278 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
280 template<
typename T, qualifier Q>
281 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(vec<2, T, Q>
const& v, T scalar);
283 template<
typename T, qualifier Q>
284 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
286 template<
typename T, qualifier Q>
287 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(T scalar, vec<2, T, Q>
const& v);
289 template<
typename T, qualifier Q>
290 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
292 template<
typename T, qualifier Q>
293 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
295 template<
typename T, qualifier Q>
296 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(vec<2, T, Q>
const& v, T scalar);
298 template<
typename T, qualifier Q>
299 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
301 template<
typename T, qualifier Q>
302 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(T scalar, vec<2, T, Q>
const& v);
304 template<
typename T, qualifier Q>
305 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
307 template<
typename T, qualifier Q>
308 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
310 template<
typename T, qualifier Q>
311 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(vec<2, T, Q>
const& v, T scalar);
313 template<
typename T, qualifier Q>
314 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
316 template<
typename T, qualifier Q>
317 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(T scalar, vec<2, T, Q>
const& v);
319 template<
typename T, qualifier Q>
320 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
322 template<
typename T, qualifier Q>
323 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
325 template<
typename T, qualifier Q>
326 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<2, T, Q>
const& v, T scalar);
328 template<
typename T, qualifier Q>
329 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
331 template<
typename T, qualifier Q>
332 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(T scalar, vec<2, T, Q>
const& v);
334 template<
typename T, qualifier Q>
335 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
337 template<
typename T, qualifier Q>
338 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
340 template<
typename T, qualifier Q>
341 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<2, T, Q>
const& v, T scalar);
343 template<
typename T, qualifier Q>
344 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<2, T, Q>
const& v1, vec<1, T, Q>
const& v2);
346 template<
typename T, qualifier Q>
347 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(T scalar, vec<2, T, Q>
const& v);
349 template<
typename T, qualifier Q>
350 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<1, T, Q>
const& v1, vec<2, T, Q>
const& v2);
352 template<
typename T, qualifier Q>
353 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
355 template<
typename T, qualifier Q>
356 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator~(vec<2, T, Q>
const& v);
360 template<
typename T, qualifier Q>
361 GLM_FUNC_DECL GLM_CONSTEXPR
bool operator==(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
363 template<
typename T, qualifier Q>
364 GLM_FUNC_DECL GLM_CONSTEXPR
bool operator!=(vec<2, T, Q>
const& v1, vec<2, T, Q>
const& v2);
366 template<qualifier Q>
367 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, bool, Q> operator&&(vec<2, bool, Q>
const& v1, vec<2, bool, Q>
const& v2);
369 template<qualifier Q>
370 GLM_FUNC_DECL GLM_CONSTEXPR vec<2, bool, Q> operator||(vec<2, bool, Q>
const& v1, vec<2, bool, Q>
const& v2);
373 #ifndef GLM_EXTERNAL_TEMPLATE 374 #include "type_vec2.inl" 375 #endif//GLM_EXTERNAL_TEMPLATE
GLM_FUNC_DECL T length(qua< T, Q > const &q)
Returns the norm of a quaternions.