1/// @ref core
2/// @file glm/core/type_tvec2.inl
3
4namespace glm
5{
6#	ifdef GLM_STATIC_CONST_MEMBERS
7	template <typename T, precision P>
8	const tvec2<T, P> tvec2<T, P>::ZERO(static_cast<T>(0), static_cast<T>(0));
9
10	template <typename T, precision P>
11	const tvec2<T, P> tvec2<T, P>::X(static_cast<T>(1), static_cast<T>(0));
12
13	template <typename T, precision P>
14	const tvec2<T, P> tvec2<T, P>::Y(static_cast<T>(0), static_cast<T>(1));
15
16	template <typename T, precision P>
17	const tvec2<T, P> tvec2<T, P>::XY(static_cast<T>(1), static_cast<T>(1));
18#	endif
19	// -- Implicit basic constructors --
20
21#	if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)
22		template <typename T, precision P>
23		GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2<T, P>::tvec2()
24#			ifndef GLM_FORCE_NO_CTOR_INIT
25				: x(0), y(0)
26#			endif
27		{}
28#	endif//!GLM_HAS_DEFAULTED_FUNCTIONS
29
30#	if !GLM_HAS_DEFAULTED_FUNCTIONS
31		template <typename T, precision P>
32		GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2<T, P>::tvec2(tvec2<T, P> const & v)
33			: x(v.x), y(v.y)
34		{}
35#	endif//!GLM_HAS_DEFAULTED_FUNCTIONS
36
37	template <typename T, precision P>
38	template <precision Q>
39	GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2<T, P>::tvec2(tvec2<T, Q> const & v)
40		: x(v.x), y(v.y)
41	{}
42
43	// -- Explicit basic constructors --
44
45	template <typename T, precision P>
46	GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2<T, P>::tvec2(ctor)
47	{}
48
49	template <typename T, precision P>
50	GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2<T, P>::tvec2(T scalar)
51		: x(scalar), y(scalar)
52	{}
53
54	template <typename T, precision P>
55	GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2<T, P>::tvec2(T s1, T s2)
56		: x(s1), y(s2)
57	{}
58
59	// -- Conversion scalar constructors --
60
61	template <typename T, precision P>
62	template <typename A, typename B>
63	GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2<T, P>::tvec2(A a, B b)
64		: x(static_cast<T>(a))
65		, y(static_cast<T>(b))
66	{}
67
68	template <typename T, precision P>
69	template <typename A, typename B>
70	GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2<T, P>::tvec2(tvec1<A, P> const & a, tvec1<B, P> const & b)
71		: x(static_cast<T>(a.x))
72		, y(static_cast<T>(b.x))
73	{}
74
75	// -- Conversion vector constructors --
76
77	template <typename T, precision P>
78	template <typename U, precision Q>
79	GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2<T, P>::tvec2(tvec2<U, Q> const & v)
80		: x(static_cast<T>(v.x))
81		, y(static_cast<T>(v.y))
82	{}
83
84	template <typename T, precision P>
85	template <typename U, precision Q>
86	GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2<T, P>::tvec2(tvec3<U, Q> const & v)
87		: x(static_cast<T>(v.x))
88		, y(static_cast<T>(v.y))
89	{}
90
91	template <typename T, precision P>
92	template <typename U, precision Q>
93	GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tvec2<T, P>::tvec2(tvec4<U, Q> const & v)
94		: x(static_cast<T>(v.x))
95		, y(static_cast<T>(v.y))
96	{}
97
98	// -- Component accesses --
99
100	template <typename T, precision P>
101	GLM_FUNC_QUALIFIER T & tvec2<T, P>::operator[](typename tvec2<T, P>::length_type i)
102	{
103		assert(i >= 0 && i < this->length());
104		return (&x)[i];
105	}
106
107	template <typename T, precision P>
108	GLM_FUNC_QUALIFIER T const & tvec2<T, P>::operator[](typename tvec2<T, P>::length_type i) const
109	{
110		assert(i >= 0 && i < this->length());
111		return (&x)[i];
112	}
113
114	// -- Unary arithmetic operators --
115
116#	if !GLM_HAS_DEFAULTED_FUNCTIONS
117		template <typename T, precision P>
118		GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator=(tvec2<T, P> const & v)
119		{
120			this->x = v.x;
121			this->y = v.y;
122			return *this;
123		}
124#	endif//!GLM_HAS_DEFAULTED_FUNCTIONS
125
126	template <typename T, precision P>
127	template <typename U>
128	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator=(tvec2<U, P> const & v)
129	{
130		this->x = static_cast<T>(v.x);
131		this->y = static_cast<T>(v.y);
132		return *this;
133	}
134
135	template <typename T, precision P>
136	template <typename U>
137	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator+=(U scalar)
138	{
139		this->x += static_cast<T>(scalar);
140		this->y += static_cast<T>(scalar);
141		return *this;
142	}
143
144	template <typename T, precision P>
145	template <typename U>
146	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator+=(tvec1<U, P> const & v)
147	{
148		this->x += static_cast<T>(v.x);
149		this->y += static_cast<T>(v.x);
150		return *this;
151	}
152
153	template <typename T, precision P>
154	template <typename U>
155	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator+=(tvec2<U, P> const & v)
156	{
157		this->x += static_cast<T>(v.x);
158		this->y += static_cast<T>(v.y);
159		return *this;
160	}
161
162	template <typename T, precision P>
163	template <typename U>
164	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator-=(U scalar)
165	{
166		this->x -= static_cast<T>(scalar);
167		this->y -= static_cast<T>(scalar);
168		return *this;
169	}
170
171	template <typename T, precision P>
172	template <typename U>
173	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator-=(tvec1<U, P> const & v)
174	{
175		this->x -= static_cast<T>(v.x);
176		this->y -= static_cast<T>(v.x);
177		return *this;
178	}
179
180	template <typename T, precision P>
181	template <typename U>
182	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator-=(tvec2<U, P> const & v)
183	{
184		this->x -= static_cast<T>(v.x);
185		this->y -= static_cast<T>(v.y);
186		return *this;
187	}
188
189	template <typename T, precision P>
190	template <typename U>
191	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator*=(U scalar)
192	{
193		this->x *= static_cast<T>(scalar);
194		this->y *= static_cast<T>(scalar);
195		return *this;
196	}
197
198	template <typename T, precision P>
199	template <typename U>
200	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator*=(tvec1<U, P> const & v)
201	{
202		this->x *= static_cast<T>(v.x);
203		this->y *= static_cast<T>(v.x);
204		return *this;
205	}
206
207	template <typename T, precision P>
208	template <typename U>
209	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator*=(tvec2<U, P> const & v)
210	{
211		this->x *= static_cast<T>(v.x);
212		this->y *= static_cast<T>(v.y);
213		return *this;
214	}
215
216	template <typename T, precision P>
217	template <typename U>
218	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator/=(U scalar)
219	{
220		this->x /= static_cast<T>(scalar);
221		this->y /= static_cast<T>(scalar);
222		return *this;
223	}
224
225	template <typename T, precision P>
226	template <typename U>
227	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator/=(tvec1<U, P> const & v)
228	{
229		this->x /= static_cast<T>(v.x);
230		this->y /= static_cast<T>(v.x);
231		return *this;
232	}
233
234	template <typename T, precision P>
235	template <typename U>
236	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator/=(tvec2<U, P> const & v)
237	{
238		this->x /= static_cast<T>(v.x);
239		this->y /= static_cast<T>(v.y);
240		return *this;
241	}
242
243	// -- Increment and decrement operators --
244
245	template <typename T, precision P>
246	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator++()
247	{
248		++this->x;
249		++this->y;
250		return *this;
251	}
252
253	template <typename T, precision P>
254	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator--()
255	{
256		--this->x;
257		--this->y;
258		return *this;
259	}
260
261	template <typename T, precision P>
262	GLM_FUNC_QUALIFIER tvec2<T, P> tvec2<T, P>::operator++(int)
263	{
264		tvec2<T, P> Result(*this);
265		++*this;
266		return Result;
267	}
268
269	template <typename T, precision P>
270	GLM_FUNC_QUALIFIER tvec2<T, P> tvec2<T, P>::operator--(int)
271	{
272		tvec2<T, P> Result(*this);
273		--*this;
274		return Result;
275	}
276
277	// -- Unary bit operators --
278
279	template <typename T, precision P>
280	template <typename U>
281	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator%=(U scalar)
282	{
283		this->x %= static_cast<T>(scalar);
284		this->y %= static_cast<T>(scalar);
285		return *this;
286	}
287
288	template <typename T, precision P>
289	template <typename U>
290	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator%=(tvec1<U, P> const & v)
291	{
292		this->x %= static_cast<T>(v.x);
293		this->y %= static_cast<T>(v.x);
294		return *this;
295	}
296
297	template <typename T, precision P>
298	template <typename U>
299	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator%=(tvec2<U, P> const & v)
300	{
301		this->x %= static_cast<T>(v.x);
302		this->y %= static_cast<T>(v.y);
303		return *this;
304	}
305
306	template <typename T, precision P>
307	template <typename U>
308	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator&=(U scalar)
309	{
310		this->x &= static_cast<T>(scalar);
311		this->y &= static_cast<T>(scalar);
312		return *this;
313	}
314
315	template <typename T, precision P>
316	template <typename U>
317	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator&=(tvec1<U, P> const & v)
318	{
319		this->x &= static_cast<T>(v.x);
320		this->y &= static_cast<T>(v.x);
321		return *this;
322	}
323
324	template <typename T, precision P>
325	template <typename U>
326	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator&=(tvec2<U, P> const & v)
327	{
328		this->x &= static_cast<T>(v.x);
329		this->y &= static_cast<T>(v.y);
330		return *this;
331	}
332
333	template <typename T, precision P>
334	template <typename U>
335	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator|=(U scalar)
336	{
337		this->x |= static_cast<T>(scalar);
338		this->y |= static_cast<T>(scalar);
339		return *this;
340	}
341
342	template <typename T, precision P>
343	template <typename U>
344	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator|=(tvec1<U, P> const & v)
345	{
346		this->x |= static_cast<T>(v.x);
347		this->y |= static_cast<T>(v.x);
348		return *this;
349	}
350
351	template <typename T, precision P>
352	template <typename U>
353	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator|=(tvec2<U, P> const & v)
354	{
355		this->x |= static_cast<T>(v.x);
356		this->y |= static_cast<T>(v.y);
357		return *this;
358	}
359
360	template <typename T, precision P>
361	template <typename U>
362	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator^=(U scalar)
363	{
364		this->x ^= static_cast<T>(scalar);
365		this->y ^= static_cast<T>(scalar);
366		return *this;
367	}
368
369	template <typename T, precision P>
370	template <typename U>
371	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator^=(tvec1<U, P> const & v)
372	{
373		this->x ^= static_cast<T>(v.x);
374		this->y ^= static_cast<T>(v.x);
375		return *this;
376	}
377
378	template <typename T, precision P>
379	template <typename U>
380	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator^=(tvec2<U, P> const & v)
381	{
382		this->x ^= static_cast<T>(v.x);
383		this->y ^= static_cast<T>(v.y);
384		return *this;
385	}
386
387	template <typename T, precision P>
388	template <typename U>
389	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator<<=(U scalar)
390	{
391		this->x <<= static_cast<T>(scalar);
392		this->y <<= static_cast<T>(scalar);
393		return *this;
394	}
395
396	template <typename T, precision P>
397	template <typename U>
398	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator<<=(tvec1<U, P> const & v)
399	{
400		this->x <<= static_cast<T>(v.x);
401		this->y <<= static_cast<T>(v.x);
402		return *this;
403	}
404
405	template <typename T, precision P>
406	template <typename U>
407	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator<<=(tvec2<U, P> const & v)
408	{
409		this->x <<= static_cast<T>(v.x);
410		this->y <<= static_cast<T>(v.y);
411		return *this;
412	}
413
414	template <typename T, precision P>
415	template <typename U>
416	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator>>=(U scalar)
417	{
418		this->x >>= static_cast<T>(scalar);
419		this->y >>= static_cast<T>(scalar);
420		return *this;
421	}
422
423	template <typename T, precision P>
424	template <typename U>
425	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator>>=(tvec1<U, P> const & v)
426	{
427		this->x >>= static_cast<T>(v.x);
428		this->y >>= static_cast<T>(v.x);
429		return *this;
430	}
431
432	template <typename T, precision P>
433	template <typename U>
434	GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator>>=(tvec2<U, P> const & v)
435	{
436		this->x >>= static_cast<T>(v.x);
437		this->y >>= static_cast<T>(v.y);
438		return *this;
439	}
440
441	// -- Unary arithmetic operators --
442
443	template <typename T, precision P>
444	GLM_FUNC_QUALIFIER tvec2<T, P> operator+(tvec2<T, P> const & v)
445	{
446		return v;
447	}
448
449	template <typename T, precision P>
450	GLM_FUNC_QUALIFIER tvec2<T, P> operator-(tvec2<T, P> const & v)
451	{
452		return tvec2<T, P>(
453			-v.x,
454			-v.y);
455	}
456
457	// -- Binary arithmetic operators --
458
459	template <typename T, precision P>
460	GLM_FUNC_QUALIFIER tvec2<T, P> operator+(tvec2<T, P> const & v, T scalar)
461	{
462		return tvec2<T, P>(
463			v.x + scalar,
464			v.y + scalar);
465	}
466
467	template <typename T, precision P>
468	GLM_FUNC_QUALIFIER tvec2<T, P> operator+(tvec2<T, P> const & v1, tvec1<T, P> const & v2)
469	{
470		return tvec2<T, P>(
471			v1.x + v2.x,
472			v1.y + v2.x);
473	}
474
475	template <typename T, precision P>
476	GLM_FUNC_QUALIFIER tvec2<T, P> operator+(T scalar, tvec2<T, P> const & v)
477	{
478		return tvec2<T, P>(
479			scalar + v.x,
480			scalar + v.y);
481	}
482
483	template <typename T, precision P>
484	GLM_FUNC_QUALIFIER tvec2<T, P> operator+(tvec1<T, P> const & v1, tvec2<T, P> const & v2)
485	{
486		return tvec2<T, P>(
487			v1.x + v2.x,
488			v1.x + v2.y);
489	}
490
491	template <typename T, precision P>
492	GLM_FUNC_QUALIFIER tvec2<T, P> operator+(tvec2<T, P> const & v1, tvec2<T, P> const & v2)
493	{
494		return tvec2<T, P>(
495			v1.x + v2.x,
496			v1.y + v2.y);
497	}
498
499	template <typename T, precision P>
500	GLM_FUNC_QUALIFIER tvec2<T, P> operator-(tvec2<T, P> const & v, T scalar)
501	{
502		return tvec2<T, P>(
503			v.x - scalar,
504			v.y - scalar);
505	}
506
507	template <typename T, precision P>
508	GLM_FUNC_QUALIFIER tvec2<T, P> operator-(tvec2<T, P> const & v1, tvec1<T, P> const & v2)
509	{
510		return tvec2<T, P>(
511			v1.x - v2.x,
512			v1.y - v2.x);
513	}
514
515	template <typename T, precision P>
516	GLM_FUNC_QUALIFIER tvec2<T, P> operator-(T scalar, tvec2<T, P> const & v)
517	{
518		return tvec2<T, P>(
519			scalar - v.x,
520			scalar - v.y);
521	}
522
523	template <typename T, precision P>
524	GLM_FUNC_QUALIFIER tvec2<T, P> operator-(tvec1<T, P> const & v1, tvec2<T, P> const & v2)
525	{
526		return tvec2<T, P>(
527			v1.x - v2.x,
528			v1.x - v2.y);
529	}
530
531	template <typename T, precision P>
532	GLM_FUNC_QUALIFIER tvec2<T, P> operator-(tvec2<T, P> const & v1, tvec2<T, P> const & v2)
533	{
534		return tvec2<T, P>(
535			v1.x - v2.x,
536			v1.y - v2.y);
537	}
538
539	template <typename T, precision P>
540	GLM_FUNC_QUALIFIER tvec2<T, P> operator*(tvec2<T, P> const & v, T scalar)
541	{
542		return tvec2<T, P>(
543			v.x * scalar,
544			v.y * scalar);
545	}
546
547	template <typename T, precision P>
548	GLM_FUNC_QUALIFIER tvec2<T, P> operator*(tvec2<T, P> const & v1, tvec1<T, P> const & v2)
549	{
550		return tvec2<T, P>(
551			v1.x * v2.x,
552			v1.y * v2.x);
553	}
554
555	template <typename T, precision P>
556	GLM_FUNC_QUALIFIER tvec2<T, P> operator*(T scalar, tvec2<T, P> const & v)
557	{
558		return tvec2<T, P>(
559			scalar * v.x,
560			scalar * v.y);
561	}
562
563	template <typename T, precision P>
564	GLM_FUNC_QUALIFIER tvec2<T, P> operator*(tvec1<T, P> const & v1, tvec2<T, P> const & v2)
565	{
566		return tvec2<T, P>(
567			v1.x * v2.x,
568			v1.x * v2.y);
569	}
570
571	template <typename T, precision P>
572	GLM_FUNC_QUALIFIER tvec2<T, P> operator*(tvec2<T, P> const & v1, tvec2<T, P> const & v2)
573	{
574		return tvec2<T, P>(
575			v1.x * v2.x,
576			v1.y * v2.y);
577	}
578
579	template <typename T, precision P>
580	GLM_FUNC_QUALIFIER tvec2<T, P> operator/(tvec2<T, P> const & v, T scalar)
581	{
582		return tvec2<T, P>(
583			v.x / scalar,
584			v.y / scalar);
585	}
586
587	template <typename T, precision P>
588	GLM_FUNC_QUALIFIER tvec2<T, P> operator/(tvec2<T, P> const & v1, tvec1<T, P> const & v2)
589	{
590		return tvec2<T, P>(
591			v1.x / v2.x,
592			v1.y / v2.x);
593	}
594
595	template <typename T, precision P>
596	GLM_FUNC_QUALIFIER tvec2<T, P> operator/(T scalar, tvec2<T, P> const & v)
597	{
598		return tvec2<T, P>(
599			scalar / v.x,
600			scalar / v.y);
601	}
602
603	template <typename T, precision P>
604	GLM_FUNC_QUALIFIER tvec2<T, P> operator/(tvec1<T, P> const & v1, tvec2<T, P> const & v2)
605	{
606		return tvec2<T, P>(
607			v1.x / v2.x,
608			v1.x / v2.y);
609	}
610
611	template <typename T, precision P>
612	GLM_FUNC_QUALIFIER tvec2<T, P> operator/(tvec2<T, P> const & v1, tvec2<T, P> const & v2)
613	{
614		return tvec2<T, P>(
615			v1.x / v2.x,
616			v1.y / v2.y);
617	}
618
619	// -- Binary bit operators --
620
621	template <typename T, precision P>
622	GLM_FUNC_QUALIFIER tvec2<T, P> operator%(tvec2<T, P> const & v, T scalar)
623	{
624		return tvec2<T, P>(
625			v.x % scalar,
626			v.y % scalar);
627	}
628
629	template <typename T, precision P>
630	GLM_FUNC_QUALIFIER tvec2<T, P> operator%(tvec2<T, P> const & v1, tvec1<T, P> const & v2)
631	{
632		return tvec2<T, P>(
633			v1.x % v2.x,
634			v1.y % v2.x);
635	}
636
637	template <typename T, precision P>
638	GLM_FUNC_QUALIFIER tvec2<T, P> operator%(T scalar, tvec2<T, P> const & v)
639	{
640		return tvec2<T, P>(
641			scalar % v.x,
642			scalar % v.y);
643	}
644
645	template <typename T, precision P>
646	GLM_FUNC_QUALIFIER tvec2<T, P> operator%(tvec1<T, P> const & v1, tvec2<T, P> const & v2)
647	{
648		return tvec2<T, P>(
649			v1.x % v2.x,
650			v1.x % v2.y);
651	}
652
653	template <typename T, precision P>
654	GLM_FUNC_QUALIFIER tvec2<T, P> operator%(tvec2<T, P> const & v1, tvec2<T, P> const & v2)
655	{
656		return tvec2<T, P>(
657			v1.x % v2.x,
658			v1.y % v2.y);
659	}
660
661	template <typename T, precision P>
662	GLM_FUNC_QUALIFIER tvec2<T, P> operator&(tvec2<T, P> const & v, T scalar)
663	{
664		return tvec2<T, P>(
665			v.x & scalar,
666			v.y & scalar);
667	}
668
669	template <typename T, precision P>
670	GLM_FUNC_QUALIFIER tvec2<T, P> operator&(tvec2<T, P> const & v1, tvec1<T, P> const & v2)
671	{
672		return tvec2<T, P>(
673			v1.x & v2.x,
674			v1.y & v2.x);
675	}
676
677	template <typename T, precision P>
678	GLM_FUNC_QUALIFIER tvec2<T, P> operator&(T scalar, tvec2<T, P> const & v)
679	{
680		return tvec2<T, P>(
681			scalar & v.x,
682			scalar & v.y);
683	}
684
685	template <typename T, precision P>
686	GLM_FUNC_QUALIFIER tvec2<T, P> operator&(tvec1<T, P> const & v1, tvec2<T, P> const & v2)
687	{
688		return tvec2<T, P>(
689			v1.x & v2.x,
690			v1.x & v2.y);
691	}
692
693	template <typename T, precision P>
694	GLM_FUNC_QUALIFIER tvec2<T, P> operator&(tvec2<T, P> const & v1, tvec2<T, P> const & v2)
695	{
696		return tvec2<T, P>(
697			v1.x & v2.x,
698			v1.y & v2.y);
699	}
700
701	template <typename T, precision P>
702	GLM_FUNC_QUALIFIER tvec2<T, P> operator|(tvec2<T, P> const & v, T scalar)
703	{
704		return tvec2<T, P>(
705			v.x | scalar,
706			v.y | scalar);
707	}
708
709	template <typename T, precision P>
710	GLM_FUNC_QUALIFIER tvec2<T, P> operator|(tvec2<T, P> const & v1, tvec1<T, P> const & v2)
711	{
712		return tvec2<T, P>(
713			v1.x | v2.x,
714			v1.y | v2.x);
715	}
716
717	template <typename T, precision P>
718	GLM_FUNC_QUALIFIER tvec2<T, P> operator|(T scalar, tvec2<T, P> const & v)
719	{
720		return tvec2<T, P>(
721			scalar | v.x,
722			scalar | v.y);
723	}
724
725	template <typename T, precision P>
726	GLM_FUNC_QUALIFIER tvec2<T, P> operator|(tvec1<T, P> const & v1, tvec2<T, P> const & v2)
727	{
728		return tvec2<T, P>(
729			v1.x | v2.x,
730			v1.x | v2.y);
731	}
732
733	template <typename T, precision P>
734	GLM_FUNC_QUALIFIER tvec2<T, P> operator|(tvec2<T, P> const & v1, tvec2<T, P> const & v2)
735	{
736		return tvec2<T, P>(
737			v1.x | v2.x,
738			v1.y | v2.y);
739	}
740
741	template <typename T, precision P>
742	GLM_FUNC_QUALIFIER tvec2<T, P> operator^(tvec2<T, P> const & v, T scalar)
743	{
744		return tvec2<T, P>(
745			v.x ^ scalar,
746			v.y ^ scalar);
747	}
748
749	template <typename T, precision P>
750	GLM_FUNC_QUALIFIER tvec2<T, P> operator^(tvec2<T, P> const & v1, tvec1<T, P> const & v2)
751	{
752		return tvec2<T, P>(
753			v1.x ^ v2.x,
754			v1.y ^ v2.x);
755	}
756
757	template <typename T, precision P>
758	GLM_FUNC_QUALIFIER tvec2<T, P> operator^(T scalar, tvec2<T, P> const & v)
759	{
760		return tvec2<T, P>(
761			scalar ^ v.x,
762			scalar ^ v.y);
763	}
764
765	template <typename T, precision P>
766	GLM_FUNC_QUALIFIER tvec2<T, P> operator^(tvec1<T, P> const & v1, tvec2<T, P> const & v2)
767	{
768		return tvec2<T, P>(
769			v1.x ^ v2.x,
770			v1.x ^ v2.y);
771	}
772
773	template <typename T, precision P>
774	GLM_FUNC_QUALIFIER tvec2<T, P> operator^(tvec2<T, P> const & v1, tvec2<T, P> const & v2)
775	{
776		return tvec2<T, P>(
777			v1.x ^ v2.x,
778			v1.y ^ v2.y);
779	}
780
781	template <typename T, precision P>
782	GLM_FUNC_QUALIFIER tvec2<T, P> operator<<(tvec2<T, P> const & v, T scalar)
783	{
784		return tvec2<T, P>(
785			v.x << scalar,
786			v.y << scalar);
787	}
788
789	template <typename T, precision P>
790	GLM_FUNC_QUALIFIER tvec2<T, P> operator<<(tvec2<T, P> const & v1, tvec1<T, P> const & v2)
791	{
792		return tvec2<T, P>(
793			v1.x << v2.x,
794			v1.y << v2.x);
795	}
796
797	template <typename T, precision P>
798	GLM_FUNC_QUALIFIER tvec2<T, P> operator<<(T scalar, tvec2<T, P> const & v)
799	{
800		return tvec2<T, P>(
801			scalar << v.x,
802			scalar << v.y);
803	}
804
805	template <typename T, precision P>
806	GLM_FUNC_QUALIFIER tvec2<T, P> operator<<(tvec1<T, P> const & v1, tvec2<T, P> const & v2)
807	{
808		return tvec2<T, P>(
809			v1.x << v2.x,
810			v1.x << v2.y);
811	}
812
813	template <typename T, precision P>
814	GLM_FUNC_QUALIFIER tvec2<T, P> operator<<(tvec2<T, P> const & v1, tvec2<T, P> const & v2)
815	{
816		return tvec2<T, P>(
817			v1.x << v2.x,
818			v1.y << v2.y);
819	}
820
821	template <typename T, precision P>
822	GLM_FUNC_QUALIFIER tvec2<T, P> operator>>(tvec2<T, P> const & v, T scalar)
823	{
824		return tvec2<T, P>(
825			v.x >> scalar,
826			v.y >> scalar);
827	}
828
829	template <typename T, precision P>
830	GLM_FUNC_QUALIFIER tvec2<T, P> operator>>(tvec2<T, P> const & v1, tvec1<T, P> const & v2)
831	{
832		return tvec2<T, P>(
833			v1.x >> v2.x,
834			v1.y >> v2.x);
835	}
836
837	template <typename T, precision P>
838	GLM_FUNC_QUALIFIER tvec2<T, P> operator>>(T scalar, tvec2<T, P> const & v)
839	{
840		return tvec2<T, P>(
841			scalar >> v.x,
842			scalar >> v.y);
843	}
844
845	template <typename T, precision P>
846	GLM_FUNC_QUALIFIER tvec2<T, P> operator>>(tvec1<T, P> const & v1, tvec2<T, P> const & v2)
847	{
848		return tvec2<T, P>(
849			v1.x >> v2.x,
850			v1.x >> v2.y);
851	}
852
853	template <typename T, precision P>
854	GLM_FUNC_QUALIFIER tvec2<T, P> operator>>(tvec2<T, P> const & v1, tvec2<T, P> const & v2)
855	{
856		return tvec2<T, P>(
857			v1.x >> v2.x,
858			v1.y >> v2.y);
859	}
860
861	template <typename T, precision P>
862	GLM_FUNC_QUALIFIER tvec2<T, P> operator~(tvec2<T, P> const & v)
863	{
864		return tvec2<T, P>(
865			~v.x,
866			~v.y);
867	}
868
869	// -- Boolean operators --
870
871	template <typename T, precision P>
872	GLM_FUNC_QUALIFIER bool operator==(tvec2<T, P> const & v1, tvec2<T, P> const & v2)
873	{
874		return (v1.x == v2.x) && (v1.y == v2.y);
875	}
876
877	template <typename T, precision P>
878	GLM_FUNC_QUALIFIER bool operator!=(tvec2<T, P> const & v1, tvec2<T, P> const & v2)
879	{
880		return (v1.x != v2.x) || (v1.y != v2.y);
881	}
882
883	template <precision P>
884	GLM_FUNC_QUALIFIER tvec2<bool, P> operator&&(tvec2<bool, P> const & v1, tvec2<bool, P> const & v2)
885	{
886		return tvec2<bool, P>(v1.x && v2.x, v1.y && v2.y);
887	}
888
889	template <precision P>
890	GLM_FUNC_QUALIFIER tvec2<bool, P> operator||(tvec2<bool, P> const & v1, tvec2<bool, P> const & v2)
891	{
892		return tvec2<bool, P>(v1.x || v2.x, v1.y || v2.y);
893	}
894}//namespace glm
895