VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtMatrix4.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 #pragma once
10 
11 #include <vrvMath/DtAssert.h>
12 #include <vrvMath/DtMatrix3.h>
13 
14 #include <cstring>
15 
16 namespace makVrv
17 {
18 
21  template<class T>
22  class DtMatrix4
23  {
24  public:
26  DtMatrix4();
28  DtMatrix4(const T rhs[4][4]);
30  DtMatrix4(const T rhs[16]);
32  DtMatrix4(T m00, T m01, T m02, T m03
33  , T m10, T m11, T m12, T m13
34  , T m20, T m21, T m22, T m23
35  , T m30, T m31, T m32, T m33);
39  DtMatrix4(const DtMatrix3<T>& rhs);
40 
42  ~DtMatrix4();
43  public:
44 
46  void operator=(const DtMatrix3<T>& rhs);
47 
49  DtMatrix4 operator*(const DtMatrix4& rhs) const;
50 
52  DtVector4<T> operator*(const DtVector4<T>& rhs) const;
53 
55  void setZero(void);
56 
58  void setIdentity(void);
59 
61  DtMatrix4 getTranspose(void) const;
62 
64  bool isEqual(const DtMatrix4& rhs, T tolerance) const;
65 
66  bool isIdentity(T tolerance = std::numeric_limits<T>::epsilon()) const;
67 
69 
70  const T* operator [](size_t iRow) const;
71  T* operator [](size_t iRow);
72 
73  const void* ptr(void) const;
74 
76 
78  bool isAffine(void) const;
79 
82 
84  const DtVector4<T> transposeMultiply(const DtVector4<T>& rhs) const;
85 
87  DtMatrix4<T> getInverse(void) const;
88 
90  // begin with
91  DtMatrix4<T> getInverseAffine(void) const;
92 
94  void zeroOutTranslation(void);
95 
97  void translateBack(const DtVector3<T>& v);
98 
100  bool operator==(const DtMatrix4<T>& rhs) const;
101 
103  bool operator!=(const DtMatrix4<T>& rhs) const;
104 
106  void setRow(int row, const DtVector4<T>& vec);
107 
109  void setColumn(int col, const DtVector4<T>& vec);
110 
112  DtVector4<T> getRow(int row) const;
113 
115  DtVector4<T> getColumn(int col) const;
116 
118  void transpose();
119 
121  void multiply(const DtMatrix4<T>& lhs, const DtMatrix4<T>& rhs);
122  private:
123  union
124  {
125  T _m[16];
126  T m[4][4];
127  };
128  };
129 
130  template <class T>
131  DtMatrix4<T> DtMatrix4<T>::theIdentityMatrix = DtMatrix4<T>(1,0,0,0
132  , 0,1,0,0
133  , 0,0,1,0
134  , 0,0,0,1);
135 
138 
139  template<class T>
141  {
142 
143  }
144 
145  template<class T>
146  DtMatrix4<T>::DtMatrix4(const T rhs[4][4])
147  {
148  memcpy(_m, rhs, 16*sizeof(T));
149  }
150 
151  template<class T>
152  DtMatrix4<T>::DtMatrix4(T m00, T m01, T m02, T m03
153  , T m10, T m11, T m12, T m13
154  , T m20, T m21, T m22, T m23
155  , T m30, T m31, T m32, T m33)
156  {
157  m[0][0]=m00;m[0][1]=m01;m[0][2]=m02;m[0][3]=m03;
158  m[1][0]=m10;m[1][1]=m11;m[1][2]=m12;m[1][3]=m13;
159  m[2][0]=m20;m[2][1]=m21;m[2][2]=m22;m[2][3]=m23;
160  m[3][0]=m30;m[3][1]=m31;m[3][2]=m32;m[3][3]=m33;
161  }
162 
163  template<class T>
164  DtMatrix4<T>::DtMatrix4(const T rhs[16])
165  {
166  memcpy(m, rhs, 16*sizeof(T));
167  }
168 
169  template<class T>
171  {
172  //intentional nop
173  }
174 
175  template<class T>
176  const void* DtMatrix4<T>::ptr(void) const
177  {
178  return _m;
179  }
180 
181  template<class T>
182  const T* DtMatrix4<T>::operator [](size_t iRow) const
183  {
185  return m[iRow];
186  }
187  template<class T>
189  {
191  return m[iRow];
192  }
193 
194  template<class T>
196  {
197  /*
198  | lhs.00, lhs.01, lhs.02, lhs.03 | | rhs.00, rhs.01, rhs.02, rhs.03 |
199  | lhs.10, lhs.11, lhs.12, lhs.13 | | rhs.10, rhs.11, rhs.12, rhs.13 |
200  | lhs.20, lhs.21, lhs.22, lhs.23 | | rhs.20, rhs.21, rhs.22, rhs.23 |
201  | lhs.30, lhs.31, lhs.32, lhs.33 | | rhs.30, rhs.31, rhs.32, rhs.33 |
202  */
203  const DtMatrix4& lhs = *this;
204 
205  DtMatrix4 result;
206 
207  result.m[0][0] = lhs.m[0][0]*rhs.m[0][0] + lhs.m[0][1]*rhs.m[1][0] + lhs.m[0][2]*rhs.m[2][0] + lhs.m[0][3]*rhs.m[3][0];
208  result.m[0][1] = lhs.m[0][0]*rhs.m[0][1] + lhs.m[0][1]*rhs.m[1][1] + lhs.m[0][2]*rhs.m[2][1] + lhs.m[0][3]*rhs.m[3][1];
209  result.m[0][2] = lhs.m[0][0]*rhs.m[0][2] + lhs.m[0][1]*rhs.m[1][2] + lhs.m[0][2]*rhs.m[2][2] + lhs.m[0][3]*rhs.m[3][2];
210  result.m[0][3] = lhs.m[0][0]*rhs.m[0][3] + lhs.m[0][1]*rhs.m[1][3] + lhs.m[0][2]*rhs.m[2][3] + lhs.m[0][3]*rhs.m[3][3];
211 
212  result.m[1][0] = lhs.m[1][0]*rhs.m[0][0] + lhs.m[1][1]*rhs.m[1][0] + lhs.m[1][2]*rhs.m[2][0] + lhs.m[1][3]*rhs.m[3][0];
213  result.m[1][1] = lhs.m[1][0]*rhs.m[0][1] + lhs.m[1][1]*rhs.m[1][1] + lhs.m[1][2]*rhs.m[2][1] + lhs.m[1][3]*rhs.m[3][1];
214  result.m[1][2] = lhs.m[1][0]*rhs.m[0][2] + lhs.m[1][1]*rhs.m[1][2] + lhs.m[1][2]*rhs.m[2][2] + lhs.m[1][3]*rhs.m[3][2];
215  result.m[1][3] = lhs.m[1][0]*rhs.m[0][3] + lhs.m[1][1]*rhs.m[1][3] + lhs.m[1][2]*rhs.m[2][3] + lhs.m[1][3]*rhs.m[3][3];
216 
217  result.m[2][0] = lhs.m[2][0]*rhs.m[0][0] + lhs.m[2][1]*rhs.m[1][0] + lhs.m[2][2]*rhs.m[2][0] + lhs.m[2][3]*rhs.m[3][0];
218  result.m[2][1] = lhs.m[2][0]*rhs.m[0][1] + lhs.m[2][1]*rhs.m[1][1] + lhs.m[2][2]*rhs.m[2][1] + lhs.m[2][3]*rhs.m[3][1];
219  result.m[2][2] = lhs.m[2][0]*rhs.m[0][2] + lhs.m[2][1]*rhs.m[1][2] + lhs.m[2][2]*rhs.m[2][2] + lhs.m[2][3]*rhs.m[3][2];
220  result.m[2][3] = lhs.m[2][0]*rhs.m[0][3] + lhs.m[2][1]*rhs.m[1][3] + lhs.m[2][2]*rhs.m[2][3] + lhs.m[2][3]*rhs.m[3][3];
221 
222  result.m[3][0] = lhs.m[3][0]*rhs.m[0][0] + lhs.m[3][1]*rhs.m[1][0] + lhs.m[3][2]*rhs.m[2][0] + lhs.m[3][3]*rhs.m[3][0];
223  result.m[3][1] = lhs.m[3][0]*rhs.m[0][1] + lhs.m[3][1]*rhs.m[1][1] + lhs.m[3][2]*rhs.m[2][1] + lhs.m[3][3]*rhs.m[3][1];
224  result.m[3][2] = lhs.m[3][0]*rhs.m[0][2] + lhs.m[3][1]*rhs.m[1][2] + lhs.m[3][2]*rhs.m[2][2] + lhs.m[3][3]*rhs.m[3][2];
225  result.m[3][3] = lhs.m[3][0]*rhs.m[0][3] + lhs.m[3][1]*rhs.m[1][3] + lhs.m[3][2]*rhs.m[2][3] + lhs.m[3][3]*rhs.m[3][3];
226 
227  return result;
228  }
229 
230 
231  template<class T>
233  {
234  /*
235  | lhs.00, lhs.01, lhs.02, lhs.03 | | rhs.0 |
236  | lhs.10, lhs.11, lhs.12, lhs.13 | | rhs.1 |
237  | lhs.20, lhs.21, lhs.22, lhs.23 | | rhs.2 |
238  | lhs.30, lhs.31, lhs.32, lhs.33 | | rhs.3 |
239  */
240  DtVector4<T> vResult;
241 
242  const DtMatrix4& lhs = *this;
243 
244  vResult.x = lhs.m[0][0]*rhs.x + lhs.m[0][1]*rhs.y + lhs.m[0][2]*rhs.z + lhs.m[0][3]*rhs.w;
245  vResult.y = lhs.m[1][0]*rhs.x + lhs.m[1][1]*rhs.y + lhs.m[1][2]*rhs.z + lhs.m[1][3]*rhs.w;
246  vResult.z = lhs.m[2][0]*rhs.x + lhs.m[2][1]*rhs.y + lhs.m[2][2]*rhs.z + lhs.m[2][3]*rhs.w;
247  vResult.w = lhs.m[3][0]*rhs.x + lhs.m[3][1]*rhs.y + lhs.m[3][2]*rhs.z + lhs.m[3][3]*rhs.w;
248 
249  return vResult;
250  }
251 
252  template<class T>
254  {
255  DtVector4<T> vResult;
256 
257  const DtMatrix4& lhs = *this;
258 
259  vResult.x = lhs.m[0][0] * rhs.x + lhs.m[1][0] * rhs.y + lhs.m[2][0] * rhs.z + lhs.m[3][0] * rhs.w;
260  vResult.y = lhs.m[0][1] * rhs.x + lhs.m[1][1] * rhs.y + lhs.m[2][1] * rhs.z + lhs.m[3][1] * rhs.w;
261  vResult.z = lhs.m[0][2] * rhs.x + lhs.m[1][2] * rhs.y + lhs.m[2][2] * rhs.z + lhs.m[3][2] * rhs.w;
262  vResult.w = lhs.m[0][3] * rhs.x + lhs.m[1][3] * rhs.y + lhs.m[2][3] * rhs.z + lhs.m[3][3] * rhs.w;
263 
264  return vResult;
265  }
266 
267  template<class T>
269  {
270  memset(_m, 0, 16*sizeof(T));
271  }
272 
273  template<class T>
275  {
277  m[0][0] = m[1][1] = m[2][2] = m[3][3] = 1;
278  }
279 
280  template<class T>
282  {
283  return DtMatrix4<T>(
284  m[0][0], m[1][0], m[2][0], m[3][0]
285  , m[0][1], m[1][1], m[2][1], m[3][1]
286  , m[0][2], m[1][2], m[2][2], m[3][2]
287  , m[0][3], m[1][3], m[2][3], m[3][3]
288  );
289  }
290 
291  template<class T>
293  {
294  DtMatrix4<T> result = *this;
295  result[2][0] = (result[2][0] + result[3][0])*0.5f;
296  result[2][1] = (result[2][1] + result[3][1])*0.5f;
297  result[2][2] = (result[2][2] + result[3][2])*0.5f;
298  result[2][3] = (result[2][3] + result[3][3])*0.5f;
299  return result;
300  }
301 
302  template<class T>
303  bool DtMatrix4<T>::isEqual(const DtMatrix4<T>& rhs, T tolerance) const
304  {
305  const DtMatrix4& lhs = *this;
306  for(size_t i = 0; i < 4; ++i)
307  {
308  for(size_t j = 0; j < 4; ++j)
309  {
310  if (!DtMath::isEqual(lhs[i][j], rhs[i][j], tolerance))
311  return false;
312  }
313  }
314  return true;
315  }
316 
317  template<class T>
318  bool DtMatrix4<T>::isIdentity(T tolerance) const
319  {
320  DtMatrix4 rhs; rhs.setIdentity();
321  return isEqual(rhs, tolerance);
322  }
323 
324  template<class T>
326  {
327  operator=(rhs);
328  }
329  template<class T>
331  {
332  setIdentity();
333 
334  m[0][0] = rhs[0][0]; m[0][1] = rhs[0][1]; m[0][2] = rhs[0][2];
335  m[1][0] = rhs[1][0]; m[1][1] = rhs[1][1]; m[1][2] = rhs[1][2];
336  m[2][0] = rhs[2][0]; m[2][1] = rhs[2][1]; m[2][2] = rhs[2][2];
337  }
338 
339  template<class T>
340  bool DtMatrix4<T>::isAffine(void) const
341  {
342  return m[3][0] == 0 && m[3][1] == 0 && m[3][2] == 0 && m[3][3] == 1;
343  }
344 
345  template<class T>
347  {
348  ASSERT_PREDICATE(isAffine());
349  if (DtMatrix4<T>::isAffine()==false)
351 
352  return DtVector3<T>(
353  m[0][0]*v.x + m[0][1]*v.y + m[0][2]*v.z + + m[0][3]
354  , m[1][0]*v.x + m[1][1]*v.y + m[1][2]*v.z + + m[1][3]
355  , m[2][0]*v.x + m[2][1]*v.y + m[2][2]*v.z + + m[2][3]
356  );
357  }
358 
359  template<class T>
361  {
362  ASSERT_PREDICATE(isAffine());
363  if (DtMatrix4<T>::isAffine()==false)
364  return DtVector4<T>::ZERO;
365 
366  return DtVector4<T>(
367  m[0][0]*v.x + m[0][1]*v.y + m[0][2]*v.z + + m[0][3]
368  , m[1][0]*v.x + m[1][1]*v.y + m[1][2]*v.z + + m[1][3]
369  , m[2][0]*v.x + m[2][1]*v.y + m[2][2]*v.z + + m[2][3]
370  , v.w
371  );
372  }
373 
374  template<class T>
376  {
377  T m00 = m[0][0], m01 = m[0][1], m02 = m[0][2], m03 = m[0][3];
378  T m10 = m[1][0], m11 = m[1][1], m12 = m[1][2], m13 = m[1][3];
379  T m20 = m[2][0], m21 = m[2][1], m22 = m[2][2], m23 = m[2][3];
380  T m30 = m[3][0], m31 = m[3][1], m32 = m[3][2], m33 = m[3][3];
381 
382  T v0 = m20 * m31 - m21 * m30;
383  T v1 = m20 * m32 - m22 * m30;
384  T v2 = m20 * m33 - m23 * m30;
385  T v3 = m21 * m32 - m22 * m31;
386  T v4 = m21 * m33 - m23 * m31;
387  T v5 = m22 * m33 - m23 * m32;
388 
389  T t00 = + (v5 * m11 - v4 * m12 + v3 * m13);
390  T t10 = - (v5 * m10 - v2 * m12 + v1 * m13);
391  T t20 = + (v4 * m10 - v2 * m11 + v0 * m13);
392  T t30 = - (v3 * m10 - v1 * m11 + v0 * m12);
393 
394  T invDet = 1 / (t00 * m00 + t10 * m01 + t20 * m02 + t30 * m03);
395 
396  T d00 = t00 * invDet;
397  T d10 = t10 * invDet;
398  T d20 = t20 * invDet;
399  T d30 = t30 * invDet;
400 
401  T d01 = - (v5 * m01 - v4 * m02 + v3 * m03) * invDet;
402  T d11 = + (v5 * m00 - v2 * m02 + v1 * m03) * invDet;
403  T d21 = - (v4 * m00 - v2 * m01 + v0 * m03) * invDet;
404  T d31 = + (v3 * m00 - v1 * m01 + v0 * m02) * invDet;
405 
406  v0 = m10 * m31 - m11 * m30;
407  v1 = m10 * m32 - m12 * m30;
408  v2 = m10 * m33 - m13 * m30;
409  v3 = m11 * m32 - m12 * m31;
410  v4 = m11 * m33 - m13 * m31;
411  v5 = m12 * m33 - m13 * m32;
412 
413  T d02 = + (v5 * m01 - v4 * m02 + v3 * m03) * invDet;
414  T d12 = - (v5 * m00 - v2 * m02 + v1 * m03) * invDet;
415  T d22 = + (v4 * m00 - v2 * m01 + v0 * m03) * invDet;
416  T d32 = - (v3 * m00 - v1 * m01 + v0 * m02) * invDet;
417 
418  v0 = m21 * m10 - m20 * m11;
419  v1 = m22 * m10 - m20 * m12;
420  v2 = m23 * m10 - m20 * m13;
421  v3 = m22 * m11 - m21 * m12;
422  v4 = m23 * m11 - m21 * m13;
423  v5 = m23 * m12 - m22 * m13;
424 
425  T d03 = - (v5 * m01 - v4 * m02 + v3 * m03) * invDet;
426  T d13 = + (v5 * m00 - v2 * m02 + v1 * m03) * invDet;
427  T d23 = - (v4 * m00 - v2 * m01 + v0 * m03) * invDet;
428  T d33 = + (v3 * m00 - v1 * m01 + v0 * m02) * invDet;
429 
430  return DtMatrix4(
431  d00, d01, d02, d03,
432  d10, d11, d12, d13,
433  d20, d21, d22, d23,
434  d30, d31, d32, d33);
435  }
436 
437  template<class T>
439  {
440  ASSERT_PREDICATE(isAffine());
441 
442  T m10 = m[1][0], m11 = m[1][1], m12 = m[1][2];
443  T m20 = m[2][0], m21 = m[2][1], m22 = m[2][2];
444 
445  T t00 = m22 * m11 - m21 * m12;
446  T t10 = m20 * m12 - m22 * m10;
447  T t20 = m21 * m10 - m20 * m11;
448 
449  T m00 = m[0][0], m01 = m[0][1], m02 = m[0][2];
450 
451  T invDet = 1 / (m00 * t00 + m01 * t10 + m02 * t20);
452 
453  t00 *= invDet; t10 *= invDet; t20 *= invDet;
454 
455  m00 *= invDet; m01 *= invDet; m02 *= invDet;
456 
457  T r00 = t00;
458  T r01 = m02 * m21 - m01 * m22;
459  T r02 = m01 * m12 - m02 * m11;
460 
461  T r10 = t10;
462  T r11 = m00 * m22 - m02 * m20;
463  T r12 = m02 * m10 - m00 * m12;
464 
465  T r20 = t20;
466  T r21 = m01 * m20 - m00 * m21;
467  T r22 = m00 * m11 - m01 * m10;
468 
469  T m03 = m[0][3], m13 = m[1][3], m23 = m[2][3];
470 
471  T r03 = - (r00 * m03 + r01 * m13 + r02 * m23);
472  T r13 = - (r10 * m03 + r11 * m13 + r12 * m23);
473  T r23 = - (r20 * m03 + r21 * m13 + r22 * m23);
474 
475  return DtMatrix4<T>(
476  r00, r01, r02, r03,
477  r10, r11, r12, r13,
478  r20, r21, r22, r23,
479  0, 0, 0, 1);
480  }
481 
482  template<class T>
484  {
485  m[0][3] = 0;
486  m[1][3] = 0;
487  m[2][3] = 0;
488  }
489 
490  template<class T>
492  {
493  m[0][3] = m[0][3] - v.x;
494  m[1][3] = m[1][3] - v.y;
495  m[2][3] = m[2][3] - v.z;
496  }
497 
498  template<class T>
499  bool DtMatrix4<T>::operator==(const DtMatrix4<T>& rhs) const
500  {
501  return (memcmp(ptr(), rhs.ptr(), sizeof(T) * 16) == 0);
502  }
503 
504  template<class T>
505  bool DtMatrix4<T>::operator!=(const DtMatrix4<T>& rhs) const
506  {
507  return (memcmp(ptr(), rhs.ptr(), sizeof(T) * 16) != 0);
508  }
509 
510  template<class T>
511  void DtMatrix4<T>::setRow(int row, const DtVector4<T>& vec)
512  {
513  for (int i = 0; i < 4; ++i)
514  {
515  m[row][i] = vec[i];
516  }
517  }
518 
519  template<class T>
520  void DtMatrix4<T>::setColumn(int col, const DtVector4<T>& vec)
521  {
522  for (int i = 0; i < 4; ++i)
523  {
524  m[i][col] = vec[i];
525  }
526  }
527 
528  template<class T>
530  {
531  return { m[row][0], m[row][1], m[row][2], m[row][3] };
532  }
533 
534  template<class T>
536  {
537  return { m[0][col], m[1][col], m[2][col], m[3][col] };
538  }
539 
540  template<class T>
542  {
543  DtMatrix4<T> transpose = getTranspose();
544  *this = transpose;
545  }
546 
547  template<class T>
548  void DtMatrix4<T>::multiply(const DtMatrix4<T>& lhs, const DtMatrix4<T>& rhs)
549  {
550  *this = lhs * rhs;
551  }
552 
553  template<class T>
554  inline std::ostream& operator <<
555  ( std::ostream& o, const DtMatrix4<T>& mat )
556  {
557  for(size_t i = 0; i < 4; ++i)
558  {
559  o<<mat[i][0]<<" "<<mat[i][1]<<" "<<mat[i][2]<<" "<<mat[i][3]<<std::endl;
560  }
561  return o;
562  }
563 
564 } //namespace makVrv
DtMatrix4< T > getInverseAffine(void) const
Get the inverse of this matrix. This matrix must be affine to.
Definition: DtMatrix4.h:438
3 dimensional matrix
DtVector4< T > getColumn(int col) const
get the column 4d vector
Definition: DtMatrix4.h:535
T x
Definition: DtVector4.h:118
static DtMatrix4 theIdentityMatrix
Definition: DtMatrix4.h:75
void setRow(int row, const DtVector4< T > &vec)
set the row with the given 4d vector
Definition: DtMatrix4.h:511
DtMatrix4< float > Matrix4_32
Definition: DtMatrix4.h:136
DtMatrix4()
CTOR.
Definition: DtMatrix4.h:140
~DtMatrix4()
DTOR.
Definition: DtMatrix4.h:170
void setColumn(int col, const DtVector4< T > &vec)
set the column with the given 4d vector
Definition: DtMatrix4.h:520
void translateBack(const DtVector3< T > &v)
subtract the vector from the translation column
Definition: DtMatrix4.h:491
DtMatrix4 operator*(const DtMatrix4 &rhs) const
Multiply 2 matrices. Returns this*rhs.
#define ASSERT_PREDICATE_RETURN_ZERO(p)
Definition: DtAssert.h:41
T m[4][4]
Definition: DtMatrix4.h:126
T z
Definition: DtVector3.h:135
DtMatrix4 convert_depth_gl_to_dx() const
Definition: DtMatrix4.h:292
const T * operator[](size_t iRow) const
Definition: DtMatrix4.h:182
bool isEqual(const DtMatrix4 &rhs, T tolerance) const
Check whether this matrix is equivalent to rhs within tolerance.
Definition: DtMatrix4.h:303
void zeroOutTranslation(void)
Zero out the translation column.
Definition: DtMatrix4.h:483
T x
Definition: DtVector3.h:135
4 dimensional vector
Definition: DtMath.h:22
const DtVector4< T > transposeMultiply(const DtVector4< T > &rhs) const
This is equal to: this-&gt;GetTranspose() * rhs (but potentialy faster)
Definition: DtMatrix4.h:253
bool operator==(const DtMatrix4< T > &rhs) const
equality
Definition: DtMatrix4.h:499
const void * ptr(void) const
Definition: DtMatrix4.h:176
DtMatrix4< double > Matrix4_64
Definition: DtMatrix4.h:137
T z
Definition: DtVector4.h:118
void operator=(const DtMatrix3< T > &rhs)
Assignment operator.
Definition: DtMatrix4.h:330
void multiply(const DtMatrix4< T > &lhs, const DtMatrix4< T > &rhs)
this = lhs*rhs
Definition: DtMatrix4.h:548
T _m[16]
Definition: DtMatrix4.h:125
bool isAffine(void) const
Return whether the last row is (0,0,0,1);.
Definition: DtMatrix4.h:340
T w
Definition: DtVector4.h:118
T y
Definition: DtVector3.h:135
static bool isEqual(int32 lhs, int32 rhs, int32 tolerance=std::numeric_limits< int32 >::epsilon())
Test equality with tolerance.
DtMatrix4< T > getInverse(void) const
Get the inverse of this matrix.
Definition: DtMatrix4.h:375
void setZero(void)
Set all values to zero.
Definition: DtMatrix4.h:268
3 dimensional matrix
Definition: DtMatrix3.h:20
bool operator!=(const DtMatrix4< T > &rhs) const
inequality
Definition: DtMatrix4.h:505
bool isIdentity(T tolerance=std::numeric_limits< T >::epsilon()) const
Definition: DtMatrix4.h:318
2 dimensional vector
Definition: DtMath.h:21
void transpose()
transpose in place, instead of returning a new transpose matrix
Definition: DtMatrix4.h:541
void setIdentity(void)
Set matrix to identity matrix.
Definition: DtMatrix4.h:274
DtMatrix4 getTranspose(void) const
Get the transpose of this matrix.
Definition: DtMatrix4.h:281
#define ASSERT_PREDICATE(p)
Definition: DtAssert.h:28
assert macros
DtVector3< T > transformAffine(const DtVector3< T > &v) const
Definition: DtMatrix4.h:346
T y
Definition: DtVector4.h:118
4 dimensional matrix
Definition: DtMatrix4.h:22
DtVector4< T > getRow(int row) const
get the row 4d vector
Definition: DtMatrix4.h:529

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)