1 | /*! |
---|
2 | * @file matrix.h |
---|
3 | * @brief Definition of a 3x3 matrix. |
---|
4 | */ |
---|
5 | |
---|
6 | #include "vector.h" |
---|
7 | |
---|
8 | //! Matrix is a 3x3 Matrix class with most important functions |
---|
9 | class Matrix |
---|
10 | { |
---|
11 | public: |
---|
12 | Matrix() : m11(0), m12(0), m13(0), m21(0), m22(0), m23(0), m31(0), m32(0), m33(0) { }; |
---|
13 | |
---|
14 | Matrix ( float m11, float m12, float m13, |
---|
15 | float m21, float m22, float m23, |
---|
16 | float m31, float m32, float m33 ); |
---|
17 | Matrix(const float m[3][3]); |
---|
18 | |
---|
19 | Matrix operator+ (const Matrix& m) const; |
---|
20 | Matrix operator- (const Matrix& m) const; |
---|
21 | Matrix operator* (float k) const; |
---|
22 | Vector operator* (const Vector& v) const; |
---|
23 | |
---|
24 | Matrix getTransposed() const; |
---|
25 | void toVectors(Vector& m1, Vector& m2, Vector& m3) const; |
---|
26 | |
---|
27 | float getDeterminant() const; |
---|
28 | |
---|
29 | int getEigenValues(Vector& eigenVectors) const; |
---|
30 | void getEigenVectors(Vector& a, Vector& b, Vector& c) const; |
---|
31 | |
---|
32 | /** @returns the Identity-Matrix (diagonal 3x3 with 1's everywhere) */ |
---|
33 | static Matrix identity() { return Matrix(1,0,0, 0,1,0, 0,0,1); } |
---|
34 | |
---|
35 | void debug() const; |
---|
36 | |
---|
37 | public: |
---|
38 | float m11; //!< Matrix Entry [0][0] |
---|
39 | float m12; //!< Matrix Entry [0][1] |
---|
40 | float m13; //!< Matrix Entry [0][2] |
---|
41 | float m21; //!< Matrix Entry [1][0] |
---|
42 | float m22; //!< Matrix Entry [1][1] |
---|
43 | float m23; //!< Matrix Entry [1][2] |
---|
44 | float m31; //!< Matrix Entry [2][0] |
---|
45 | float m32; //!< Matrix Entry [2][1] |
---|
46 | float m33; //!< Matrix Entry [2][2] |
---|
47 | }; |
---|