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(float f) { constant(f); }            
00030   Matrix4(const float *m);                     
00031   Matrix4(const Matrix4& m) { loadmatrix(m); } 
00032   ~Matrix4(void) {}                            
00033   float mat[16];                               
00034 
00036   void multpoint3d(const float[3], float[3]) const;
00037 
00039   void multpointarray_3d(int numpts, const float *, float *) const;
00040 
00042   void multnorm3d(const float[3], float[3]) const;
00043 
00045   void multplaneeq3d(const float[3], float[3]) const;
00046 
00048   void multpoint4d(const float[4], float[4]) const;
00049 
00051   void identity(void);
00052   
00054   void constant(float);
00055   
00060   int inverse(void);
00061   
00063   void transpose(void);
00064   
00066   void loadmatrix(const Matrix4 &m);
00067   Matrix4& operator=(const Matrix4& m) {loadmatrix(m); return *this;}
00068 
00070   void multmatrix(const Matrix4 &);
00071 
00073   void rot(float, char); 
00074 
00076   void rotate_axis(const float axis[3], float angle);
00077   
00079   void transvec(float x, float y, float z);
00080  
00082   void transvecinv(float x, float y, float z);
00083 
00085   void translate(float, float, float);
00086   void translate(float d[3]) { translate(d[0], d[1], d[2]); }
00087 
00089   void scale(float, float, float);
00090   void scale(float f) { scale(f, f, f); }
00091 
00093   void window(float, float, float, float, float, float);
00094 
00096   void ortho(float, float, float, float, float, float);
00097 
00099   void ortho2(float, float, float, float);
00100 
00107   void lookat(float, float, float, float, float, float, short);
00108 };
00109 
00111 void trans_from_rotate(const float mat3[9], Matrix4 *mat4);
00112 
00114 void print_Matrix4(const Matrix4 *mat4);
00115 
00116 #endif
00117