| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * @file matrix.hpp
|
|---|
| 3 | * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
|
|---|
| 4 | * @date Mon Apr 18 12:20:22 2011
|
|---|
| 5 | *
|
|---|
| 6 | * @brief Header file for the class VMG::Matrix, which represents a 3x3 matrix
|
|---|
| 7 | * and defines some useful operations.
|
|---|
| 8 | *
|
|---|
| 9 | */
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 | #ifndef MATRIX_HPP_
|
|---|
| 13 | #define MATRIX_HPP_
|
|---|
| 14 |
|
|---|
| 15 | #include "base/vector.hpp"
|
|---|
| 16 |
|
|---|
| 17 | namespace VMG
|
|---|
| 18 | {
|
|---|
| 19 |
|
|---|
| 20 | class Matrix
|
|---|
| 21 | {
|
|---|
| 22 | public:
|
|---|
| 23 | Matrix()
|
|---|
| 24 | {
|
|---|
| 25 | for (int i=0; i<9; i++)
|
|---|
| 26 | mat[i] = 0.0;
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
| 29 | vmg_float& operator() (int i, int j) {return mat[j+3*i];}
|
|---|
| 30 | const vmg_float& GetVal(int i, int j) const {return mat[j+3*i];}
|
|---|
| 31 |
|
|---|
| 32 | const Vector operator*(const Vector& rhs) const
|
|---|
| 33 | {
|
|---|
| 34 | Vector result;
|
|---|
| 35 |
|
|---|
| 36 | for (int i=0; i<3; i++) {
|
|---|
| 37 | result.X() += this->GetVal(0, i) * rhs.X();
|
|---|
| 38 | result.Y() += this->GetVal(1, i) * rhs.Y();
|
|---|
| 39 | result.Z() += this->GetVal(2, i) * rhs.Z();
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | return result;
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| 45 | private:
|
|---|
| 46 | vmg_float mat[9];
|
|---|
| 47 | };
|
|---|
| 48 |
|
|---|
| 49 | const Matrix abT(const Vector lhs, const Vector rhs);
|
|---|
| 50 |
|
|---|
| 51 | }
|
|---|
| 52 |
|
|---|
| 53 | #endif /* MATRIX_HPP_ */
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.