00001 #ifndef Matrix4x4_h
00002 #define Matrix4x4_h 1
00003
00004
00005 #include <iostream>
00006
00007 class Vector4;
00008 class Matrixmxn;
00009
00010 class Matrix4x4
00011 {
00012
00013 public:
00014 Matrix4x4 ();
00015
00016 virtual ~Matrix4x4();
00017
00018
00019 Matrix4x4 operator * (const Matrix4x4& right) const;
00020
00021 Vector4 operator * (const Vector4& right) const;
00022
00023
00024 Matrix4x4 Inverse () const;
00025
00026 Matrix4x4& operator *= (const Matrix4x4& right);
00027
00028
00029 static Matrix4x4 Identity ();
00030
00031
00032
00033 double& operator () (const unsigned int row, const unsigned int col);
00034
00035
00036
00037 const double& operator () (const unsigned int row, const unsigned int col) const;
00038
00039
00040
00041
00042 void Scale (const double x, const double y, const double z);
00043
00044
00045
00046
00047 void Translate (const double x, const double y, const double z);
00048
00049
00050 void Rotate (const Vector4& axis, double angle);
00051 void Rotate2 (const Vector4& axis, double angle);
00052
00053
00054
00055
00056 void Translate (const Vector4& offset);
00057
00058
00059 Matrix4x4 Transpose () const;
00060
00061
00062 void GetValuesOpenGl ( double values[ 16 ] );
00063
00064
00065 void SetValues ( const double values[ 16 ] );
00066
00067
00068 void SetValues (const Matrix4x4& values);
00069
00070
00071 bool Compare ( const Matrix4x4& right, const double& tol ) const;
00072
00073
00074
00075
00076
00077
00078 double values[4][4];
00079
00080
00081
00082
00083 bool operator < (const Matrix4x4& right) const;
00084 bool operator ==(const Matrix4x4& right) const;
00085 bool operator !=(const Matrix4x4& right) const;
00086
00087
00088 operator Matrixmxn() const;
00089 protected:
00090
00091
00092
00093
00094 private:
00095
00096
00097
00098
00099 private:
00100
00101
00102
00103
00104 };
00105
00106
00107
00108
00109
00110
00111
00112
00113 inline double& Matrix4x4::operator () (const unsigned int row, const unsigned int col)
00114 {
00115
00116 return values[ row ][ col ] ;
00117
00118 }
00119
00120 inline const double& Matrix4x4::operator () (const unsigned int row, const unsigned int col) const
00121 {
00122
00123 return values[ row ][ col ] ;
00124
00125 }
00126
00127
00128
00129
00130 std::ostream & operator<<( std::ostream &os, const Matrix4x4& m ) ;
00131 std::istream & operator>>( std::istream &is, Matrix4x4& m ) ;
00132
00133 #endif