00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef MATRIX4X4_H
00024 #define MATRIX4X4_H
00025
00026 #include "maths.h"
00027 #include "vec4.h"
00028
00038 class Matrix4x4
00039 {
00040 public:
00042 float m[16];
00043 Matrix4x4();
00044
00045 ~Matrix4x4();
00046
00047 Matrix4x4(const Matrix4x4& other);
00048 Matrix4x4& operator=(const Matrix4x4& other);
00049
00050 Matrix4x4 operator+(const Matrix4x4& other) const;
00051 Matrix4x4 &operator+=(const Matrix4x4& other);
00052
00053 Matrix4x4 operator-(const Matrix4x4& other) const;
00054 Matrix4x4 &operator-=(const Matrix4x4& other);
00055
00056 Matrix4x4 operator*(const float other) const;
00057 Matrix4x4 &operator*=(const float other);
00058
00059 Matrix4x4 operator*(const Matrix4x4 &o) const;
00060 Matrix4x4 &operator*=(const Matrix4x4 &o);
00061
00062 float &operator()(unsigned int i, unsigned int j);
00063 float operator()(unsigned int i, unsigned int j) const;
00064
00065 bool operator==(Matrix4x4 &other);
00066 bool operator!=(Matrix4x4 &other);
00067
00068 bool isAffine(void);
00069
00070 void scale(float xin, float yin, float zin);
00071 void trans(float xin, float yin, float zin);
00072 void rotate(float xin, float yin, float zin);
00073 void scale(Vec4 in);
00074 void trans(Vec4 in);
00075 void rotate(Vec4 in);
00076 void rotX(float in);
00077 void rotY(float in);
00078 void rotZ(float in);
00079
00080 void makeScale(float xin, float yin, float zin);
00081 void makeTrans(float xin, float yin, float zin);
00082 void makeRotate(float xin, float yin, float zin);
00083 void makeScale(Vec4 in);
00084
00085 void makeRotate(Vec4 in);
00086 void makeRotX(float in);
00087 void makeRotY(float in);
00088 void makeRotZ(float in);
00089
00090 void invert(void);
00091 void transpose(void);
00092
00093 void Identity(void);
00094 void Zero(void);
00095 void Print(void);
00096 void Clean(void);
00097
00098
00099
00100 };
00101
00102 Matrix4x4 makeInverse(const Matrix4x4 &in);
00103
00112 inline float &Matrix4x4::operator()(unsigned int i, unsigned int j)
00113 {
00114 return m[i + 4*j];
00115 }
00116
00125 inline float Matrix4x4::operator ()(unsigned int i, unsigned int j) const
00126 {
00127 return m[i + 4*j];
00128 }
00129
00130
00131
00132
00133
00134 #endif
00135
00136