Matrix4x4-Impl.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: Matrix4x4-Impl.h
3 > Project Name: CubbyFlow
4 > Author: Dongmin Kim
5 > Purpose: 4-D matrix class.
6 > Created Time: 2017/03/08
7 > Copyright (c) 2018, Dongmin Kim
8 *************************************************************************/
9 #ifndef CUBBYFLOW_MATRIX4X4_IMPL_H
10 #define CUBBYFLOW_MATRIX4X4_IMPL_H
11 
12 #include <cassert>
13 
14 namespace CubbyFlow
15 {
16  template <typename T>
18  {
19  Set(1, 0, 0, 0,
20  0, 1, 0, 0,
21  0, 0, 1, 0,
22  0, 0, 0, 1);
23  }
24 
25  template <typename T>
27  {
28  Set(s);
29  }
30 
31  template <typename T>
32  Matrix<T, 4, 4>::Matrix(T m00, T m01, T m02,
33  T m10, T m11, T m12,
34  T m20, T m21, T m22)
35  {
36  Set(m00, m01, m02,
37  m10, m11, m12,
38  m20, m21, m22);
39  }
40 
41  template <typename T>
43  T m00, T m01, T m02, T m03,
44  T m10, T m11, T m12, T m13,
45  T m20, T m21, T m22, T m23,
46  T m30, T m31, T m32, T m33)
47  {
48  Set(m00, m01, m02, m03,
49  m10, m11, m12, m13,
50  m20, m21, m22, m23,
51  m30, m31, m32, m33);
52  }
53 
54  template <typename T>
55  template <typename U>
56  Matrix<T, 4, 4>::Matrix(const std::initializer_list<std::initializer_list<U>>& list)
57  {
58  Set(list);
59  }
60 
61  template <typename T>
63  {
64  Set(m33);
65  }
66 
67  template <typename T>
69  {
70  Set(m);
71  }
72 
73  template <typename T>
75  {
76  Set(arr);
77  }
78 
79  template <typename T>
81  {
82  m_elements[0] = s;
83  m_elements[1] = s;
84  m_elements[2] = s;
85  m_elements[3] = s;
86  m_elements[4] = s;
87  m_elements[5] = s;
88  m_elements[6] = s;
89  m_elements[7] = s;
90  m_elements[8] = s;
91  m_elements[9] = s;
92  m_elements[10] = s;
93  m_elements[11] = s;
94  m_elements[12] = s;
95  m_elements[13] = s;
96  m_elements[14] = s;
97  m_elements[15] = s;
98  }
99 
100  template <typename T>
102  T m00, T m01, T m02,
103  T m10, T m11, T m12,
104  T m20, T m21, T m22)
105  {
106  m_elements[0] = m00;
107  m_elements[1] = m01;
108  m_elements[2] = m02;
109  m_elements[3] = 0;
110  m_elements[4] = m10;
111  m_elements[5] = m11;
112  m_elements[6] = m12;
113  m_elements[7] = 0;
114  m_elements[8] = m20;
115  m_elements[9] = m21;
116  m_elements[10] = m22;
117  m_elements[11] = 0;
118  m_elements[12] = 0;
119  m_elements[13] = 0;
120  m_elements[14] = 0;
121  m_elements[15] = 1;
122  }
123 
124  template <typename T>
126  T m00, T m01, T m02, T m03,
127  T m10, T m11, T m12, T m13,
128  T m20, T m21, T m22, T m23,
129  T m30, T m31, T m32, T m33)
130  {
131  m_elements[0] = m00;
132  m_elements[1] = m01;
133  m_elements[2] = m02;
134  m_elements[3] = m03;
135  m_elements[4] = m10;
136  m_elements[5] = m11;
137  m_elements[6] = m12;
138  m_elements[7] = m13;
139  m_elements[8] = m20;
140  m_elements[9] = m21;
141  m_elements[10] = m22;
142  m_elements[11] = m23;
143  m_elements[12] = m30;
144  m_elements[13] = m31;
145  m_elements[14] = m32;
146  m_elements[15] = m33;
147  }
148 
149  template <typename T>
150  template <typename U>
151  void Matrix<T, 4, 4>::Set(const std::initializer_list<std::initializer_list<U>>& list)
152  {
153  size_t height = list.size();
154  size_t width = (height > 0) ? list.begin()->size() : 0;
155 
156  assert(width == 4);
157  assert(height == 4);
158 
159  auto rowIter = list.begin();
160  for (size_t i = 0; i < height; ++i)
161  {
162  assert(width == rowIter->size());
163 
164  auto colIter = rowIter->begin();
165  for (size_t j = 0; j < width; ++j)
166  {
167  (*this)(i, j) = static_cast<T>(*colIter);
168  ++colIter;
169  }
170 
171  ++rowIter;
172  }
173  }
174 
175  template <typename T>
177  {
178  Set(m33[0], m33[1], m33[2], 0,
179  m33[3], m33[4], m33[5], 0,
180  m33[6], m33[7], m33[8], 0,
181  0, 0, 0, 1);
182  }
183 
184  template <typename T>
186  {
187  for (size_t i = 0; i < 16; ++i)
188  {
189  m_elements[i] = m.m_elements[i];
190  }
191  }
192 
193  template <typename T>
194  void Matrix<T, 4, 4>::Set(const T* arr)
195  {
196  for (size_t i = 0; i < 16; ++i)
197  {
198  m_elements[i] = arr[i];
199  }
200  }
201 
202  template <typename T>
204  {
205  m_elements[0] = s;
206  m_elements[5] = s;
207  m_elements[10] = s;
208  m_elements[15] = s;
209  }
210 
211  template <typename T>
213  {
214  m_elements[1] = s;
215  m_elements[2] = s;
216  m_elements[3] = s;
217  m_elements[4] = s;
218  m_elements[6] = s;
219  m_elements[7] = s;
220  m_elements[8] = s;
221  m_elements[9] = s;
222  m_elements[11] = s;
223  m_elements[12] = s;
224  m_elements[13] = s;
225  m_elements[14] = s;
226  }
227 
228  template <typename T>
229  void Matrix<T, 4, 4>::SetRow(size_t i, const Vector4<T>& row)
230  {
231  m_elements[i * 4] = row.x;
232  m_elements[i * 4 + 1] = row.y;
233  m_elements[i * 4 + 2] = row.z;
234  m_elements[i * 4 + 3] = row.w;
235  }
236 
237  template <typename T>
238  void Matrix<T, 4, 4>::SetColumn(size_t i, const Vector4<T>& col)
239  {
240  m_elements[i] = col.x;
241  m_elements[i + 4] = col.y;
242  m_elements[i + 8] = col.z;
243  m_elements[i + 12] = col.w;
244  }
245 
246  template <typename T>
247  bool Matrix<T, 4, 4>::IsSimilar(const Matrix& m, double tol) const
248  {
249  return
250  std::fabs(m_elements[0] - m.m_elements[0]) < tol &&
251  std::fabs(m_elements[1] - m.m_elements[1]) < tol &&
252  std::fabs(m_elements[2] - m.m_elements[2]) < tol &&
253  std::fabs(m_elements[3] - m.m_elements[3]) < tol &&
254  std::fabs(m_elements[4] - m.m_elements[4]) < tol &&
255  std::fabs(m_elements[5] - m.m_elements[5]) < tol &&
256  std::fabs(m_elements[6] - m.m_elements[6]) < tol &&
257  std::fabs(m_elements[7] - m.m_elements[7]) < tol &&
258  std::fabs(m_elements[8] - m.m_elements[8]) < tol &&
259  std::fabs(m_elements[9] - m.m_elements[9]) < tol &&
260  std::fabs(m_elements[10] - m.m_elements[10]) < tol &&
261  std::fabs(m_elements[11] - m.m_elements[11]) < tol &&
262  std::fabs(m_elements[12] - m.m_elements[12]) < tol &&
263  std::fabs(m_elements[13] - m.m_elements[13]) < tol &&
264  std::fabs(m_elements[14] - m.m_elements[14]) < tol &&
265  std::fabs(m_elements[15] - m.m_elements[15]) < tol;
266  }
267 
268  template <typename T>
270  {
271  return true;
272  }
273 
274  template <typename T>
275  size_t Matrix<T, 4, 4>::Rows() const
276  {
277  return 4;
278  }
279 
280  template <typename T>
281  size_t Matrix<T, 4, 4>::Cols() const
282  {
283  return 4;
284  }
285 
286  template <typename T>
288  {
289  return m_elements.data();
290  }
291 
292  template <typename T>
293  const T* Matrix<T, 4, 4>::data() const
294  {
295  return m_elements.data();
296  }
297 
298  template <typename T>
300  {
301  return Matrix<T, 3, 3>(
302  m_elements[0], m_elements[1], m_elements[2],
303  m_elements[4], m_elements[5], m_elements[6],
304  m_elements[8], m_elements[9], m_elements[10]);
305  }
306 
307  template <typename T>
309  {
310  return Matrix<T, 4, 4>(
311  m_elements[0] + s, m_elements[1] + s, m_elements[2] + s, m_elements[3] + s,
312  m_elements[4] + s, m_elements[5] + s, m_elements[6] + s, m_elements[7] + s,
313  m_elements[8] + s, m_elements[9] + s, m_elements[10] + s, m_elements[11] + s,
314  m_elements[12] + s, m_elements[13] + s, m_elements[14] + s, m_elements[15] + s);
315  }
316 
317  template <typename T>
319  {
320  return Matrix<T, 4, 4>(
321  m_elements[0] + m.m_elements[0], m_elements[1] + m.m_elements[1], m_elements[2] + m.m_elements[2], m_elements[3] + m.m_elements[3],
322  m_elements[4] + m.m_elements[4], m_elements[5] + m.m_elements[5], m_elements[6] + m.m_elements[6], m_elements[7] + m.m_elements[7],
323  m_elements[8] + m.m_elements[8], m_elements[9] + m.m_elements[9], m_elements[10] + m.m_elements[10], m_elements[11] + m.m_elements[11],
324  m_elements[12] + m.m_elements[12], m_elements[13] + m.m_elements[13], m_elements[14] + m.m_elements[14], m_elements[15] + m.m_elements[15]);
325  }
326 
327  template <typename T>
329  {
330  return Matrix<T, 4, 4>(
331  m_elements[0] - s, m_elements[1] - s, m_elements[2] - s, m_elements[3] - s,
332  m_elements[4] - s, m_elements[5] - s, m_elements[6] - s, m_elements[7] - s,
333  m_elements[8] - s, m_elements[9] - s, m_elements[10] - s, m_elements[11] - s,
334  m_elements[12] - s, m_elements[13] - s, m_elements[14] - s, m_elements[15] - s);
335  }
336 
337  template <typename T>
339  {
340  return Matrix<T, 4, 4>(
341  m_elements[0] - m.m_elements[0], m_elements[1] - m.m_elements[1], m_elements[2] - m.m_elements[2], m_elements[3] - m.m_elements[3],
342  m_elements[4] - m.m_elements[4], m_elements[5] - m.m_elements[5], m_elements[6] - m.m_elements[6], m_elements[7] - m.m_elements[7],
343  m_elements[8] - m.m_elements[8], m_elements[9] - m.m_elements[9], m_elements[10] - m.m_elements[10], m_elements[11] - m.m_elements[11],
344  m_elements[12] - m.m_elements[12], m_elements[13] - m.m_elements[13], m_elements[14] - m.m_elements[14], m_elements[15] - m.m_elements[15]);
345  }
346 
347  template <typename T>
349  {
350  return Matrix<T, 4, 4>(
351  m_elements[0] * s, m_elements[1] * s, m_elements[2] * s, m_elements[3] * s,
352  m_elements[4] * s, m_elements[5] * s, m_elements[6] * s, m_elements[7] * s,
353  m_elements[8] * s, m_elements[9] * s, m_elements[10] * s, m_elements[11] * s,
354  m_elements[12] * s, m_elements[13] * s, m_elements[14] * s, m_elements[15] * s);
355  }
356 
357  template <typename T>
359  {
360  return Vector4<T>(
361  m_elements[0] * v.x + m_elements[1] * v.y + m_elements[2] * v.z + m_elements[3] * v.w,
362  m_elements[4] * v.x + m_elements[5] * v.y + m_elements[6] * v.z + m_elements[7] * v.w,
363  m_elements[8] * v.x + m_elements[9] * v.y + m_elements[10] * v.z + m_elements[11] * v.w,
364  m_elements[12] * v.x + m_elements[13] * v.y + m_elements[14] * v.z + m_elements[15] * v.w);
365  }
366 
367  template <typename T>
369  {
370  return Matrix(
371  m_elements[0] * m.m_elements[0] + m_elements[1] * m.m_elements[4] + m_elements[2] * m.m_elements[8] + m_elements[3] * m.m_elements[12],
372  m_elements[0] * m.m_elements[1] + m_elements[1] * m.m_elements[5] + m_elements[2] * m.m_elements[9] + m_elements[3] * m.m_elements[13],
373  m_elements[0] * m.m_elements[2] + m_elements[1] * m.m_elements[6] + m_elements[2] * m.m_elements[10] + m_elements[3] * m.m_elements[14],
374  m_elements[0] * m.m_elements[3] + m_elements[1] * m.m_elements[7] + m_elements[2] * m.m_elements[11] + m_elements[3] * m.m_elements[15],
375 
376  m_elements[4] * m.m_elements[0] + m_elements[5] * m.m_elements[4] + m_elements[6] * m.m_elements[8] + m_elements[7] * m.m_elements[12],
377  m_elements[4] * m.m_elements[1] + m_elements[5] * m.m_elements[5] + m_elements[6] * m.m_elements[9] + m_elements[7] * m.m_elements[13],
378  m_elements[4] * m.m_elements[2] + m_elements[5] * m.m_elements[6] + m_elements[6] * m.m_elements[10] + m_elements[7] * m.m_elements[14],
379  m_elements[4] * m.m_elements[3] + m_elements[5] * m.m_elements[7] + m_elements[6] * m.m_elements[11] + m_elements[7] * m.m_elements[15],
380 
381  m_elements[8] * m.m_elements[0] + m_elements[9] * m.m_elements[4] + m_elements[10] * m.m_elements[8] + m_elements[11] * m.m_elements[12],
382  m_elements[8] * m.m_elements[1] + m_elements[9] * m.m_elements[5] + m_elements[10] * m.m_elements[9] + m_elements[11] * m.m_elements[13],
383  m_elements[8] * m.m_elements[2] + m_elements[9] * m.m_elements[6] + m_elements[10] * m.m_elements[10] + m_elements[11] * m.m_elements[14],
384  m_elements[8] * m.m_elements[3] + m_elements[9] * m.m_elements[7] + m_elements[10] * m.m_elements[11] + m_elements[11] * m.m_elements[15],
385 
386  m_elements[12] * m.m_elements[0] + m_elements[13] * m.m_elements[4] + m_elements[14] * m.m_elements[8] + m_elements[15] * m.m_elements[12],
387  m_elements[12] * m.m_elements[1] + m_elements[13] * m.m_elements[5] + m_elements[14] * m.m_elements[9] + m_elements[15] * m.m_elements[13],
388  m_elements[12] * m.m_elements[2] + m_elements[13] * m.m_elements[6] + m_elements[14] * m.m_elements[10] + m_elements[15] * m.m_elements[14],
389  m_elements[12] * m.m_elements[3] + m_elements[13] * m.m_elements[7] + m_elements[14] * m.m_elements[11] + m_elements[15] * m.m_elements[15]);
390  }
391 
392  template <typename T>
394  {
395  return Matrix<T, 4, 4>(
396  m_elements[0] / s, m_elements[1] / s, m_elements[2] / s, m_elements[3] / s,
397  m_elements[4] / s, m_elements[5] / s, m_elements[6] / s, m_elements[7] / s,
398  m_elements[8] / s, m_elements[9] / s, m_elements[10] / s, m_elements[11] / s,
399  m_elements[12] / s, m_elements[13] / s, m_elements[14] / s, m_elements[15] / s);
400  }
401 
402  template <typename T>
404  {
405  return Matrix<T, 4, 4>(
406  s + m_elements[0], s + m_elements[1], s + m_elements[2], s + m_elements[3],
407  s + m_elements[4], s + m_elements[5], s + m_elements[6], s + m_elements[7],
408  s + m_elements[8], s + m_elements[9], s + m_elements[10], s + m_elements[11],
409  s + m_elements[12], s + m_elements[13], s + m_elements[14], s + m_elements[15]);
410  }
411 
412  template <typename T>
414  {
415  return Matrix<T, 4, 4>(
416  m.m_elements[0] + m_elements[0], m.m_elements[1] + m_elements[1], m.m_elements[2] + m_elements[2], m.m_elements[3] + m_elements[3],
417  m.m_elements[4] + m_elements[4], m.m_elements[5] + m_elements[5], m.m_elements[6] + m_elements[6], m.m_elements[7] + m_elements[7],
418  m.m_elements[8] + m_elements[8], m.m_elements[9] + m_elements[9], m.m_elements[10] + m_elements[10], m.m_elements[11] + m_elements[11],
419  m.m_elements[12] + m_elements[12], m.m_elements[13] + m_elements[13], m.m_elements[14] + m_elements[14], m.m_elements[15] + m_elements[15]);
420  }
421 
422  template <typename T>
424  {
425  return Matrix<T, 4, 4>(
426  s - m_elements[0], s - m_elements[1], s - m_elements[2], s - m_elements[3],
427  s - m_elements[4], s - m_elements[5], s - m_elements[6], s - m_elements[7],
428  s - m_elements[8], s - m_elements[9], s - m_elements[10], s - m_elements[11],
429  s - m_elements[12], s - m_elements[13], s - m_elements[14], s - m_elements[15]);
430  }
431 
432  template <typename T>
434  {
435  return Matrix<T, 4, 4>(
436  m.m_elements[0] - m_elements[0], m.m_elements[1] - m_elements[1], m.m_elements[2] - m_elements[2], m.m_elements[3] - m_elements[3],
437  m.m_elements[4] - m_elements[4], m.m_elements[5] - m_elements[5], m.m_elements[6] - m_elements[6], m.m_elements[7] - m_elements[7],
438  m.m_elements[8] - m_elements[8], m.m_elements[9] - m_elements[9], m.m_elements[10] - m_elements[10], m.m_elements[11] - m_elements[11],
439  m.m_elements[12] - m_elements[12], m.m_elements[13] - m_elements[13], m.m_elements[14] - m_elements[14], m.m_elements[15] - m_elements[15]);
440  }
441 
442  template <typename T>
444  {
445  return Matrix<T, 4, 4>(
446  s * m_elements[0], s * m_elements[1], s * m_elements[2], s * m_elements[3],
447  s * m_elements[4], s * m_elements[5], s * m_elements[6], s * m_elements[7],
448  s * m_elements[8], s * m_elements[9], s * m_elements[10], s * m_elements[11],
449  s * m_elements[12], s * m_elements[13], s * m_elements[14], s * m_elements[15]);
450  }
451 
452  template <typename T>
454  {
455  return m.Mul(*this);
456  }
457 
458  template <typename T>
460  {
461  return Matrix<T, 4, 4>(
462  s / m_elements[0], s / m_elements[1], s / m_elements[2], s / m_elements[3],
463  s / m_elements[4], s / m_elements[5], s / m_elements[6], s / m_elements[7],
464  s / m_elements[8], s / m_elements[9], s / m_elements[10], s / m_elements[11],
465  s / m_elements[12], s / m_elements[13], s / m_elements[14], s / m_elements[15]);
466  }
467 
468  template <typename T>
470  {
471  m_elements[0] += s;
472  m_elements[1] += s;
473  m_elements[2] += s;
474  m_elements[3] += s;
475  m_elements[4] += s;
476  m_elements[5] += s;
477  m_elements[6] += s;
478  m_elements[7] += s;
479  m_elements[8] += s;
480  m_elements[9] += s;
481  m_elements[10] += s;
482  m_elements[11] += s;
483  m_elements[12] += s;
484  m_elements[13] += s;
485  m_elements[14] += s;
486  m_elements[15] += s;
487  }
488 
489  template <typename T>
491  {
492  m_elements[0] += m.m_elements[0];
493  m_elements[1] += m.m_elements[1];
494  m_elements[2] += m.m_elements[2];
495  m_elements[3] += m.m_elements[3];
496  m_elements[4] += m.m_elements[4];
497  m_elements[5] += m.m_elements[5];
498  m_elements[6] += m.m_elements[6];
499  m_elements[7] += m.m_elements[7];
500  m_elements[8] += m.m_elements[8];
501  m_elements[9] += m.m_elements[9];
502  m_elements[10] += m.m_elements[10];
503  m_elements[11] += m.m_elements[11];
504  m_elements[12] += m.m_elements[12];
505  m_elements[13] += m.m_elements[13];
506  m_elements[14] += m.m_elements[14];
507  m_elements[15] += m.m_elements[15];
508  }
509 
510  template <typename T>
512  {
513  m_elements[0] -= s;
514  m_elements[1] -= s;
515  m_elements[2] -= s;
516  m_elements[3] -= s;
517  m_elements[4] -= s;
518  m_elements[5] -= s;
519  m_elements[6] -= s;
520  m_elements[7] -= s;
521  m_elements[8] -= s;
522  m_elements[9] -= s;
523  m_elements[10] -= s;
524  m_elements[11] -= s;
525  m_elements[12] -= s;
526  m_elements[13] -= s;
527  m_elements[14] -= s;
528  m_elements[15] -= s;
529  }
530 
531  template <typename T>
533  {
534  m_elements[0] -= m.m_elements[0];
535  m_elements[1] -= m.m_elements[1];
536  m_elements[2] -= m.m_elements[2];
537  m_elements[3] -= m.m_elements[3];
538  m_elements[4] -= m.m_elements[4];
539  m_elements[5] -= m.m_elements[5];
540  m_elements[6] -= m.m_elements[6];
541  m_elements[7] -= m.m_elements[7];
542  m_elements[8] -= m.m_elements[8];
543  m_elements[9] -= m.m_elements[9];
544  m_elements[10] -= m.m_elements[10];
545  m_elements[11] -= m.m_elements[11];
546  m_elements[12] -= m.m_elements[12];
547  m_elements[13] -= m.m_elements[13];
548  m_elements[14] -= m.m_elements[14];
549  m_elements[15] -= m.m_elements[15];
550  }
551 
552  template <typename T>
554  {
555  m_elements[0] *= s;
556  m_elements[1] *= s;
557  m_elements[2] *= s;
558  m_elements[3] *= s;
559  m_elements[4] *= s;
560  m_elements[5] *= s;
561  m_elements[6] *= s;
562  m_elements[7] *= s;
563  m_elements[8] *= s;
564  m_elements[9] *= s;
565  m_elements[10] *= s;
566  m_elements[11] *= s;
567  m_elements[12] *= s;
568  m_elements[13] *= s;
569  m_elements[14] *= s;
570  m_elements[15] *= s;
571  }
572 
573  template <typename T>
575  {
576  Set(Mul(m));
577  }
578 
579  template <typename T>
581  {
582  m_elements[0] /= s;
583  m_elements[1] /= s;
584  m_elements[2] /= s;
585  m_elements[3] /= s;
586  m_elements[4] /= s;
587  m_elements[5] /= s;
588  m_elements[6] /= s;
589  m_elements[7] /= s;
590  m_elements[8] /= s;
591  m_elements[9] /= s;
592  m_elements[10] /= s;
593  m_elements[11] /= s;
594  m_elements[12] /= s;
595  m_elements[13] /= s;
596  m_elements[14] /= s;
597  m_elements[15] /= s;
598  }
599 
600  template <typename T>
602  {
603  std::swap(m_elements[1], m_elements[4]);
604  std::swap(m_elements[2], m_elements[8]);
605  std::swap(m_elements[3], m_elements[12]);
606  std::swap(m_elements[6], m_elements[9]);
607  std::swap(m_elements[7], m_elements[13]);
608  std::swap(m_elements[11], m_elements[14]);
609  }
610 
611  template <typename T>
613  {
614  T d = Determinant();
615 
616  Matrix m;
617  m.m_elements[0] = m_elements[5] * m_elements[10] * m_elements[15] + m_elements[6] * m_elements[11] * m_elements[13] + m_elements[7] * m_elements[9] * m_elements[14] - m_elements[5] * m_elements[11] * m_elements[14] - m_elements[6] * m_elements[9] * m_elements[15] - m_elements[7] * m_elements[10] * m_elements[13];
618  m.m_elements[1] = m_elements[1] * m_elements[11] * m_elements[14] + m_elements[2] * m_elements[9] * m_elements[15] + m_elements[3] * m_elements[10] * m_elements[13] - m_elements[1] * m_elements[10] * m_elements[15] - m_elements[2] * m_elements[11] * m_elements[13] - m_elements[3] * m_elements[9] * m_elements[14];
619  m.m_elements[2] = m_elements[1] * m_elements[6] * m_elements[15] + m_elements[2] * m_elements[7] * m_elements[13] + m_elements[3] * m_elements[5] * m_elements[14] - m_elements[1] * m_elements[7] * m_elements[14] - m_elements[2] * m_elements[5] * m_elements[15] - m_elements[3] * m_elements[6] * m_elements[13];
620  m.m_elements[3] = m_elements[1] * m_elements[7] * m_elements[10] + m_elements[2] * m_elements[5] * m_elements[11] + m_elements[3] * m_elements[6] * m_elements[9] - m_elements[1] * m_elements[6] * m_elements[11] - m_elements[2] * m_elements[7] * m_elements[9] - m_elements[3] * m_elements[5] * m_elements[10];
621  m.m_elements[4] = m_elements[4] * m_elements[11] * m_elements[14] + m_elements[6] * m_elements[8] * m_elements[15] + m_elements[7] * m_elements[10] * m_elements[12] - m_elements[4] * m_elements[10] * m_elements[15] - m_elements[6] * m_elements[11] * m_elements[12] - m_elements[7] * m_elements[8] * m_elements[14];
622  m.m_elements[5] = m_elements[0] * m_elements[10] * m_elements[15] + m_elements[2] * m_elements[11] * m_elements[12] + m_elements[3] * m_elements[8] * m_elements[14] - m_elements[0] * m_elements[11] * m_elements[14] - m_elements[2] * m_elements[8] * m_elements[15] - m_elements[3] * m_elements[10] * m_elements[12];
623  m.m_elements[6] = m_elements[0] * m_elements[7] * m_elements[14] + m_elements[2] * m_elements[4] * m_elements[15] + m_elements[3] * m_elements[6] * m_elements[12] - m_elements[0] * m_elements[6] * m_elements[15] - m_elements[2] * m_elements[7] * m_elements[12] - m_elements[3] * m_elements[4] * m_elements[14];
624  m.m_elements[7] = m_elements[0] * m_elements[6] * m_elements[11] + m_elements[2] * m_elements[7] * m_elements[8] + m_elements[3] * m_elements[4] * m_elements[10] - m_elements[0] * m_elements[7] * m_elements[10] - m_elements[2] * m_elements[4] * m_elements[11] - m_elements[3] * m_elements[6] * m_elements[8];
625  m.m_elements[8] = m_elements[4] * m_elements[9] * m_elements[15] + m_elements[5] * m_elements[11] * m_elements[12] + m_elements[7] * m_elements[8] * m_elements[13] - m_elements[4] * m_elements[11] * m_elements[13] - m_elements[5] * m_elements[8] * m_elements[15] - m_elements[7] * m_elements[9] * m_elements[12];
626  m.m_elements[9] = m_elements[0] * m_elements[11] * m_elements[13] + m_elements[1] * m_elements[8] * m_elements[15] + m_elements[3] * m_elements[9] * m_elements[12] - m_elements[0] * m_elements[9] * m_elements[15] - m_elements[1] * m_elements[11] * m_elements[12] - m_elements[3] * m_elements[8] * m_elements[13];
627  m.m_elements[10] = m_elements[0] * m_elements[5] * m_elements[15] + m_elements[1] * m_elements[7] * m_elements[12] + m_elements[3] * m_elements[4] * m_elements[13] - m_elements[0] * m_elements[7] * m_elements[13] - m_elements[1] * m_elements[4] * m_elements[15] - m_elements[3] * m_elements[5] * m_elements[12];
628  m.m_elements[11] = m_elements[0] * m_elements[7] * m_elements[9] + m_elements[1] * m_elements[4] * m_elements[11] + m_elements[3] * m_elements[5] * m_elements[8] - m_elements[0] * m_elements[5] * m_elements[11] - m_elements[1] * m_elements[7] * m_elements[8] - m_elements[3] * m_elements[4] * m_elements[9];
629  m.m_elements[12] = m_elements[4] * m_elements[10] * m_elements[13] + m_elements[5] * m_elements[8] * m_elements[14] + m_elements[6] * m_elements[9] * m_elements[12] - m_elements[4] * m_elements[9] * m_elements[14] - m_elements[5] * m_elements[10] * m_elements[12] - m_elements[6] * m_elements[8] * m_elements[13];
630  m.m_elements[13] = m_elements[0] * m_elements[9] * m_elements[14] + m_elements[1] * m_elements[10] * m_elements[12] + m_elements[2] * m_elements[8] * m_elements[13] - m_elements[0] * m_elements[10] * m_elements[13] - m_elements[1] * m_elements[8] * m_elements[14] - m_elements[2] * m_elements[9] * m_elements[12];
631  m.m_elements[14] = m_elements[0] * m_elements[6] * m_elements[13] + m_elements[1] * m_elements[4] * m_elements[14] + m_elements[2] * m_elements[5] * m_elements[12] - m_elements[0] * m_elements[5] * m_elements[14] - m_elements[1] * m_elements[6] * m_elements[12] - m_elements[2] * m_elements[4] * m_elements[13];
632  m.m_elements[15] = m_elements[0] * m_elements[5] * m_elements[10] + m_elements[1] * m_elements[6] * m_elements[8] + m_elements[2] * m_elements[4] * m_elements[9] - m_elements[0] * m_elements[6] * m_elements[9] - m_elements[1] * m_elements[4] * m_elements[10] - m_elements[2] * m_elements[5] * m_elements[8];
633  m.IDiv(d);
634 
635  Set(m);
636  }
637 
638  template <typename T>
640  {
641  T sum = 0;
642 
643  for (size_t i = 0; i < 16; ++i)
644  {
645  sum += m_elements[i];
646  }
647 
648  return sum;
649  }
650 
651  template <typename T>
653  {
654  return Sum() / 16;
655  }
656 
657  template <typename T>
659  {
660  return m_elements[std::distance(std::begin(m_elements), std::min_element(std::begin(m_elements), std::end(m_elements)))];
661  }
662 
663  template <typename T>
665  {
666  return m_elements[std::distance(std::begin(m_elements), std::max_element(std::begin(m_elements), std::end(m_elements)))];
667  }
668 
669  template <typename T>
671  {
672  return CubbyFlow::AbsMinN(data(), 16);
673  }
674 
675  template <typename T>
677  {
678  return CubbyFlow::AbsMaxN(data(), 16);
679  }
680 
681  template <typename T>
683  {
684  return m_elements[0] + m_elements[5] + m_elements[10] + m_elements[15];
685  }
686 
687  template <typename T>
689  {
690  return
691  m_elements[0] * m_elements[5] * m_elements[10] * m_elements[15] + m_elements[0] * m_elements[6] * m_elements[11] * m_elements[13] + m_elements[0] * m_elements[7] * m_elements[9] * m_elements[14] +
692  m_elements[1] * m_elements[4] * m_elements[11] * m_elements[14] + m_elements[1] * m_elements[6] * m_elements[8] * m_elements[15] + m_elements[1] * m_elements[7] * m_elements[10] * m_elements[12] +
693  m_elements[2] * m_elements[4] * m_elements[9] * m_elements[15] + m_elements[2] * m_elements[5] * m_elements[11] * m_elements[12] + m_elements[2] * m_elements[7] * m_elements[8] * m_elements[13] +
694  m_elements[3] * m_elements[4] * m_elements[10] * m_elements[13] + m_elements[3] * m_elements[5] * m_elements[8] * m_elements[14] + m_elements[3] * m_elements[6] * m_elements[9] * m_elements[12] -
695  m_elements[0] * m_elements[5] * m_elements[11] * m_elements[14] - m_elements[0] * m_elements[6] * m_elements[9] * m_elements[15] - m_elements[0] * m_elements[7] * m_elements[10] * m_elements[13] -
696  m_elements[1] * m_elements[4] * m_elements[10] * m_elements[15] - m_elements[1] * m_elements[6] * m_elements[11] * m_elements[12] - m_elements[1] * m_elements[7] * m_elements[8] * m_elements[14] -
697  m_elements[2] * m_elements[4] * m_elements[11] * m_elements[13] - m_elements[2] * m_elements[5] * m_elements[8] * m_elements[15] - m_elements[2] * m_elements[7] * m_elements[9] * m_elements[12] -
698  m_elements[3] * m_elements[4] * m_elements[9] * m_elements[14] - m_elements[3] * m_elements[5] * m_elements[10] * m_elements[12] - m_elements[3] * m_elements[6] * m_elements[8] * m_elements[13];
699  }
700 
701  template <typename T>
703  {
704  return Matrix<T, 4, 4>(
705  m_elements[0], 0, 0, 0,
706  0, m_elements[5], 0, 0,
707  0, 0, m_elements[10], 0,
708  0, 0, 0, m_elements[15]);
709  }
710 
711  template <typename T>
713  {
714  return Matrix<T, 4, 4>(
715  0, m_elements[1], m_elements[2], m_elements[3],
716  m_elements[4], 0, m_elements[6], m_elements[7],
717  m_elements[8], m_elements[9], 0, m_elements[11],
718  m_elements[12], m_elements[13], m_elements[14], 0);
719  }
720 
721  template <typename T>
723  {
724  return Matrix<T, 4, 4>(
725  0, 0, 0, 0,
726  m_elements[4], 0, 0, 0,
727  m_elements[8], m_elements[9], 0, 0,
728  m_elements[12], m_elements[13], m_elements[14], 0);
729  }
730 
731  template <typename T>
733  {
734  return Matrix<T, 4, 4>(
735  0, m_elements[1], m_elements[2], m_elements[3],
736  0, 0, m_elements[6], m_elements[7],
737  0, 0, 0, m_elements[11],
738  0, 0, 0, 0);
739  }
740 
741  template <typename T>
743  {
744  return Matrix<T, 4, 4>(
745  m_elements[0], 0, 0, 0,
746  m_elements[4], m_elements[5], 0, 0,
747  m_elements[8], m_elements[9], m_elements[10], 0,
748  m_elements[12], m_elements[13], m_elements[14], m_elements[15]);
749  }
750 
751  template <typename T>
753  {
754  return Matrix<T, 4, 4>(
755  m_elements[0], m_elements[1], m_elements[2], m_elements[3],
756  0, m_elements[5], m_elements[6], m_elements[7],
757  0, 0, m_elements[10], m_elements[11],
758  0, 0, 0, m_elements[15]);
759  }
760 
761  template <typename T>
763  {
764  return Matrix<T, 4, 4>(
765  m_elements[0], m_elements[4], m_elements[8], m_elements[12],
766  m_elements[1], m_elements[5], m_elements[9], m_elements[13],
767  m_elements[2], m_elements[6], m_elements[10], m_elements[14],
768  m_elements[3], m_elements[7], m_elements[11], m_elements[15]);
769  }
770 
771  template <typename T>
773  {
774  Matrix m(*this);
775  m.Invert();
776  return m;
777  }
778 
779  template <typename T>
780  template <typename U>
782  {
783  return Matrix<U, 4, 4>(
784  static_cast<U>(m_elements[0]),
785  static_cast<U>(m_elements[1]),
786  static_cast<U>(m_elements[2]),
787  static_cast<U>(m_elements[3]),
788  static_cast<U>(m_elements[4]),
789  static_cast<U>(m_elements[5]),
790  static_cast<U>(m_elements[6]),
791  static_cast<U>(m_elements[7]),
792  static_cast<U>(m_elements[8]),
793  static_cast<U>(m_elements[9]),
794  static_cast<U>(m_elements[10]),
795  static_cast<U>(m_elements[11]),
796  static_cast<U>(m_elements[12]),
797  static_cast<U>(m_elements[13]),
798  static_cast<U>(m_elements[14]),
799  static_cast<U>(m_elements[15]));
800  }
801 
802  template <typename T>
804  {
805  Set(m);
806  return *this;
807  }
808 
809  template <typename T>
811  {
812  IAdd(s);
813  return *this;
814  }
815 
816  template <typename T>
818  {
819  IAdd(m);
820  return *this;
821  }
822 
823  template <typename T>
825  {
826  ISub(s);
827  return *this;
828  }
829 
830  template <typename T>
832  {
833  ISub(m);
834  return *this;
835  }
836 
837  template <typename T>
839  {
840  IMul(s);
841  return *this;
842  }
843 
844  template <typename T>
846  {
847  IMul(m);
848  return *this;
849  }
850 
851  template <typename T>
853  {
854  IDiv(s);
855  return *this;
856  }
857 
858  template <typename T>
860  {
861  return m_elements[i];
862  }
863 
864  template <typename T>
865  const T& Matrix<T, 4, 4>::operator[](size_t i) const
866  {
867  return m_elements[i];
868  }
869 
870  template <typename T>
871  T& Matrix<T, 4, 4>::operator()(size_t i, size_t j)
872  {
873  return m_elements[i * 4 + j];
874  }
875 
876  template <typename T>
877  const T& Matrix<T, 4, 4>::operator()(size_t i, size_t j) const
878  {
879  return m_elements[i * 4 + j];
880  }
881 
882  template <typename T>
883  bool Matrix<T, 4, 4>::operator==(const Matrix& m) const
884  {
885  return
886  m_elements[0] == m.m_elements[0] &&
887  m_elements[1] == m.m_elements[1] &&
888  m_elements[2] == m.m_elements[2] &&
889  m_elements[3] == m.m_elements[3] &&
890  m_elements[4] == m.m_elements[4] &&
891  m_elements[5] == m.m_elements[5] &&
892  m_elements[6] == m.m_elements[6] &&
893  m_elements[7] == m.m_elements[7] &&
894  m_elements[8] == m.m_elements[8] &&
895  m_elements[9] == m.m_elements[9] &&
896  m_elements[10] == m.m_elements[10] &&
897  m_elements[11] == m.m_elements[11] &&
898  m_elements[12] == m.m_elements[12] &&
899  m_elements[13] == m.m_elements[13] &&
900  m_elements[14] == m.m_elements[14] &&
901  m_elements[15] == m.m_elements[15];
902  }
903 
904  template <typename T>
905  bool Matrix<T, 4, 4>::operator!=(const Matrix& m) const
906  {
907  return
908  m_elements[0] != m.m_elements[0] ||
909  m_elements[1] != m.m_elements[1] ||
910  m_elements[2] != m.m_elements[2] ||
911  m_elements[3] != m.m_elements[3] ||
912  m_elements[4] != m.m_elements[4] ||
913  m_elements[5] != m.m_elements[5] ||
914  m_elements[6] != m.m_elements[6] ||
915  m_elements[7] != m.m_elements[7] ||
916  m_elements[8] != m.m_elements[8] ||
917  m_elements[9] != m.m_elements[9] ||
918  m_elements[10] != m.m_elements[10] ||
919  m_elements[11] != m.m_elements[11] ||
920  m_elements[12] != m.m_elements[12] ||
921  m_elements[13] != m.m_elements[13] ||
922  m_elements[14] != m.m_elements[14] ||
923  m_elements[15] != m.m_elements[15];
924  }
925 
926  template <typename T>
928  {
929  return Matrix<T, 4, 4>(
930  0, 0, 0, 0,
931  0, 0, 0, 0,
932  0, 0, 0, 0,
933  0, 0, 0, 0);
934  }
935 
936  template <typename T>
938  {
939  return Matrix<T, 4, 4>(
940  1, 0, 0, 0,
941  0, 1, 0, 0,
942  0, 0, 1, 0,
943  0, 0, 0, 1);
944  }
945 
946  template <typename T>
948  {
949  return Matrix<T, 4, 4>(
950  sx, 0, 0, 0,
951  0, sy, 0, 0,
952  0, 0, sz, 0,
953  0, 0, 0, 1);
954  }
955 
956  template <typename T>
958  {
959  return MakeScaleMatrix(s.x, s.y, s.z);
960  }
961 
962  template <typename T>
964  {
966  }
967 
968  template <typename T>
970  {
971  return Matrix<T, 4, 4>(
972  1, 0, 0, t.x,
973  0, 1, 0, t.y,
974  0, 0, 1, t.z,
975  0, 0, 0, 1);
976  }
977 
978  template <typename T>
980  {
981  return a.Mul(-1);
982  }
983 
984  template <typename T>
986  {
987  return a.Add(b);
988  }
989 
990  template <typename T>
992  {
993  return a.Add(b);
994  }
995 
996  template <typename T>
998  {
999  return b.RAdd(a);
1000  }
1001 
1002  template <typename T>
1004  {
1005  return a.Sub(b);
1006  }
1007 
1008  template <typename T>
1010  {
1011  return a.Sub(b);
1012  }
1013 
1014  template <typename T>
1016  {
1017  return b.RSub(a);
1018  }
1019 
1020  template <typename T>
1022  {
1023  return a.Mul(b);
1024  }
1025 
1026  template <typename T>
1028  {
1029  return b.RMul(a);
1030  }
1031 
1032  template <typename T>
1034  {
1035  return a.Mul(b);
1036  }
1037 
1038  template <typename T>
1040  {
1041  return a.Mul(b);
1042  }
1043 
1044  template <typename T>
1046  {
1047  return a.Mul(b);
1048  }
1049 
1050  template <typename T>
1052  {
1053  return a.Div(b);
1054  }
1055 
1056  template <typename T>
1058  {
1059  return b.RDiv(a);
1060  }
1061 }
1062 
1063 #endif
3-D vector class.
Definition: Vector3.h:26
Matrix Mul(T s) const
Returns this matrix * input scalar.
Definition: Matrix4x4-Impl.h:348
bool IsSimilar(const MatrixExpression< T, E > &other, double tol=std::numeric_limits< double >::epsilon()) const
Definition: Matrix-Impl.h:169
static MatrixConstant< T > MakeZero()
Makes a M x N matrix with zeros.
Definition: Matrix-Impl.h:823
MatrixDiagonal< T, Matrix > Diagonal() const
Returns diagonal part of this matrix.
Definition: Matrix-Impl.h:633
MatrixDiagonal< T, Matrix > OffDiagonal() const
Returns off-diagonal part of this matrix.
Definition: Matrix-Impl.h:639
T Sum() const
Returns sum of all elements.
Definition: Matrix-Impl.h:483
Matrix & operator*=(const T &s)
Multiplication assignment with input scalar.
Definition: Matrix-Impl.h:737
T z
Z (or the third) component of the vector.
Definition: Vector3.h:38
Matrix & operator/=(const T &s)
Division assignment with input scalar.
Definition: Matrix-Impl.h:752
Matrix RDiv(T s) const
Returns input matrix / this scalar.
Definition: Matrix4x4-Impl.h:459
T * data()
Returns data pointer of this matrix.
Definition: Matrix-Impl.h:217
void SetDiagonal(const T &s)
Sets diagonal elements with input scalar.
Definition: Matrix-Impl.h:92
Matrix< T, 2, 2 > operator+(const Matrix< T, 2, 2 > &a, const Matrix< T, 2, 2 > &b)
Returns a + b (element-size).
Definition: Matrix2x2-Impl.h:660
void IMul(const T &s)
Multiplies input scalar to this matrix.
Definition: Matrix-Impl.h:376
MatrixScalarRSub< T, Matrix > RSub(const T &s) const
Returns input scalar - this matrix.
Definition: Matrix-Impl.h:318
Matrix Div(T s) const
Returns this matrix / input scalar.
Definition: Matrix4x4-Impl.h:393
T AbsMaxN(const T *x, size_t n)
Returns absolute maximum among n-elements.
Definition: MathUtils-Impl.h:64
T y
Y (or the second) component of the vector.
Definition: Vector4.h:35
void IAdd(const T &s)
Adds input scalar to this matrix.
Definition: Matrix-Impl.h:350
void Set(const T &s)
Sets whole matrix with input scalar.
Definition: Matrix-Impl.h:52
MatrixScalarAdd< T, Matrix > Add(const T &s) const
Returns this matrix + input scalar.
Definition: Matrix-Impl.h:253
void SetRow(size_t i, const VectorExpression< T, E > &row)
Sets i-th row with input vector.
Definition: Matrix-Impl.h:116
void IDiv(const T &s)
Divides this matrix with input scalar.
Definition: Matrix-Impl.h:390
bool operator!=(const MatrixExpression< T, E > &m) const
Returns true if is not equal to m.
Definition: Matrix-Impl.h:791
Matrix Sub(T s) const
Returns this matrix - input scalar.
Definition: Matrix4x4-Impl.h:328
void ISub(const T &s)
Subtracts input scalar from this matrix.
Definition: Matrix-Impl.h:363
Matrix RSub(T s) const
Returns input scalar - this matrix.
Definition: Matrix4x4-Impl.h:423
constexpr size_t Cols() const
Returns number of columns of this matrix.
Definition: Matrix-Impl.h:211
T Max() const
Returns maximum among all elements.
Definition: Matrix-Impl.h:515
Matrix & operator+=(const T &s)
Addition assignment with input scalar.
Definition: Matrix-Impl.h:707
MatrixScalarDiv< T, Matrix > Div(const T &s) const
Returns this matrix / input scalar.
Definition: Matrix-Impl.h:299
MatrixScalarSub< T, Matrix > Sub(const T &s) const
Returns this matrix - input scalar.
Definition: Matrix-Impl.h:266
Matrix Inverse() const
Returns inverse matrix.
Definition: Matrix-Impl.h:677
MatrixScalarMul< T, Matrix > RMul(const T &s) const
Returns input scalar * this matrix.
Definition: Matrix-Impl.h:331
MatrixScalarAdd< T, Matrix > RAdd(const T &s) const
Returns input scalar + this matrix.
Definition: Matrix-Impl.h:305
T w
W (or the fourth) component of the vector.
Definition: Vector4.h:41
T AbsMinN(const T *x, size_t n)
Returns absolute minimum among n-elements.
Definition: MathUtils-Impl.h:51
Static-sized M x N matrix class.
Definition: Matrix.h:30
MatrixScalarMul< T, Matrix > Mul(const T &s) const
Returns this matrix * input scalar.
Definition: Matrix-Impl.h:279
Matrix Add(T s) const
Returns this matrix + input scalar.
Definition: Matrix4x4-Impl.h:308
void Invert()
Inverts this matrix.
Definition: Matrix-Impl.h:402
T x
X (or the first) component of the vector.
Definition: Vector3.h:29
Matrix< T, 2, 2 > operator/(const Matrix< T, 2, 2 > &a, T b)
Definition: Matrix2x2-Impl.h:720
Definition: pybind11Utils.h:24
3-D matrix class.
Definition: Matrix3x3.h:30
4-D matrix class.
Definition: Matrix4x4.h:29
T z
Z (or the third) component of the vector.
Definition: Vector4.h:38
T & operator[](size_t i)
Returns reference of i-th element.
Definition: Matrix-Impl.h:759
bool operator==(const MatrixExpression< T, E > &m) const
Returns true if is equal to m.
Definition: Matrix-Impl.h:784
constexpr bool IsSquare() const
Returns true if this matrix is a square matrix.
Definition: Matrix-Impl.h:193
Matrix< T, 2, 2 > operator-(const Matrix< T, 2, 2 > &a)
Returns a matrix with opposite sign.
Definition: Matrix2x2-Impl.h:654
4-D vector class.
Definition: Vector4.h:26
Matrix & operator-=(const T &s)
Subtraction assignment with input scalar.
Definition: Matrix-Impl.h:722
Matrix & operator=(const E &m)
Assigns input matrix.
const Matrix< T, M, N > & operator()() const
Returns actual implementation (the subclass).
Definition: MatrixExpression-Impl.h:34
T Trace() const
Definition: Matrix-Impl.h:554
T Avg() const
Returns average of all elements.
Definition: Matrix-Impl.h:496
T Determinant() const
Returns determinant of this matrix.
Definition: Matrix-Impl.h:569
Matrix RMul(T s) const
Returns input scalar * this matrix.
Definition: Matrix4x4-Impl.h:443
void Transpose()
Transposes this matrix.
Definition: Matrix-Impl.h:396
static MatrixIdentity< T > MakeIdentity()
Makes a M x N matrix with all diagonal elements to 1, and other elements to 0.
Definition: Matrix-Impl.h:829
T Min() const
Returns minimum among all elements.
Definition: Matrix-Impl.h:502
T AbsMin() const
Returns absolute minimum among all elements.
Definition: Matrix-Impl.h:528
Vector< T, 3 > operator*(const Quaternion< T > &q, const Vector< T, 3 > &v)
Returns quaternion q * vector v.
Definition: Quaternion-Impl.h:481
T x
X (or the first) component of the vector.
Definition: Vector4.h:29
void SetOffDiagonal(const T &s)
Sets off-diagonal elements with input scalar.
Definition: Matrix-Impl.h:103
MatrixTypeCast< U, Matrix, T > CastTo() const
MatrixScalarRDiv< T, Matrix > RDiv(const T &s) const
Returns input matrix / this scalar.
Definition: Matrix-Impl.h:344
constexpr size_t Rows() const
Returns number of rows of this matrix.
Definition: Matrix-Impl.h:205
Matrix< T, N, M > Transposed() const
Returns transposed matrix.
Definition: Matrix-Impl.h:669
T AbsMax() const
Returns absolute maximum among all elements.
Definition: Matrix-Impl.h:541
Matrix()
Definition: Matrix-Impl.h:15
T y
Y (or the second) component of the vector.
Definition: Vector3.h:35
Matrix RAdd(T s) const
Returns input scalar + this matrix.
Definition: Matrix4x4-Impl.h:403
void SetColumn(size_t j, const VectorExpression< T, E > &col)
Sets j-th column with input vector.
Definition: Matrix-Impl.h:130