00001 #ifndef MATH_UMATRIX_H
00002 #define MATH_UMATRIX_H
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00033 #include <iosfwd>
00034 
00035 #include <math/real.h>
00036 #include <math/vector3.h>
00037 
00038 class Matrix;
00039 
00041 
00050 typedef enum
00051 {
00052     U_SCALEX = 0,
00053     U_SCALEY,
00054     U_SCALEZ,
00055     U_SHEARXY,
00056     U_SHEARXZ,
00057     U_SHEARYZ,
00058     U_ROTATEX,
00059     U_ROTATEY,
00060     U_ROTATEZ,
00061     U_TRANSX,
00062     U_TRANSY,
00063     U_TRANSZ,
00064     U_PERSPX,
00065     U_PERSPY,
00066     U_PERSPZ,
00067     U_PERSPW,
00068     U_MAX
00069 } UnMatrixField;
00070 
00083 class UnMatrix
00084 {
00085     friend class Matrix;
00086 
00087     friend std::ostream &operator<<(std::ostream &os,const UnMatrixField &field);
00088     friend std::ostream &operator<<(std::ostream &os,const UnMatrix &unMatrix);
00089 
00090     friend std::istream &operator>>(std::istream &is,UnMatrixField &field);
00091     friend std::istream &operator>>(std::istream &is,UnMatrix &unMatrix);
00092 
00093     friend UnMatrix operator-(const UnMatrix &b,const UnMatrix &a);
00094     friend UnMatrix operator*(const UnMatrix &a,const double scaleFactor);
00095     friend UnMatrix operator+(const UnMatrix &a,const UnMatrix &b);
00096 
00097 public:
00099     UnMatrix();
00101     UnMatrix(const UnMatrix &);
00102 
00104     UnMatrix(const Matrix &matrix);
00105 
00107     ~UnMatrix();
00108 
00110     bool uniformScale (const double tol = 1.0e-4) const;
00112     bool noRotation   (const double tol = 1.0e-4) const;
00114     bool noShear      (const double tol = 1.0e-4) const;
00116     bool noPerspective(const double tol = 1.0e-4) const;
00117 
00119     double &operator[](const UnMatrixField field) { return _tran[field]; };
00120 
00121 private:
00122     double _tran[16];
00123 };
00124 
00125 #endif