00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef MATRIX_FOUR_H
00023 #define MATRIX_FOUR_H
00024
00026 class Matrix4 {
00027 public:
00028 Matrix4(void) { identity(); }
00029 Matrix4(double f) { constant(f); }
00030 Matrix4(const double *m);
00031 Matrix4(const Matrix4& m) { loadmatrix(m); }
00032 ~Matrix4(void) {}
00033 double mat[16];
00034
00036 void multpoint3d (const double[3], double[3]) const;
00037
00039 void multnorm3d (const double[3], double[3]) const;
00040
00042 void multpoint4d (const double[4], double[4]) const;
00043
00045 void identity(void);
00046
00048 void constant(double);
00049
00054 int inverse(void);
00055
00057 void transpose(void);
00058
00060 void loadmatrix(const Matrix4 &m);
00061 Matrix4& operator=(const Matrix4& m) {loadmatrix(m); return *this;}
00062
00064 void multmatrix(const Matrix4 &);
00065
00067 void rot(double, char);
00068
00070 void rotate_axis(const double axis[3], double angle);
00071
00073 void transvec(double x, double y, double z);
00074
00076 void transvecinv(double x, double y, double z);
00077
00079 void translate(double, double, double);
00080 void translate(double d[3]) { translate(d[0], d[1], d[2]); }
00081
00083 void scale(double, double, double);
00084 void scale(double f) { scale(f, f, f); }
00085
00087 void window(double, double, double, double, double, double);
00088
00090 void ortho(double, double, double, double, double, double);
00091
00093 void ortho2(double, double, double, double);
00094
00101 void lookat(double, double, double, double, double, double, short);
00102 };
00103
00105 void trans_from_rotate(const double mat3[9], Matrix4 *mat4);
00106
00108 void print_Matrix4(const Matrix4 *mat4);
00109
00110 #endif
00111