Main Page | Class List | File List

Matrix.h

00001 /*      4x4 Matrix
00002 
00003         Last Modified   14/4/00
00004 */
00005 
00006 #ifndef __MATRIX_H_
00007 #define __MATRIX_H_
00008 
00009 class Vector3D;
00010 class Point3D;
00011 
00013 
00014 class   Matrix
00015 {
00016 private:
00017 
00018         float   m[16];          // RIGHT HANDED column major matrix
00019 
00020         __forceinline   void Verify_Matrix();                           // force last row of matrix to be 0 0 0 1 to be a homogenous matrix
00021 
00022 public:
00023 
00024         Matrix();                                                                                       // creates an 4x4 identity matrix
00025         Matrix(const float m[16]);
00026         Matrix(const Vector3D &v);                                                      // generate a transformation matrix of translation v
00027         Matrix(const float angle, const Vector3D &v);           // generate a rotation matrix of angle (rad) around an axis of rotation v
00028 
00029 //      ~Matrix();
00030 
00032 
00033         void    Zero_Clamp(void);               // clamp any values in the matrix to 0
00034 
00035         void    GetValues(float m[16])                                                          const;                  // get the values of this matrix
00036         void    GetTranslation(Point3D  &p)                                                     const;                  // get the translation portion of the 4x4 homogenous transformation matrix
00037 
00038         //%%%%%%%%%%%%%
00039         // NOT WORKING
00040         //%%%%%%%%%%%%%
00041         void    GetEulerAngles(float &x, float &y, float &z)            const;                  // get euler values of rotation order x,y,z of matrix
00042 
00043         void    SetValues(const float m[16]);                                                                           // set the values of this matrix, last row always 0 0 0 1 regardless of what is passed in
00044         void    SetValues(const Point3D &p);                                                                            // create a transformation matrix that translates to the position p
00045         void    SetValues(const Vector3D &v);                                                                           // create a transformation matrix with the translation vector
00046         void    SetValues(const float angle, const Vector3D &v);                                        // create a rotation matrix with angle (rad) around axis of rotation vector
00047 
00048         void    SetValues_RotX(const float angle);                                                                      // generate a 4x4 rotation matrix with angle (degree) around respective axis
00049         void    SetValues_RotY(const float angle);
00050         void    SetValues_RotZ(const float angle);
00051         void    SetValues_Rot(const float x, const float y, const float z);                     // generates a final 4x4 transformation matrix of rotation around x ,y, z axis (deg)
00052 
00054 
00055         //%%%%%%%%%%%%%%%%%
00056         // NOT IMPLEMENTED
00057         //%%%%%%%%%%%%%%%%%
00058         void    Inverse(void);                  // inverse the matrix
00059 
00060         void    LoadIdentity(void);             // set this matrix to the identity matrix
00061 
00062         void    Negate(void);                   // negate the matrix;
00063 
00064         void    Transpose(void);                // transpose the matrix
00065 
00067 
00068         Matrix          operator*(const Matrix &m)              const;          // multiplication with a matrix
00069         Matrix          operator*(const float s)                const;          // scale matrix by s
00070 //      Matrix          operator+(const Matrix &m)              const;
00071 //      Matrix          operator-(const Matrix &m)              const;
00072         Matrix          operator-()                                             const;          // negation
00073 
00074         Vector3D        operator*(const Vector3D &v)    const;          // pre-multiply by column vector
00075         Point3D         operator*(const Point3D &p)             const;          // pre-multiply by point
00076 
00077         Matrix&         operator=(const Matrix &m);                                     // copy constructor
00078 //      Matrix&         operator+=(const Matrix &m);
00079 //      Matrix&         operator-=(const Matrix &m);
00080         Matrix&         operator*=(const Matrix &m);
00081         Matrix&         operator*=(const float s);                                      // scale matrix by s
00082         
00083         int                     operator==(const Matrix &m)             const;          // equality
00084         int                     operator!=(const Matrix &m)             const;  
00085 
00086 //------- debug
00087 
00088         void            Print() const;
00089 
00090 };      // end class Matrix
00091 
00093 
00094 #endif  // __MATRIX_H_

Generated on Mon Jan 26 22:13:13 2004 for fluid3 by doxygen 1.3.5