-
Notifications
You must be signed in to change notification settings - Fork 0
/
matrix3.h
46 lines (36 loc) · 1.47 KB
/
matrix3.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef MATRIX3_H
#define MATRIXX3_H
#include "vec3.h"
class Matrix3
{
/* data */
public:
// element eij:i_column,j_row
double e11, e12, e13, e21, e22, e23, e31, e32, e33;
/* Constructors and destructor */
Matrix3(const double &r11 = 1,const double &r12 = 0,const double &r13 = 0,
const double &r21 = 0,const double &r22 = 1,const double &r23 = 0,
const double &r31 = 0,const double &r32 = 0,const double &r33 = 1);
void Reset(void);
void Identity(void);
double Det(void) const ;
Matrix3 Transpose(void) const ;
Matrix3 Inverse(void) const ;
Matrix3& operator=(const Matrix3 &m);
Matrix3& operator+=(const Matrix3 &m);
Matrix3& operator-=(const Matrix3 &m);
Matrix3& operator*=(const double &s);
Matrix3& operator/=(const double &s);
void print(void)const;
};
Matrix3 operator +(const Matrix3 &m1, const Matrix3 &m2); //m1+m2
Matrix3 operator -(const Matrix3 &m1, const Matrix3 &m2); //m1-m2
Matrix3 operator /(const Matrix3 &m,const double &s); //m/s
Matrix3 operator *(const Matrix3 &m1,const Matrix3 &m2); //m1*m2
Matrix3 operator *(const Matrix3 &m,const double &s); //m*s
Matrix3 operator *(double &s, const Matrix3 &m); //s*m
Vector3<double> operator *(const Matrix3 &m, const Vector3<double> &u); //m*u
Vector3<double> operator *(const Vector3<double> &u, const Matrix3 &m); //u*m
bool operator ==(const Matrix3 &m1, const Matrix3 &m2); //whether m1 == m2
bool operator !=(const Matrix3 &m1, const Matrix3 &m2); //whethor m1 != m2
#endif // MATRIX3_H