Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5696 in orxonox.OLD for trunk/src/lib/math/matrix.h


Ignore:
Timestamp:
Nov 22, 2005, 1:35:33 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: documented matrix.h

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/math/matrix.h

    r5694 r5696  
    77#include "vector.h"
    88
    9 
     9//! Matrix is a 3x3 Matrix class with most important functions
    1010class Matrix
    1111{
    12 
    1312  public:
    1413    Matrix() : m11(0), m12(0), m13(0), m21(0), m22(0), m23(0), m31(0), m32(0), m33(0) { };
     
    1615    Matrix ( float m11, float m12, float m13,
    1716             float m21, float m22, float m23,
    18              float m31, float m32, float m33 )
    19     {
    20       this->m11 = m11; this->m12 = m12; this->m13 = m13;
    21       this->m21 = m21; this->m22 = m22; this->m23 = m23;
    22       this->m31 = m31; this->m32 = m32; this->m33 = m33;
    23     };
    24     Matrix(const float m[3][3]) {
    25       this->m11 = m[0][0]; this->m12 = m[0][1]; this->m13 = m[0][2];
    26       this->m21 = m[1][0]; this->m22 = m[1][1]; this->m23 = m[1][2];
    27       this->m31 = m[2][0]; this->m32 = m[2][1]; this->m33 = m[2][2];
    28     };
     17             float m31, float m32, float m33 );
     18    Matrix(const float m[3][3]);
    2919
    30     Matrix operator+ (const Matrix& m) const {
    31       return Matrix (this->m11 + m.m11, this->m12 + m.m12, this->m13 + m.m13,
    32                      this->m21 + m.m21, this->m22 + m.m22, this->m23 + m.m23,
    33                      this->m31 + m.m31, this->m32 + m.m32, this->m33 + m.m33);
    34     }
     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;
    3524
    36     Matrix operator- (const Matrix& m) const {
    37       return Matrix (this->m11 - m.m11, this->m12 - m.m12, this->m13 - m.m13,
    38                      this->m21 - m.m21, this->m22 - m.m22, this->m23 - m.m23,
    39                      this->m31 - m.m31, this->m32 - m.m32, this->m33 - m.m33);
    40     }
     25    Matrix getTransposed() const;
     26    void toVectors(Vector& m1, Vector& m2, Vector& m3) const;
    4127
    42     Matrix operator* (float k) const {
    43       return Matrix(this->m11 - k, this->m12 - k, this->m13 - k,
    44                     this->m21 - k, this->m22 - k, this->m23 - k,
    45                     this->m31 - k, this->m32 - k, this->m33 - k);
    46     }
    47 
    48     Vector operator* (const Vector& v) const {
    49       return Vector (this->m11*v.x + this->m12*v.y + this->m13*v.z,
    50                      this->m21*v.x + this->m22*v.y + this->m23*v.z,
    51                      this->m31*v.x + this->m32*v.y + this->m33*v.z );
    52     }
    53 
    54 
    55     Matrix getTransposed() const {
    56       return Matrix( this->m11, this->m21, this->m31,
    57                      this->m12, this->m22, this->m32,
    58                      this->m13, this->m23, this->m33);
    59     }
    60 
    61     void toVectors(Vector& m1, Vector& m2, Vector& m3) const {
    62       m1 = Vector(this->m11, this->m12, this->m13);
    63       m2 = Vector(this->m21, this->m22, this->m23);
    64       m3 = Vector(this->m31, this->m32, this->m33);
    65     }
     28    float getDeterminant() const;
    6629
    6730    int getEigenValues(Vector& eigenVectors) const;
     
    7336    void debug() const;
    7437
    75 
    7638  public:
    7739    float m11;    float m12;     float m13;
    7840    float m21;    float m22;     float m23;
    7941    float m31;    float m32;     float m33;
    80 
    8142};
Note: See TracChangeset for help on using the changeset viewer.