Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

math/umatrix.h

Go to the documentation of this file.
00001 #ifndef MATH_UMATRIX_H
00002 #define MATH_UMATRIX_H
00003 
00004 /*
00005 
00006   GLT OpenGL C++ Toolkit (LGPL)
00007   Copyright (C) 2000-2002 Nigel Stewart  
00008 
00009   Email: nigels.com@gmail.com   
00010   WWW:   http://www.nigels.com/glt/
00011 
00012   This library is free software; you can redistribute it and/or
00013   modify it under the terms of the GNU Lesser General Public
00014   License as published by the Free Software Foundation; either
00015   version 2.1 of the License, or (at your option) any later version.
00016 
00017   This library is distributed in the hope that it will be useful,
00018   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020   Lesser General Public License for more details.
00021 
00022   You should have received a copy of the GNU Lesser General Public
00023   License along with this library; if not, write to the Free Software
00024   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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

Generated on Tue Nov 5 11:11:04 2002 for GLT by doxygen1.2.18