| 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 | #ifndef MATRIX_HPP_
|
|---|
| 12 | #define MATRIX_HPP_
|
|---|
| 13 |
|
|---|
| 14 | #include "base/vector.hpp"
|
|---|
| 15 |
|
|---|
| 16 | namespace VMG
|
|---|
| 17 | {
|
|---|
| 18 |
|
|---|
| 19 | class Matrix
|
|---|
| 20 | {
|
|---|
| 21 | public:
|
|---|
| 22 | Matrix()
|
|---|
| 23 | {
|
|---|
| 24 | for (int i=0; i<9; i++)
|
|---|
| 25 | mat[i] = 0.0;
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | vmg_float& operator() (int i, int j) {return mat[j+3*i];}
|
|---|
| 29 | const vmg_float& GetVal(int i, int j) const {return mat[j+3*i];}
|
|---|
| 30 |
|
|---|
| 31 | const Vector operator*(const Vector& rhs) const
|
|---|
| 32 | {
|
|---|
| 33 | Vector result;
|
|---|
| 34 |
|
|---|
| 35 | for (int i=0; i<3; i++) {
|
|---|
| 36 | result.X() += this->GetVal(0, i) * rhs.X();
|
|---|
| 37 | result.Y() += this->GetVal(1, i) * rhs.Y();
|
|---|
| 38 | result.Z() += this->GetVal(2, i) * rhs.Z();
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | return result;
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 | private:
|
|---|
| 45 | vmg_float mat[9];
|
|---|
| 46 | };
|
|---|
| 47 |
|
|---|
| 48 | const Matrix abT(const Vector lhs, const Vector rhs);
|
|---|
| 49 |
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | #endif /* MATRIX_HPP_ */
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.