MeVisLab Toolbox Reference
mlMatrix3.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef ML_MATRIX3_H
14#define ML_MATRIX3_H
15
17
18// Include system independent file and project settings.
20#include "mlLinearAlgebraDefs.h"
22
24
25#include "mlMatrix2.h"
26#include "mlVector3.h"
27
28#include <cstdlib>
29// All declarations of this header will be in the ML_LA_NAMESPACE namespace.
30ML_LA_START_NAMESPACE
31
32//--------------------------------------------------------------------
34//--------------------------------------------------------------------
35template <class DT>
36class Tmat3 : public FloatingPointMatrix<Tvec3<DT>, 3>
37{
38
39public:
40
42 typedef DT ComponentType;
43
46
48 Tmat3(const DT diagValue);
49
51 Tmat3(const Tvec3<DT> &row0, const Tvec3<DT> &row1, const Tvec3<DT> &row2);
52
54 Tmat3(const Tmat3<DT> &mat);
55
57 Tmat3(const float mat[9]);
58
60 Tmat3(const double mat[9]);
61
64 Tmat3(const double in00, const double in01, const double in02,
65 const double in10, const double in11, const double in12,
66 const double in20, const double in21, const double in22);
67
69 void setValues(const float mat[9]);
70
74 void getValues(float mat[9]) const;
75
77 void setValues(const double mat[9]);
78
80 void getValues(double mat[9]) const;
81
83 void setScaleMatrix(const DT scale);
84
86 static Tmat3<DT> getMat(const double val);
87
89 void set(DT val);
90
93 bool operator<(const Tmat3<DT> &) const { return false; }
94
96 const Tmat3<DT> &operator=(const Tmat3<DT> &m);
97
99 const Tmat3<DT> &operator+=(const Tmat3<DT> &m);
100
103
105 const Tmat3<DT> &operator*=(const DT d);
106
109 const Tmat3<DT> &operator/=(const DT d);
110
111 //-------------------------------------------------
112 // Special functions
113 //-------------------------------------------------
115 DT det() const;
116
119
122
130 Tmat3 inverse(bool* isInvertible=nullptr) const;
131
134
136 Tmat3 jacobi(Tvec3<DT> &eVal, int &rots) const;
137
138}; // end of class *Tmat3*
139
140
141
142//---------------------------------------------------------------------
145//---------------------------------------------------------------------
147template <class DT>
149{
150 this->v[0] = this->v[1] = this->v[2] = Tvec3<DT>(0);
151}
152
154template <class DT>
155inline Tmat3<DT>::Tmat3(const DT diagValue)
156{
157 this->v[0][0] = this->v[1][1] = this->v[2][2] = diagValue;
158 this->v[1][0] = this->v[2][0] = this->v[2][1] = 0;
159 this->v[0][1] = this->v[0][2] = this->v[1][2] = 0;
160}
161
163template <class DT>
164inline Tmat3<DT>::Tmat3(const Tvec3<DT> &row0, const Tvec3<DT> &row1, const Tvec3<DT> &row2)
165{
166 this->v[0] = row0;
167 this->v[1] = row1;
168 this->v[2] = row2;
169}
170
172template <class DT>
173inline Tmat3<DT>::Tmat3(const Tmat3<DT> &mat)
174{
175 this->v[0] = mat.v[0];
176 this->v[1] = mat.v[1];
177 this->v[2] = mat.v[2];
178}
179
181template <class DT>
182inline Tmat3<DT>::Tmat3(const float mat[9])
183{
184 setValues(mat);
185}
186
188template <class DT>
189inline Tmat3<DT>::Tmat3(const double mat[9])
190{
191 setValues(mat);
192}
193
195template <class DT>
196inline Tmat3<DT> Tmat3<DT>::getMat(const double val)
197{
198 return Tmat3<DT>(val, val, val,
199 val, val, val,
200 val, val, val);
201}
202
204template <class DT>
205inline void Tmat3<DT>::set(DT val)
206{
207 this->v[0] = this->v[1] = this->v[2] = Tvec3<DT>(val);
208}
209
211template <class DT>
213{
214 if (&m != this){
215 this->v[0] = m.v[0];
216 this->v[1] = m.v[1];
217 this->v[2] = m.v[2];
218 }
219
220 return *this;
221}
222
224template <class DT>
226{
227 this->v[0] += m.v[0];
228 this->v[1] += m.v[1];
229 this->v[2] += m.v[2];
230
231 return *this;
232}
233
235template <class DT>
237{
238 this->v[0] -= m.v[0];
239 this->v[1] -= m.v[1];
240 this->v[2] -= m.v[2];
241
242 return *this;
243}
244
246template <class DT>
247inline const Tmat3<DT> &Tmat3<DT>::operator*=(const DT d)
248{
249 this->v[0] *= d;
250 this->v[1] *= d;
251 this->v[2] *= d;
252
253 return *this;
254}
255
257template <class DT>
258inline const Tmat3<DT> &Tmat3<DT>::operator/=(const DT d)
259{
260 this->v[0] /= d;
261 this->v[1] /= d;
262 this->v[2] /= d;
263 return *this;
264}
265
266
267
268//====================================================================
271//====================================================================
273template <class DT>
275{
276 return Tmat3<DT>(a) *= static_cast<DT>(-1.0);
277}
278
280template <class DT>
281inline Tmat3<DT> operator+(const Tmat3<DT> &a, const Tmat3<DT> &b)
282{
283 return Tmat3<DT>(a) += b;
284}
285
287template <class DT>
288inline Tmat3<DT> operator-(const Tmat3<DT> &a, const Tmat3<DT> &b)
289{
290 return Tmat3<DT>(a) -= b;
291}
292
294template <class DT>
295inline Tmat3<DT> operator*(const Tmat3<DT> &a, const DT d)
296{
297 return Tmat3<DT>(a) *= d;
298}
299
301template <class DT>
302inline Tmat3<DT> operator*(const DT d, const Tmat3<DT> &a)
303{
304 return Tmat3<DT>(a) *= d;
305}
306
309template <class DT>
310inline Tmat3<DT> operator/(const Tmat3<DT> &a, const DT d)
311{
312 Tmat3<DT> retVal(a);
313 retVal /= d;
314 return retVal;
315}
316
317
318
319//-------------------------------------------------------------------
320//
323//
324//-------------------------------------------------------------------
325
326//-------------------------------------------------------------------
329//-------------------------------------------------------------------
330template <class DT>
331inline Tmat3<DT>::Tmat3(const double in00, const double in01, const double in02,
332 const double in10, const double in11, const double in12,
333 const double in20, const double in21, const double in22)
334{
335 this->v[0][0]=static_cast<DT>(in00); this->v[0][1]=static_cast<DT>(in01); this->v[0][2]=static_cast<DT>(in02);
336 this->v[1][0]=static_cast<DT>(in10); this->v[1][1]=static_cast<DT>(in11); this->v[1][2]=static_cast<DT>(in12);
337 this->v[2][0]=static_cast<DT>(in20); this->v[2][1]=static_cast<DT>(in21); this->v[2][2]=static_cast<DT>(in22);
338}
339
340
341//--------------------------------------------------------------------
343//--------------------------------------------------------------------
344template <class DT>
345inline void Tmat3<DT>::setValues(const float mat[9])
346{
347 this->v[0][0] = static_cast<DT>(mat[0]); this->v[0][1] = static_cast<DT>(mat[1]); this->v[0][2] = static_cast<DT>(mat[2]);
348 this->v[1][0] = static_cast<DT>(mat[3]); this->v[1][1] = static_cast<DT>(mat[4]); this->v[1][2] = static_cast<DT>(mat[5]);
349 this->v[2][0] = static_cast<DT>(mat[6]); this->v[2][1] = static_cast<DT>(mat[7]); this->v[2][2] = static_cast<DT>(mat[8]);
350}
351
352//--------------------------------------------------------------------
356//--------------------------------------------------------------------
357template <class DT>
358inline void Tmat3<DT>::getValues(float mat[9]) const
359{
360 mat[0] = static_cast<float>(this->v[0][0]); mat[1] = static_cast<float>(this->v[0][1]); mat[2] = static_cast<float>(this->v[0][2]);
361 mat[3] = static_cast<float>(this->v[1][0]); mat[4] = static_cast<float>(this->v[1][1]); mat[5] = static_cast<float>(this->v[1][2]);
362 mat[6] = static_cast<float>(this->v[2][0]); mat[7] = static_cast<float>(this->v[2][1]); mat[8] = static_cast<float>(this->v[2][2]);
363}
364
365//--------------------------------------------------------------------
367//--------------------------------------------------------------------
368template <class DT>
369inline void Tmat3<DT>::setValues(const double mat[9])
370{
371 this->v[0][0] = static_cast<DT>(mat[0]); this->v[0][1] = static_cast<DT>(mat[1]); this->v[0][2] = static_cast<DT>(mat[2]);
372 this->v[1][0] = static_cast<DT>(mat[3]); this->v[1][1] = static_cast<DT>(mat[4]); this->v[1][2] = static_cast<DT>(mat[5]);
373 this->v[2][0] = static_cast<DT>(mat[6]); this->v[2][1] = static_cast<DT>(mat[7]); this->v[2][2] = static_cast<DT>(mat[8]);
374}
375
376//--------------------------------------------------------------------
380//--------------------------------------------------------------------
381template <class DT>
382inline void Tmat3<DT>::getValues(double mat[9]) const
383{
384 mat[0] = static_cast<double>(this->v[0][0]); mat[1] = static_cast<double>(this->v[0][1]); mat[2] = static_cast<double>(this->v[0][2]);
385 mat[3] = static_cast<double>(this->v[1][0]); mat[4] = static_cast<double>(this->v[1][1]); mat[5] = static_cast<double>(this->v[1][2]);
386 mat[6] = static_cast<double>(this->v[2][0]); mat[7] = static_cast<double>(this->v[2][1]); mat[8] = static_cast<double>(this->v[2][2]);
387}
388
389
390//-------------------------------------------------------------------
392//-------------------------------------------------------------------
393template <class DT>
394inline void Tmat3<DT>::setScaleMatrix(const DT scale)
395{
396 this->v[0][0]=scale; this->v[0][1]=0; this->v[0][2]=0;
397 this->v[1][0]=0; this->v[1][1]=scale; this->v[1][2]=0;
398 this->v[2][0]=0; this->v[2][1]=0; this->v[2][2]=scale;
399}
400
401
402
403//-------------------------------------------------------------------
406//-------------------------------------------------------------------
407
409#define DET3(A,B,C,D,E,F,G,H,I) ((A*E*I + B*F*G + C*D*H) - (A*F*H + B*D*I + C*E*G))
410//-------------------------------------------------------------------
412//-------------------------------------------------------------------
413template <class DT>
415{
416 return DET3(this->v[0][0], this->v[0][1], this->v[0][2],
417 this->v[1][0], this->v[1][1], this->v[1][2],
418 this->v[2][0], this->v[2][1], this->v[2][2]);
419}
420#undef DET3
421
422//-------------------------------------------------------------------
424//-------------------------------------------------------------------
425template <class DT>
427{
428 return Tmat3<DT>(Tvec3<DT>(this->v[0][0], this->v[1][0], this->v[2][0]),
429 Tvec3<DT>(this->v[0][1], this->v[1][1], this->v[2][1]),
430 Tvec3<DT>(this->v[0][2], this->v[1][2], this->v[2][2]));
431}
432
433//-------------------------------------------------------------------
435//-------------------------------------------------------------------
436template <class DT>
438{
439 return Tmat3<DT>(Tvec3<DT>(1,0,0),
440 Tvec3<DT>(0,1,0),
441 Tvec3<DT>(0,0,1));
442}
443
444//-------------------------------------------------------------------
446//-------------------------------------------------------------------
447template <class DT>
449{
450 this->v[0].apply(fct);
451 this->v[1].apply(fct);
452 this->v[2].apply(fct);
453 return *this;
454}
455
457#define _ML_MAT3_RC(i, j) a[i][0]*b[0][j] + a[i][1]*b[1][j] + a[i][2]*b[2][j]
458//-------------------------------------------------------------------
460//-------------------------------------------------------------------
461template <class DT>
462inline Tmat3<DT> operator*(const Tmat3<DT> &a, const Tmat3<DT> &b)
463{
464 return Tmat3<DT>(Tvec3<DT>(_ML_MAT3_RC(0,0), _ML_MAT3_RC(0,1), _ML_MAT3_RC(0,2)),
466 Tvec3<DT>(_ML_MAT3_RC(2,0), _ML_MAT3_RC(2,1), _ML_MAT3_RC(2,2)));
467
468}
469#undef _ML_MAT3_RC
470
471//-------------------------------------------------------------------
473//-------------------------------------------------------------------
474template <class DT>
475inline bool operator==(const Tmat3<DT> &a, const Tmat3<DT> &b)
476{
477 return (a[0] == b[0]) &&
478 (a[1] == b[1]) &&
479 (a[2] == b[2]);
480}
481
482//-------------------------------------------------------------------
484//-------------------------------------------------------------------
485template <class DT>
486inline bool operator!=(const Tmat3<DT> &a, const Tmat3<DT> &b)
487{
488 return !(a == b);
489}
490
491//-------------------------------------------------------------------
492//
493// Special global 2D functions and 3D functions
494//
495//-------------------------------------------------------------------
496
497//--------------------------------------------------------------------
500//--------------------------------------------------------------------
501template <class DT>
506
507//-------------------------------------------------------------------
510//-------------------------------------------------------------------
511template <class DT>
513{
514 return Tmat3<DT>(Tvec3<DT>(1.0, 0.0, v[0]),
515 Tvec3<DT>(0.0, 1.0, v[1]),
516 Tvec3<DT>(0.0, 0.0, 1.0));
517}
518
519//-------------------------------------------------------------------
522//-------------------------------------------------------------------
523template <class DT>
524Tmat3<DT> rotation2D(const Tvec2<DT> &Center, const DT angleDeg)
525{
526 DT angleRad = angleDeg * M_PI / 180.0;
527 DT c = cos(angleRad);
528 DT s = sin(angleRad);
529
530 return Tmat3<DT>(Tvec3<DT>(c, -s, Center[0] * (1.0-c) + Center[1] * s),
531 Tvec3<DT>(s, c, Center[1] * (1.0-c) - Center[0] * s),
532 Tvec3<DT>(0.0, 0.0, 1.0));
533}
534
535//-------------------------------------------------------------------
537//-------------------------------------------------------------------
538template <class DT>
539inline Tmat3<DT> scaling2D(const Tvec2<DT> &scaleVector)
540{
541 return Tmat3<DT>(Tvec3<DT>(scaleVector[0], 0.0, 0.0),
542 Tvec3<DT>(0.0, scaleVector[1], 0.0),
543 Tvec3<DT>(0.0, 0.0, 1.0));
544}
545
546
547
548//-------------------------------------------------------------------
560//-------------------------------------------------------------------
561template <class DT>
562Tmat3<DT> Tmat3<DT>::jacobi(Tvec3<DT> &evalues, int &rots) const
563{
564 Tmat3<DT> evectors (getIdentity());
565
566 // TODO: Further documentation of the algorithm required!
567
568 DT sm = 0; // smallest entry
569 DT theta = 0; // angle for Jacobi rotation
570 DT c = 0, s = 0, t = 0; // cosine, sine, tangent of theta
571 DT tau = 0; // sine / (1 + cos)
572 DT h = 0, g = 0; // two scrap values
573 DT thresh = 0; // threshold below which no rotation done
574
575 int p = 0, q = 0, i = 0, j = 0;
576
577 // Initialization
578 Tvec3<DT> b (this->v[0][0], this->v[1][1], this->v[2][2]); // diagonal elements
579 Tvec3<DT> z (0, 0, 0);
580 evalues = b;
581
582 Tmat3<DT> a (*this);
583
584 rots = 0;
585 for (i = 0; i < 50; i++){ // typical matrices require 6 to 10 sweeps to achieve convergence - hence 50 gives some safety margin
586 sm = 0.0;
587 for (p = 0; p < 2; p++){
588 for (q = p+1; q < 3; q++){
589 sm += std::abs(a.v[p][q]); // sum off-diagonal elements
590 }
591 }
592
593 if (sm == 0.0){
594 return *(&evectors); // circumvent a code generation bug in Visual Studio 2019 (version 16.5.4)
595 }
596
597 thresh = (i < 3 ? (.2 * sm / 9) : 0.0);
598
599 for (p = 0; p < 2; p++) {
600 for (q = p+1; q < 3; q++) { // compute on sweep, i.e. one rotation for each of-diagonal element of the matrix
601
602 g = 100.0 * std::abs(a.v[p][q]);
603
604 if ((i > 3) &&
605 (std::abs(evalues[p]) + g == std::abs(evalues[p])) &&
606 (std::abs(evalues[q]) + g == std::abs(evalues[q]))){
607 a.v[p][q] = 0.0; // after three sweeps, skip rotation of small off diagonal elements
608 }
609 else if (std::abs(a.v[p][q]) > thresh) {
610 h = evalues[q] - evalues[p];
611 if (std::abs(h) + g == std::abs(h)){
612 t = a.v[p][q] / h;
613 }
614 else {
615 theta = .5 * h / a.v[p][q];
616 t = 1.0 / (std::abs(theta) + sqrt(1 + theta * theta));
617 if (theta < 0.0){
618 t = -t;
619 }
620 }
621 // End of computing tangent of rotation angle
622
623 c = 1.0 / sqrt(1.0 + t*t);
624 s = t * c;
625 tau = s / (1.0 + c);
626 h = t * a.v[p][q];
627 z[p] -= h;
628 z[q] += h;
629 evalues[p] -= h;
630 evalues[q] += h;
631 a.v[p][q] = 0.0;
632
633 for (j = 0; j < p; j++) {
634 g = a.v[j][p];
635 h = a.v[j][q];
636 a.v[j][p] = g - s * (h + g * tau);
637 a.v[j][q] = h + s * (g - h * tau);
638 }
639
640 for (j = p+1; j < q; j++) {
641 g = a.v[p][j];
642 h = a.v[j][q];
643 a.v[p][j] = g - s * (h + g * tau);
644 a.v[j][q] = h + s * (g - h * tau);
645 }
646
647 for (j = q+1; j < 3; j++) {
648 g = a.v[p][j];
649 h = a.v[q][j];
650 a.v[p][j] = g - s * (h + g * tau);
651 a.v[q][j] = h + s * (g - h * tau);
652 }
653
654 for (j = 0; j < 3; j++) {
655 g = evectors.v[j][p];
656 h = evectors.v[j][q];
657 evectors.v[j][p] = g - s * (h + g * tau);
658 evectors.v[j][q] = h + s * (g - h * tau);
659 }
660 } // else if (std::abs(a.v[p][q]) > thresh)
661
662 rots++;
663
664 } // for (q = p+1; q < 3; q++)
665 } // for (p = 0; p < 2; p++)
666
667 for (p = 0; p < 3; p++) {
668 evalues[p] = b[p] += z[p];
669 z[p] = 0;
670 }
671 } // for (i = 0; i < 50; i++)
672 return evectors;
673}
674
675//-------------------------------------------------------------------
683//-------------------------------------------------------------------
684template <class DT>
685Tmat3<DT> Tmat3<DT>::inverse(bool* isInvertible) const
686{
687 // Epsilon for comparison with 0 in inversion process.
688 static const DT Epsilon = static_cast<DT>(0.);
689
690 // Use helper function from tools to invert the matrix.
691 return MLInverseMatHelper(*this,
692 isInvertible,
693 Epsilon,
694 "Tmat3<DT> Tmat3<DT>::inverse(bool* isInvertible) const, matrix not invertable",
695 getIdentity(),
696 3);
697}
698
699//-----------------------------------------------------------------------------------
702//-----------------------------------------------------------------------------------
703
713
714ML_LA_END_NAMESPACE
715
716namespace std
717{
718 //-------------------------------------------------------------------
720 //-------------------------------------------------------------------
721 template <class DT>
722 inline std::ostream &operator<<(std::ostream &os, const ML_LA_NAMESPACE::Tmat3<DT> &m)
723 {
724 return os << m[0] << '\n' << m[1] << '\n' << m[2];
725 }
726
727 //-------------------------------------------------------------------
729 //-------------------------------------------------------------------
730 template <class DT>
731 inline std::istream &operator>>(std::istream &is, ML_LA_NAMESPACE::Tmat3<DT> &m)
732 {
733 ML_LA_NAMESPACE::Tmat3<DT> m_tmp;
734
735 is >> m_tmp[0] >> m_tmp[1] >> m_tmp[2];
736 if (is){ m = m_tmp; }
737 return is;
738 }
739}
740
741
742#endif // __mlMatrix3_H
743
744
A 3x3 matrix class of three row vectors.
Definition mlMatrix3.h:37
bool operator<(const Tmat3< DT > &) const
Definition mlMatrix3.h:93
void setValues(const float mat[9])
Copies the contents from float array mat into *this, row by row.
Definition mlMatrix3.h:345
static Tmat3 getIdentity()
Returns the identity matrix.
Definition mlMatrix3.h:437
static Tmat3< DT > getMat(const double val)
Returns a matrix filled with values val.
Definition mlMatrix3.h:196
void setScaleMatrix(const DT scale)
Sets the diagonal matrix with scale on the diagonal.
Definition mlMatrix3.h:394
Tmat3(const double in00, const double in01, const double in02, const double in10, const double in11, const double in12, const double in20, const double in21, const double in22)
Definition mlMatrix3.h:331
const Tmat3< DT > & operator+=(const Tmat3< DT > &m)
Increments by a Tmat3.
Definition mlMatrix3.h:225
Tmat3(const double mat[9])
Constructor from nine double values in an array given by mat, row by row.
Definition mlMatrix3.h:189
const Tmat3< DT > & operator-=(const Tmat3< DT > &m)
Decrements by a Tmat3.
Definition mlMatrix3.h:236
void getValues(float mat[9]) const
Definition mlMatrix3.h:358
const Tmat3< DT > & operator*=(const DT d)
Multiplies by a scalar constant d.
Definition mlMatrix3.h:247
void getValues(double mat[9]) const
Copies the contents of *this into double array mat, row by row.
Definition mlMatrix3.h:382
Tmat3 transpose() const
Returns the transpose of this matrix.
Definition mlMatrix3.h:426
Tmat3(const Tmat3< DT > &mat)
Copy constructor from the Tmat3 mat.
Definition mlMatrix3.h:173
Tmat3(const Tvec3< DT > &row0, const Tvec3< DT > &row1, const Tvec3< DT > &row2)
Builds a matrix of the three row vectors row0, row1, row2.
Definition mlMatrix3.h:164
Tmat3(const DT diagValue)
Builds a matrix that has the argument diagValue as the diagonal values, zero otherwise.
Definition mlMatrix3.h:155
DT ComponentType
A typedef to 'export' the type of components.
Definition mlMatrix3.h:42
const Tmat3< DT > & apply(MLDblFuncPtr fct)
Applies the function fct to each component.
Definition mlMatrix3.h:448
Tmat3(const float mat[9])
Constructor from nine floating point values in an array given by mat, row by row.
Definition mlMatrix3.h:182
void setValues(const double mat[9])
Copies the contents from double array mat into *this, row by row.
Definition mlMatrix3.h:369
Tmat3 jacobi(Tvec3< DT > &eVal, int &rots) const
Calculates the Jacobi-decomposition of 3x3 matrix.
Definition mlMatrix3.h:562
Tmat3()
Builds a 3x3 matrix from nine zero elements.
Definition mlMatrix3.h:148
Tmat3 inverse(bool *isInvertible=nullptr) const
Definition mlMatrix3.h:685
const Tmat3< DT > & operator=(const Tmat3< DT > &m)
Assigns from a Tmat3.
Definition mlMatrix3.h:212
const Tmat3< DT > & operator/=(const DT d)
Divides by a constant d. Division by zero is not handled and must be avoided by caller.
Definition mlMatrix3.h:258
void set(DT val)
Sets all values to val.
Definition mlMatrix3.h:205
DT det() const
Returns the determinant of this matrix.
Definition mlMatrix3.h:414
Declaration of float vector type traits.
Definition mlVector2.h:57
Forward declarations to resolve header file dependencies.
Definition mlVector3.h:66
#define DET3(A, B, C, D, E, F, G, H, I)
Internal helper macro to calculate the determinant of 3x3 matrix with given entries,...
Definition mlMatrix3.h:409
#define _ML_MAT3_RC(i, j)
Internal helper macro to multiply two matrices, do not use.
Definition mlMatrix3.h:457
double(* MLDblFuncPtr)(double)
A function pointer type to a function that returns a double and takes a double as argument.
double sqrt(T value)
Tmat3< MLfloat > Matrix3f
A 3x3 matrix of type float.
Definition mlMatrix3.h:705
FloatingPointVector< T, size, DataContainer > operator/(FloatingPointVector< T, size, DataContainer > lhs, MLdouble rhs)
bool operator==(const Tmat2< DT > &a, const Tmat2< DT > &b)
a == b ? Returns true if yes.
Definition mlMatrix2.h:425
Tmat3< DT > translation2D(const Tvec2< DT > &v)
Definition mlMatrix3.h:512
Tmat3< DT > identity2D()
Definition mlMatrix3.h:502
T operator*(const FloatingPointVector< T, size, DataContainer > &a, const FloatingPointVector< T, size, DataContainer > &b)
Tmat3< DT > rotation2D(const Tvec2< DT > &Center, const DT angleDeg)
Definition mlMatrix3.h:524
Tmat3< MLdouble > Matrix3
The standard 3x3 matrix of type double.
Definition mlMatrix3.h:711
bool operator!=(const Tmat2< DT > &a, const Tmat2< DT > &b)
a != b ? Returns true if yes.
Definition mlMatrix2.h:433
FloatingPointVector< T, size, DataContainer > operator+(FloatingPointVector< T, size, DataContainer > lhs, const FloatingPointVector< T, size, DataContainer > &rhs)
Tmat3< MLldouble > Matrix3ld
A 3x3 matrix of type long double.
Definition mlMatrix3.h:709
Tmat3< DT > scaling2D(const Tvec2< DT > &scaleVector)
Returns a 2D scale matrix as 3D homogeneous matrix.
Definition mlMatrix3.h:539
Tmat3< MLdouble > Matrix3d
A 3x3 matrix of type double.
Definition mlMatrix3.h:707
FloatingPointVector< T, size, DataContainer > operator-(FloatingPointVector< T, size, DataContainer > lhs, const FloatingPointVector< T, size, DataContainer > &rhs)
BASE_TYPE MLInverseMatHelper(const BASE_TYPE &origMat, bool *isInvertible, const typename BASE_TYPE::ComponentType, const char *const ZeroDetErrString, const BASE_TYPE &Identity, const size_t Dim)
STL namespace.
MLEXPORT std::ostream & operator<<(std::ostream &s, const ml::Field &v)
Overloads the operator '<<' for stream output of Field objects.
istream & operator>>(istream &is, ml::FloatingPointVector< T, size, DataContainer > &v)
Reads a vector from std::istream.