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