[5673] | 1 | /*! |
---|
| 2 | * @file matrix.h |
---|
| 3 | * @brief Definition of a 3x3 matrix. |
---|
| 4 | */ |
---|
| 5 | |
---|
[5664] | 6 | #include <math.h> |
---|
[5673] | 7 | #include "vector.h" |
---|
[5662] | 8 | |
---|
[5696] | 9 | //! Matrix is a 3x3 Matrix class with most important functions |
---|
[5662] | 10 | class Matrix |
---|
| 11 | { |
---|
| 12 | public: |
---|
[5692] | 13 | Matrix() : m11(0), m12(0), m13(0), m21(0), m22(0), m23(0), m31(0), m32(0), m33(0) { }; |
---|
| 14 | |
---|
[5663] | 15 | Matrix ( float m11, float m12, float m13, |
---|
| 16 | float m21, float m22, float m23, |
---|
[5696] | 17 | float m31, float m32, float m33 ); |
---|
| 18 | Matrix(const float m[3][3]); |
---|
[5663] | 19 | |
---|
[5696] | 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; |
---|
[5663] | 24 | |
---|
[5696] | 25 | Matrix getTransposed() const; |
---|
| 26 | void toVectors(Vector& m1, Vector& m2, Vector& m3) const; |
---|
[5663] | 27 | |
---|
[5696] | 28 | float getDeterminant() const; |
---|
[5663] | 29 | |
---|
[5675] | 30 | int getEigenValues(Vector& eigenVectors) const; |
---|
[5668] | 31 | void getEigenVectors(Vector& a, Vector& b, Vector& c) const; |
---|
[5664] | 32 | |
---|
| 33 | /// @todo optimize |
---|
| 34 | static Matrix identity() { return Matrix (1,0,0, 0,1,0, 0,0,1); } |
---|
| 35 | |
---|
[5663] | 36 | void debug() const; |
---|
| 37 | |
---|
| 38 | public: |
---|
[5662] | 39 | float m11; float m12; float m13; |
---|
| 40 | float m21; float m22; float m23; |
---|
| 41 | float m31; float m32; float m33; |
---|
| 42 | }; |
---|