Clutter Engine 0.0.1
Loading...
Searching...
No Matches
type_mat3x2.inl
1namespace glm
2{
3 // -- Constructors --
4
5# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_DISABLE
6 template<typename T, qualifier Q>
7 GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>::mat()
8# if GLM_CONFIG_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST
9 : value{col_type(1, 0), col_type(0, 1), col_type(0, 0)}
10# endif
11 {
12# if GLM_CONFIG_CTOR_INIT == GLM_CTOR_INITIALISATION
13 this->value[0] = col_type(1, 0);
14 this->value[1] = col_type(0, 1);
15 this->value[2] = col_type(0, 0);
16# endif
17 }
18# endif
19
20 template<typename T, qualifier Q>
21 template<qualifier P>
22 GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>::mat(mat<3, 2, T, P> const& m)
23# if GLM_HAS_INITIALIZER_LISTS
24 : value{col_type(m[0]), col_type(m[1]), col_type(m[2])}
25# endif
26 {
27# if !GLM_HAS_INITIALIZER_LISTS
28 this->value[0] = m[0];
29 this->value[1] = m[1];
30 this->value[2] = m[2];
31# endif
32 }
33
34 template<typename T, qualifier Q>
35 GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>::mat(T s)
36# if GLM_HAS_INITIALIZER_LISTS
37 : value{col_type(s, 0), col_type(0, s), col_type(0, 0)}
38# endif
39 {
40# if !GLM_HAS_INITIALIZER_LISTS
41 this->value[0] = col_type(s, 0);
42 this->value[1] = col_type(0, s);
43 this->value[2] = col_type(0, 0);
44# endif
45 }
46
47 template<typename T, qualifier Q>
48 GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>::mat
49 (
50 T x0, T y0,
51 T x1, T y1,
52 T x2, T y2
53 )
54# if GLM_HAS_INITIALIZER_LISTS
55 : value{col_type(x0, y0), col_type(x1, y1), col_type(x2, y2)}
56# endif
57 {
58# if !GLM_HAS_INITIALIZER_LISTS
59 this->value[0] = col_type(x0, y0);
60 this->value[1] = col_type(x1, y1);
61 this->value[2] = col_type(x2, y2);
62# endif
63 }
64
65 template<typename T, qualifier Q>
66 GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>::mat(col_type const& v0, col_type const& v1, col_type const& v2)
67# if GLM_HAS_INITIALIZER_LISTS
68 : value{col_type(v0), col_type(v1), col_type(v2)}
69# endif
70 {
71# if !GLM_HAS_INITIALIZER_LISTS
72 this->value[0] = v0;
73 this->value[1] = v1;
74 this->value[2] = v2;
75# endif
76 }
77
78 // -- Conversion constructors --
79
80 template<typename T, qualifier Q>
81 template<
82 typename X0, typename Y0,
83 typename X1, typename Y1,
84 typename X2, typename Y2>
85 GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>::mat
86 (
87 X0 x0, Y0 y0,
88 X1 x1, Y1 y1,
89 X2 x2, Y2 y2
90 )
91# if GLM_HAS_INITIALIZER_LISTS
92 : value{col_type(x0, y0), col_type(x1, y1), col_type(x2, y2)}
93# endif
94 {
95# if !GLM_HAS_INITIALIZER_LISTS
96 this->value[0] = col_type(x0, y0);
97 this->value[1] = col_type(x1, y1);
98 this->value[2] = col_type(x2, y2);
99# endif
100 }
101
102 template<typename T, qualifier Q>
103 template<typename V0, typename V1, typename V2>
104 GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>::mat(vec<2, V0, Q> const& v0, vec<2, V1, Q> const& v1, vec<2, V2, Q> const& v2)
105# if GLM_HAS_INITIALIZER_LISTS
106 : value{col_type(v0), col_type(v1), col_type(v2)}
107# endif
108 {
109# if !GLM_HAS_INITIALIZER_LISTS
110 this->value[0] = col_type(v0);
111 this->value[1] = col_type(v1);
112 this->value[2] = col_type(v2);
113# endif
114 }
115
116 // -- Matrix conversions --
117
118 template<typename T, qualifier Q>
119 template<typename U, qualifier P>
120 GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>::mat(mat<3, 2, U, P> const& m)
121# if GLM_HAS_INITIALIZER_LISTS
122 : value{col_type(m[0]), col_type(m[1]), col_type(m[2])}
123# endif
124 {
125# if !GLM_HAS_INITIALIZER_LISTS
126 this->value[0] = col_type(m[0]);
127 this->value[1] = col_type(m[1]);
128 this->value[2] = col_type(m[2]);
129# endif
130 }
131
132 template<typename T, qualifier Q>
133 GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>::mat(mat<2, 2, T, Q> const& m)
134# if GLM_HAS_INITIALIZER_LISTS
135 : value{col_type(m[0]), col_type(m[1]), col_type(0)}
136# endif
137 {
138# if !GLM_HAS_INITIALIZER_LISTS
139 this->value[0] = m[0];
140 this->value[1] = m[1];
141 this->value[2] = col_type(0);
142# endif
143 }
144
145 template<typename T, qualifier Q>
146 GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>::mat(mat<3, 3, T, Q> const& m)
147# if GLM_HAS_INITIALIZER_LISTS
148 : value{col_type(m[0]), col_type(m[1]), col_type(m[2])}
149# endif
150 {
151# if !GLM_HAS_INITIALIZER_LISTS
152 this->value[0] = col_type(m[0]);
153 this->value[1] = col_type(m[1]);
154 this->value[2] = col_type(m[2]);
155# endif
156 }
157
158 template<typename T, qualifier Q>
159 GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>::mat(mat<4, 4, T, Q> const& m)
160# if GLM_HAS_INITIALIZER_LISTS
161 : value{col_type(m[0]), col_type(m[1]), col_type(m[2])}
162# endif
163 {
164# if !GLM_HAS_INITIALIZER_LISTS
165 this->value[0] = col_type(m[0]);
166 this->value[1] = col_type(m[1]);
167 this->value[2] = col_type(m[2]);
168# endif
169 }
170
171 template<typename T, qualifier Q>
172 GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>::mat(mat<2, 3, T, Q> const& m)
173# if GLM_HAS_INITIALIZER_LISTS
174 : value{col_type(m[0]), col_type(m[1]), col_type(0)}
175# endif
176 {
177# if !GLM_HAS_INITIALIZER_LISTS
178 this->value[0] = col_type(m[0]);
179 this->value[1] = col_type(m[1]);
180 this->value[2] = col_type(0);
181# endif
182 }
183
184 template<typename T, qualifier Q>
185 GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>::mat(mat<2, 4, T, Q> const& m)
186# if GLM_HAS_INITIALIZER_LISTS
187 : value{col_type(m[0]), col_type(m[1]), col_type(0)}
188# endif
189 {
190# if !GLM_HAS_INITIALIZER_LISTS
191 this->value[0] = col_type(m[0]);
192 this->value[1] = col_type(m[1]);
193 this->value[2] = col_type(0);
194# endif
195 }
196
197 template<typename T, qualifier Q>
198 GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>::mat(mat<3, 4, T, Q> const& m)
199# if GLM_HAS_INITIALIZER_LISTS
200 : value{col_type(m[0]), col_type(m[1]), col_type(m[2])}
201# endif
202 {
203# if !GLM_HAS_INITIALIZER_LISTS
204 this->value[0] = col_type(m[0]);
205 this->value[1] = col_type(m[1]);
206 this->value[2] = col_type(m[2]);
207# endif
208 }
209
210 template<typename T, qualifier Q>
211 GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>::mat(mat<4, 2, T, Q> const& m)
212# if GLM_HAS_INITIALIZER_LISTS
213 : value{col_type(m[0]), col_type(m[1]), col_type(m[2])}
214# endif
215 {
216# if !GLM_HAS_INITIALIZER_LISTS
217 this->value[0] = m[0];
218 this->value[1] = m[1];
219 this->value[2] = m[2];
220# endif
221 }
222
223 template<typename T, qualifier Q>
224 GLM_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>::mat(mat<4, 3, T, Q> const& m)
225# if GLM_HAS_INITIALIZER_LISTS
226 : value{col_type(m[0]), col_type(m[1]), col_type(m[2])}
227# endif
228 {
229# if !GLM_HAS_INITIALIZER_LISTS
230 this->value[0] = col_type(m[0]);
231 this->value[1] = col_type(m[1]);
232 this->value[2] = col_type(m[2]);
233# endif
234 }
235
236 // -- Accesses --
237
238 template<typename T, qualifier Q>
239 GLM_FUNC_QUALIFIER typename mat<3, 2, T, Q>::col_type & mat<3, 2, T, Q>::operator[](typename mat<3, 2, T, Q>::length_type i)
240 {
241 assert(i < this->length());
242 return this->value[i];
243 }
244
245 template<typename T, qualifier Q>
246 GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename mat<3, 2, T, Q>::col_type const& mat<3, 2, T, Q>::operator[](typename mat<3, 2, T, Q>::length_type i) const
247 {
248 assert(i < this->length());
249 return this->value[i];
250 }
251
252 // -- Unary updatable operators --
253
254 template<typename T, qualifier Q>
255 template<typename U>
256 GLM_FUNC_QUALIFIER mat<3, 2, T, Q>& mat<3, 2, T, Q>::operator=(mat<3, 2, U, Q> const& m)
257 {
258 this->value[0] = m[0];
259 this->value[1] = m[1];
260 this->value[2] = m[2];
261 return *this;
262 }
263
264 template<typename T, qualifier Q>
265 template<typename U>
266 GLM_FUNC_QUALIFIER mat<3, 2, T, Q>& mat<3, 2, T, Q>::operator+=(U s)
267 {
268 this->value[0] += s;
269 this->value[1] += s;
270 this->value[2] += s;
271 return *this;
272 }
273
274 template<typename T, qualifier Q>
275 template<typename U>
276 GLM_FUNC_QUALIFIER mat<3, 2, T, Q>& mat<3, 2, T, Q>::operator+=(mat<3, 2, U, Q> const& m)
277 {
278 this->value[0] += m[0];
279 this->value[1] += m[1];
280 this->value[2] += m[2];
281 return *this;
282 }
283
284 template<typename T, qualifier Q>
285 template<typename U>
286 GLM_FUNC_QUALIFIER mat<3, 2, T, Q>& mat<3, 2, T, Q>::operator-=(U s)
287 {
288 this->value[0] -= s;
289 this->value[1] -= s;
290 this->value[2] -= s;
291 return *this;
292 }
293
294 template<typename T, qualifier Q>
295 template<typename U>
296 GLM_FUNC_QUALIFIER mat<3, 2, T, Q>& mat<3, 2, T, Q>::operator-=(mat<3, 2, U, Q> const& m)
297 {
298 this->value[0] -= m[0];
299 this->value[1] -= m[1];
300 this->value[2] -= m[2];
301 return *this;
302 }
303
304 template<typename T, qualifier Q>
305 template<typename U>
306 GLM_FUNC_QUALIFIER mat<3, 2, T, Q>& mat<3, 2, T, Q>::operator*=(U s)
307 {
308 this->value[0] *= s;
309 this->value[1] *= s;
310 this->value[2] *= s;
311 return *this;
312 }
313
314 template<typename T, qualifier Q>
315 template<typename U>
316 GLM_FUNC_QUALIFIER mat<3, 2, T, Q> & mat<3, 2, T, Q>::operator/=(U s)
317 {
318 this->value[0] /= s;
319 this->value[1] /= s;
320 this->value[2] /= s;
321 return *this;
322 }
323
324 // -- Increment and decrement operators --
325
326 template<typename T, qualifier Q>
327 GLM_FUNC_QUALIFIER mat<3, 2, T, Q>& mat<3, 2, T, Q>::operator++()
328 {
329 ++this->value[0];
330 ++this->value[1];
331 ++this->value[2];
332 return *this;
333 }
334
335 template<typename T, qualifier Q>
336 GLM_FUNC_QUALIFIER mat<3, 2, T, Q>& mat<3, 2, T, Q>::operator--()
337 {
338 --this->value[0];
339 --this->value[1];
340 --this->value[2];
341 return *this;
342 }
343
344 template<typename T, qualifier Q>
345 GLM_FUNC_QUALIFIER mat<3, 2, T, Q> mat<3, 2, T, Q>::operator++(int)
346 {
347 mat<3, 2, T, Q> Result(*this);
348 ++*this;
349 return Result;
350 }
351
352 template<typename T, qualifier Q>
353 GLM_FUNC_QUALIFIER mat<3, 2, T, Q> mat<3, 2, T, Q>::operator--(int)
354 {
355 mat<3, 2, T, Q> Result(*this);
356 --*this;
357 return Result;
358 }
359
360 // -- Unary arithmetic operators --
361
362 template<typename T, qualifier Q>
363 GLM_FUNC_QUALIFIER mat<3, 2, T, Q> operator+(mat<3, 2, T, Q> const& m)
364 {
365 return m;
366 }
367
368 template<typename T, qualifier Q>
369 GLM_FUNC_QUALIFIER mat<3, 2, T, Q> operator-(mat<3, 2, T, Q> const& m)
370 {
371 return mat<3, 2, T, Q>(
372 -m[0],
373 -m[1],
374 -m[2]);
375 }
376
377 // -- Binary arithmetic operators --
378
379 template<typename T, qualifier Q>
380 GLM_FUNC_QUALIFIER mat<3, 2, T, Q> operator+(mat<3, 2, T, Q> const& m, T scalar)
381 {
382 return mat<3, 2, T, Q>(
383 m[0] + scalar,
384 m[1] + scalar,
385 m[2] + scalar);
386 }
387
388 template<typename T, qualifier Q>
389 GLM_FUNC_QUALIFIER mat<3, 2, T, Q> operator+(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2)
390 {
391 return mat<3, 2, T, Q>(
392 m1[0] + m2[0],
393 m1[1] + m2[1],
394 m1[2] + m2[2]);
395 }
396
397 template<typename T, qualifier Q>
398 GLM_FUNC_QUALIFIER mat<3, 2, T, Q> operator-(mat<3, 2, T, Q> const& m, T scalar)
399 {
400 return mat<3, 2, T, Q>(
401 m[0] - scalar,
402 m[1] - scalar,
403 m[2] - scalar);
404 }
405
406 template<typename T, qualifier Q>
407 GLM_FUNC_QUALIFIER mat<3, 2, T, Q> operator-(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2)
408 {
409 return mat<3, 2, T, Q>(
410 m1[0] - m2[0],
411 m1[1] - m2[1],
412 m1[2] - m2[2]);
413 }
414
415 template<typename T, qualifier Q>
416 GLM_FUNC_QUALIFIER mat<3, 2, T, Q> operator*(mat<3, 2, T, Q> const& m, T scalar)
417 {
418 return mat<3, 2, T, Q>(
419 m[0] * scalar,
420 m[1] * scalar,
421 m[2] * scalar);
422 }
423
424 template<typename T, qualifier Q>
425 GLM_FUNC_QUALIFIER mat<3, 2, T, Q> operator*(T scalar, mat<3, 2, T, Q> const& m)
426 {
427 return mat<3, 2, T, Q>(
428 m[0] * scalar,
429 m[1] * scalar,
430 m[2] * scalar);
431 }
432
433 template<typename T, qualifier Q>
434 GLM_FUNC_QUALIFIER typename mat<3, 2, T, Q>::col_type operator*(mat<3, 2, T, Q> const& m, typename mat<3, 2, T, Q>::row_type const& v)
435 {
436 return typename mat<3, 2, T, Q>::col_type(
437 m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z,
438 m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z);
439 }
440
441 template<typename T, qualifier Q>
442 GLM_FUNC_QUALIFIER typename mat<3, 2, T, Q>::row_type operator*(typename mat<3, 2, T, Q>::col_type const& v, mat<3, 2, T, Q> const& m)
443 {
444 return typename mat<3, 2, T, Q>::row_type(
445 v.x * m[0][0] + v.y * m[0][1],
446 v.x * m[1][0] + v.y * m[1][1],
447 v.x * m[2][0] + v.y * m[2][1]);
448 }
449
450 template<typename T, qualifier Q>
451 GLM_FUNC_QUALIFIER mat<2, 2, T, Q> operator*(mat<3, 2, T, Q> const& m1, mat<2, 3, T, Q> const& m2)
452 {
453 const T SrcA00 = m1[0][0];
454 const T SrcA01 = m1[0][1];
455 const T SrcA10 = m1[1][0];
456 const T SrcA11 = m1[1][1];
457 const T SrcA20 = m1[2][0];
458 const T SrcA21 = m1[2][1];
459
460 const T SrcB00 = m2[0][0];
461 const T SrcB01 = m2[0][1];
462 const T SrcB02 = m2[0][2];
463 const T SrcB10 = m2[1][0];
464 const T SrcB11 = m2[1][1];
465 const T SrcB12 = m2[1][2];
466
467 mat<2, 2, T, Q> Result;
468 Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02;
469 Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02;
470 Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12;
471 Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11 + SrcA21 * SrcB12;
472 return Result;
473 }
474
475 template<typename T, qualifier Q>
476 GLM_FUNC_QUALIFIER mat<3, 2, T, Q> operator*(mat<3, 2, T, Q> const& m1, mat<3, 3, T, Q> const& m2)
477 {
478 return mat<3, 2, T, Q>(
479 m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1] + m1[2][0] * m2[0][2],
480 m1[0][1] * m2[0][0] + m1[1][1] * m2[0][1] + m1[2][1] * m2[0][2],
481 m1[0][0] * m2[1][0] + m1[1][0] * m2[1][1] + m1[2][0] * m2[1][2],
482 m1[0][1] * m2[1][0] + m1[1][1] * m2[1][1] + m1[2][1] * m2[1][2],
483 m1[0][0] * m2[2][0] + m1[1][0] * m2[2][1] + m1[2][0] * m2[2][2],
484 m1[0][1] * m2[2][0] + m1[1][1] * m2[2][1] + m1[2][1] * m2[2][2]);
485 }
486
487 template<typename T, qualifier Q>
488 GLM_FUNC_QUALIFIER mat<4, 2, T, Q> operator*(mat<3, 2, T, Q> const& m1, mat<4, 3, T, Q> const& m2)
489 {
490 return mat<4, 2, T, Q>(
491 m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1] + m1[2][0] * m2[0][2],
492 m1[0][1] * m2[0][0] + m1[1][1] * m2[0][1] + m1[2][1] * m2[0][2],
493 m1[0][0] * m2[1][0] + m1[1][0] * m2[1][1] + m1[2][0] * m2[1][2],
494 m1[0][1] * m2[1][0] + m1[1][1] * m2[1][1] + m1[2][1] * m2[1][2],
495 m1[0][0] * m2[2][0] + m1[1][0] * m2[2][1] + m1[2][0] * m2[2][2],
496 m1[0][1] * m2[2][0] + m1[1][1] * m2[2][1] + m1[2][1] * m2[2][2],
497 m1[0][0] * m2[3][0] + m1[1][0] * m2[3][1] + m1[2][0] * m2[3][2],
498 m1[0][1] * m2[3][0] + m1[1][1] * m2[3][1] + m1[2][1] * m2[3][2]);
499 }
500
501 template<typename T, qualifier Q>
502 GLM_FUNC_QUALIFIER mat<3, 2, T, Q> operator/(mat<3, 2, T, Q> const& m, T scalar)
503 {
504 return mat<3, 2, T, Q>(
505 m[0] / scalar,
506 m[1] / scalar,
507 m[2] / scalar);
508 }
509
510 template<typename T, qualifier Q>
511 GLM_FUNC_QUALIFIER mat<3, 2, T, Q> operator/(T scalar, mat<3, 2, T, Q> const& m)
512 {
513 return mat<3, 2, T, Q>(
514 scalar / m[0],
515 scalar / m[1],
516 scalar / m[2]);
517 }
518
519 // -- Boolean operators --
520
521 template<typename T, qualifier Q>
522 GLM_FUNC_QUALIFIER bool operator==(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2)
523 {
524 return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]);
525 }
526
527 template<typename T, qualifier Q>
528 GLM_FUNC_QUALIFIER bool operator!=(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2)
529 {
530 return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]);
531 }
532} //namespace glm
Core features
Definition common.hpp:21