Wm4Matrix4.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef WM4MATRIX4_H
00018 #define WM4MATRIX4_H
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #include "Wm4FoundationLIB.h"
00040 #include "Wm4Plane3.h"
00041 #include "Wm4Vector4.h"
00042
00043 namespace Wm4
00044 {
00045
00046 template <class Real>
00047 class Matrix4
00048 {
00049 public:
00050
00051
00052 Matrix4 (bool bZero = true);
00053
00054
00055 Matrix4 (const Matrix4& rkM);
00056
00057
00058 Matrix4 (Real fM00, Real fM01, Real fM02, Real fM03,
00059 Real fM10, Real fM11, Real fM12, Real fM13,
00060 Real fM20, Real fM21, Real fM22, Real fM23,
00061 Real fM30, Real fM31, Real fM32, Real fM33);
00062
00063
00064
00065
00066
00067
00068
00069 Matrix4 (const Real afEntry[16], bool bRowMajor);
00070
00071 void MakeZero ();
00072 void MakeIdentity ();
00073
00074
00075 operator const Real* () const;
00076 operator Real* ();
00077 const Real* operator[] (int iRow) const;
00078 Real* operator[] (int iRow);
00079 Real operator() (int iRow, int iCol) const;
00080 Real& operator() (int iRow, int iCol);
00081 void SetRow (int iRow, const Vector4<Real>& rkV);
00082 Vector4<Real> GetRow (int iRow) const;
00083 void SetColumn (int iCol, const Vector4<Real>& rkV);
00084 Vector4<Real> GetColumn (int iCol) const;
00085 void GetColumnMajor (Real* afCMajor) const;
00086
00087
00088 Matrix4& operator= (const Matrix4& rkM);
00089
00090
00091 bool operator== (const Matrix4& rkM) const;
00092 bool operator!= (const Matrix4& rkM) const;
00093 bool operator< (const Matrix4& rkM) const;
00094 bool operator<= (const Matrix4& rkM) const;
00095 bool operator> (const Matrix4& rkM) const;
00096 bool operator>= (const Matrix4& rkM) const;
00097
00098
00099 Matrix4 operator+ (const Matrix4& rkM) const;
00100 Matrix4 operator- (const Matrix4& rkM) const;
00101 Matrix4 operator* (const Matrix4& rkM) const;
00102 Matrix4 operator* (Real fScalar) const;
00103 Matrix4 operator/ (Real fScalar) const;
00104 Matrix4 operator- () const;
00105
00106
00107 Matrix4& operator+= (const Matrix4& rkM);
00108 Matrix4& operator-= (const Matrix4& rkM);
00109 Matrix4& operator*= (Real fScalar);
00110 Matrix4& operator/= (Real fScalar);
00111
00112
00113 Vector4<Real> operator* (const Vector4<Real>& rkV) const;
00114
00115
00116 Matrix4 Transpose () const;
00117 Matrix4 TransposeTimes (const Matrix4& rkM) const;
00118 Matrix4 TimesTranspose (const Matrix4& rkM) const;
00119 Matrix4 Inverse () const;
00120 Matrix4 Adjoint () const;
00121 Real Determinant () const;
00122 Real QForm (const Vector4<Real>& rkU,
00123 const Vector4<Real>& rkV) const;
00124
00125
00126 void MakeObliqueProjection (const Vector3<Real>& rkNormal,
00127 const Vector3<Real>& rkPoint, const Vector3<Real>& rkDirection);
00128 void MakePerspectiveProjection (const Vector3<Real>& rkNormal,
00129 const Vector3<Real>& rkPoint, const Vector3<Real>& rkEye);
00130
00131
00132 void MakeReflection (const Vector3<Real>& rkNormal,
00133 const Vector3<Real>& rkPoint);
00134
00135
00136 WM4_FOUNDATION_ITEM static const Matrix4 ZERO;
00137 WM4_FOUNDATION_ITEM static const Matrix4 IDENTITY;
00138
00139 private:
00140
00141 int CompareArrays (const Matrix4& rkM) const;
00142
00143 Real m_afEntry[16];
00144 };
00145
00146
00147 template <class Real>
00148 Matrix4<Real> operator* (Real fScalar, const Matrix4<Real>& rkM);
00149
00150
00151 template <class Real>
00152 Vector4<Real> operator* (const Vector4<Real>& rkV, const Matrix4<Real>& rkM);
00153
00154 }
00155
00156 #include "Wm4Matrix4.inl"
00157
00158 namespace Wm4
00159 {
00160 typedef Matrix4<float> Matrix4f;
00161 typedef Matrix4<double> Matrix4d;
00162 }
00163
00164 #endif