cctw  0.2.1
cctwmatrix3x3.h
Go to the documentation of this file.
1 #ifndef CCTWMATRIX3X3_H
2 #define CCTWMATRIX3X3_H
3 
4 #include "cctwvector3d.h"
5 #include <stdlib.h>
6 #include <QSettings>
7 #include <QString>
8 
9 template <typename T>
11 {
12 public:
13  CctwMatrix3x3();
15  CctwMatrix3x3(T a11, T a12, T a13, T a21, T a22, T a23, T a31, T a32, T a33);
16 
17 public:
18  T& operator() (int row, int col);
19  const T& operator() (int row, int col) const;
20 
21  CctwMatrix3x3 operator+ (const CctwMatrix3x3& mat) const; // Matrix addition
22  CctwMatrix3x3 operator+= (const CctwMatrix3x3& mat); // Matrix addition
23  CctwMatrix3x3 operator- (const CctwMatrix3x3& mat) const; // Matrix subtraction
24  CctwMatrix3x3 operator-= (const CctwMatrix3x3& mat); // Matrix subtraction
25  CctwMatrix3x3 operator* (const CctwMatrix3x3& mat) const; // Matrix multiplication
26 
27  CctwVector3D<T> operator* (const CctwVector3D<T>& vec) const; // Matrix*Vector multiplication
28 
29  bool operator== (const CctwMatrix3x3& mat) const;
30  bool operator!= (const CctwMatrix3x3& mat) const;
31 
32  double determinant() const;
33  CctwMatrix3x3 inverted(bool *invertible = NULL) const;
34  CctwMatrix3x3 transposed() const;
35 
36  void setToIdentity();
37 
38  template <typename T1>
39  friend class CctwMatrix3x3;
40 
41  template <typename T1>
42  friend class CctwVector3D;
43 
44  static CctwMatrix3x3 zero();
45  static CctwMatrix3x3 identity();
46  static CctwMatrix3x3 rotationMatrix(double r1, double r2, double r3);
47  static CctwMatrix3x3 rotX(double r);
48  static CctwMatrix3x3 rotY(double r);
49  static CctwMatrix3x3 rotZ(double r);
50 
51  void setSettingsValue(QSettings *settings, QString name);
52  static void customSaver(const QVariant &val, QSettings *settings, QString name);
53 
54 private:
55  T m_Matrix[3][3];
56 };
57 
60 
61 Q_DECLARE_METATYPE(CctwIntMatrix3x3)
62 Q_DECLARE_METATYPE(CctwDoubleMatrix3x3)
63 
64 #endif // CCTWMATRIX3X3_H
static CctwMatrix3x3 rotZ(double r)
CctwMatrix3x3< int > CctwIntMatrix3x3
Definition: cctwmatrix3x3.h:58
T & operator()(int row, int col)
static CctwMatrix3x3 rotX(double r)
CctwMatrix3x3 operator-=(const CctwMatrix3x3 &mat)
static CctwMatrix3x3 rotY(double r)
static CctwMatrix3x3 rotationMatrix(double r1, double r2, double r3)
double determinant() const
static void customSaver(const QVariant &val, QSettings *settings, QString name)
CctwMatrix3x3 operator+(const CctwMatrix3x3 &mat) const
CctwMatrix3x3 operator*(const CctwMatrix3x3 &mat) const
CctwMatrix3x3 operator-(const CctwMatrix3x3 &mat) const
CctwMatrix3x3 transposed() const
CctwMatrix3x3< double > CctwDoubleMatrix3x3
Definition: cctwmatrix3x3.h:59
CctwMatrix3x3 inverted(bool *invertible=NULL) const
T m_Matrix[3][3]
Definition: cctwmatrix3x3.h:55
bool operator==(const CctwMatrix3x3 &mat) const
static CctwMatrix3x3 identity()
static CctwMatrix3x3 zero()
void setSettingsValue(QSettings *settings, QString name)
CctwMatrix3x3 operator+=(const CctwMatrix3x3 &mat)
bool operator!=(const CctwMatrix3x3 &mat) const