Matrix2x2< T > Class Template Reference

#include <TAPsMatrix2x2.hpp>

Collaboration diagram for Matrix2x2< T >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

GetDeterminant () const
Matrix2x2< T > GetInverse () const
Matrix2x2< T > GetTranspose () const
Matrix2x2< T > & Inversed ()
bool IsIdentity () const
bool IsSquare () const
bool IsSymmetric () const
void MakeDiagonal (T const af[4])
void MakeDiagonal (T d)
void MakeIdentity ()
void MakeZero ()
 Matrix2x2 (T const af[4])
 Matrix2x2 (T, T, T, T)
 Matrix2x2 (T)
 Matrix2x2 (Matrix2x2< T > const &M)
 Matrix2x2 ()
void MultLeft (Matrix2x2< T > const &M)
void MultRight (Matrix2x2< T > const &M)
 operator const T * () const
 operator T * ()
T const & operator() (int r, int c) const
T & operator() (int r, int c)
Vector2< T > operator* (Vector2< T > const &V) const
Matrix2x2< T > operator* (T s) const
Matrix2x2< T > operator* (Matrix2x2< T > const &M) const
Matrix2x2< T > & operator*= (T s)
Matrix2x2< T > & operator*= (Matrix2x2< T > const &M)
Matrix2x2< T > operator+ (Matrix2x2< T > const &M) const
Matrix2x2< T > & operator+= (Matrix2x2< T > const &M)
Matrix2x2< T > operator- (Matrix2x2< T > const &M) const
Matrix2x2< T > operator- ()
Matrix2x2< T > & operator-= (Matrix2x2< T > const &M)
Matrix2x2< T > operator/ (T s) const
Matrix2x2< T > & operator/= (T s)
Matrix2x2< T > & operator= (Matrix2x2< T > const &M)
T const & operator[] (int i) const
T & operator[] (int i)
void SetAllElements (T const af[4])
void SetAllElements (T, T, T, T)
void SetAllElements (T)
Matrix2x2< T > & Transposed ()
 ~Matrix2x2 ()

Private Attributes

e [4]

Friends

Matrix2x2< T > operator* (T s, Matrix2x2< T > const &M)
std::ostream & operator<< (std::ostream &output, Matrix2x2< T > const &M)


Detailed Description

template<typename T>
class Matrix2x2< T >

Definition at line 20 of file TAPsMatrix2x2.hpp.


Constructor & Destructor Documentation

template<typename T>
BEGIN_NAMESPACE_TAPs Matrix2x2< T >::Matrix2x2 (  )  [inline]

Definition at line 20 of file TAPsMatrix2x2.cpp.

00021 {
00022     // Identity Matrix
00023     e[0] = e[3] = Math<T>::ONE;
00024     e[1] = e[2] = Math<T>::ZERO;
00025 }

template<typename T>
Matrix2x2< T >::Matrix2x2 ( Matrix2x2< T > const &  M  )  [inline]

Definition at line 28 of file TAPsMatrix2x2.cpp.

00029 {
00030     e[0] = M.e[0];  e[1] = M.e[1];  e[2] = M.e[2];  e[3] = M.e[3];
00031 }

template<typename T>
Matrix2x2< T >::Matrix2x2 ( t  )  [inline]

Definition at line 34 of file TAPsMatrix2x2.cpp.

00035 {
00036     e[0] = e[1] = e[2] = e[3] = t;
00037 }

template<typename T>
Matrix2x2< T >::Matrix2x2 ( e00,
e01,
e10,
e11 
) [inline]

Definition at line 40 of file TAPsMatrix2x2.cpp.

00041 {
00042     e[0] = e00;  e[1] = e01;  e[2] = e10;  e[3] = e11;
00043 }

template<typename T>
Matrix2x2< T >::Matrix2x2 ( T const   af[4]  )  [inline]

Definition at line 46 of file TAPsMatrix2x2.cpp.

00047 {
00048     e[0] = af[0];  e[1] = af[1];  e[2] = af[2];  e[3] = af[3];
00049 }

template<typename T>
Matrix2x2< T >::~Matrix2x2 (  )  [inline]

Definition at line 52 of file TAPsMatrix2x2.cpp.

00053 {}


Member Function Documentation

template<typename T>
T Matrix2x2< T >::GetDeterminant (  )  const [inline]

Definition at line 184 of file TAPsMatrix2x2.cpp.

00185 {
00186     return e[0]*e[3] - e[1]*e[2];
00187 }

template<typename T>
Matrix2x2< T > Matrix2x2< T >::GetInverse (  )  const [inline]

Definition at line 170 of file TAPsMatrix2x2.cpp.

00171 {
00172     T det = GetDeterminant();
00173 
00174     if ( -Math<T>::EPSILON < det && det < Math<T>::EPSILON )
00175         return Matrix2x2( Math<T>::INFINITY );
00176 
00177     return Matrix2x2<T>( e[3] / det, 
00178                         -e[1] / det, 
00179                         -e[2] / det, 
00180                          e[0] / det );
00181 }

template<typename T>
Matrix2x2< T > Matrix2x2< T >::GetTranspose (  )  const [inline]

Definition at line 155 of file TAPsMatrix2x2.cpp.

00156 {
00157     return  Matrix2x2<T> ( e[0], e[2], e[1], e[3] );
00158 }

template<typename T>
Matrix2x2< T > & Matrix2x2< T >::Inversed (  )  [inline]

Definition at line 162 of file TAPsMatrix2x2.cpp.

00163 {
00164     *this = (*this).GetInverse();
00165     return *this;
00166 }

template<typename T>
bool Matrix2x2< T >::IsIdentity (  )  const [inline]

Definition at line 135 of file TAPsMatrix2x2.cpp.

00136 {
00137     return  e[ 0] == Math<T>::ONE   &&
00138             e[ 1] == Math<T>::ZERO  &&
00139             e[ 2] == Math<T>::ZERO  &&
00140             e[ 3] == Math<T>::ONE;
00141 }

template<typename T>
bool Matrix2x2< T >::IsSquare (  )  const [inline]

Definition at line 71 of file TAPsMatrix2x2.hpp.

00072         { return true;}

template<typename T>
bool Matrix2x2< T >::IsSymmetric (  )  const [inline]

Definition at line 69 of file TAPsMatrix2x2.hpp.

00070         { return e[1] == e[2]; }

template<typename T>
void Matrix2x2< T >::MakeDiagonal ( T const   af[4]  )  [inline]

template<typename T>
void Matrix2x2< T >::MakeDiagonal ( d  )  [inline]

Definition at line 114 of file TAPsMatrix2x2.cpp.

00115 {
00116     e[0] = e[3] = d;
00117     e[1] = e[2] = Math<T>::ZERO;
00118 }

template<typename T>
void Matrix2x2< T >::MakeIdentity (  )  [inline]

Definition at line 107 of file TAPsMatrix2x2.cpp.

00108 {
00109     e[0] = e[3] = Math<T>::ONE;
00110     e[1] = e[2] = Math<T>::ZERO;
00111 }

template<typename T>
void Matrix2x2< T >::MakeZero (  )  [inline]

Definition at line 129 of file TAPsMatrix2x2.cpp.

00130 {
00131     e[0] = e[1] = e[2] = e[3] = Math<T>::ZERO;
00132 }

template<typename T>
void Matrix2x2< T >::MultLeft ( Matrix2x2< T > const &  M  )  [inline]

Definition at line 286 of file TAPsMatrix2x2.cpp.

00287 {
00288     *this = M * (*this);
00289 }

template<typename T>
void Matrix2x2< T >::MultRight ( Matrix2x2< T > const &  M  )  [inline]

Definition at line 292 of file TAPsMatrix2x2.cpp.

00293 {
00294     *this *= M;
00295 }

template<typename T>
Matrix2x2< T >::operator const T * (  )  const [inline]

Definition at line 78 of file TAPsMatrix2x2.cpp.

00079 {   return e;   }

template<typename T>
Matrix2x2< T >::operator T * (  )  [inline]

Definition at line 82 of file TAPsMatrix2x2.cpp.

00083 {   return e;   }

template<typename T>
T const & Matrix2x2< T >::operator() ( int  r,
int  c 
) const [inline]

Definition at line 71 of file TAPsMatrix2x2.cpp.

00072 {   return e[r*2 + c];  }

template<typename T>
T & Matrix2x2< T >::operator() ( int  r,
int  c 
) [inline]

Definition at line 67 of file TAPsMatrix2x2.cpp.

00068 {   return e[r*2 + c];  }

template<typename T>
Vector2< T > Matrix2x2< T >::operator* ( Vector2< T > const &  V  )  const [inline]

Definition at line 299 of file TAPsMatrix2x2.cpp.

00300 {
00301     return Vector2<T>(
00302             V[0]*e[0] + V[1]*e[1],
00303             V[0]*e[2] + V[1]*e[3] );
00304 }

template<typename T>
Matrix2x2< T > Matrix2x2< T >::operator* ( s  )  const [inline]

Definition at line 274 of file TAPsMatrix2x2.cpp.

00275 {
00276     return Matrix2x2<T>( e[0]*s, e[1]*s, e[2]*s, e[3]*s );
00277 }

template<typename T>
Matrix2x2< T > Matrix2x2< T >::operator* ( Matrix2x2< T > const &  M  )  const [inline]

Definition at line 265 of file TAPsMatrix2x2.cpp.

00266 {
00267     return Matrix2x2<T>(    e[0]*M.e[0] + e[1]*M.e[2], 
00268                             e[0]*M.e[1] + e[1]*M.e[3], 
00269                             e[2]*M.e[0] + e[3]*M.e[2], 
00270                             e[2]*M.e[1] + e[3]*M.e[3] );
00271 }

template<typename T>
Matrix2x2< T > & Matrix2x2< T >::operator*= ( s  )  [inline]

Definition at line 236 of file TAPsMatrix2x2.cpp.

00237 {
00238     e[0] *= s;  e[1] *= s;  e[2] *= s;  e[3] *= s;
00239     return *this;
00240 }

template<typename T>
Matrix2x2< T > & Matrix2x2< T >::operator*= ( Matrix2x2< T > const &  M  )  [inline]

Definition at line 229 of file TAPsMatrix2x2.cpp.

00230 {
00231     *this = (*this) * M;
00232     return *this;
00233 }

template<typename T>
Matrix2x2< T > Matrix2x2< T >::operator+ ( Matrix2x2< T > const &  M  )  const [inline]

Definition at line 253 of file TAPsMatrix2x2.cpp.

00254 {
00255     return Matrix2x2<T>( e[0]+M.e[0], e[1]+M.e[1], e[2]+M.e[2], e[3]+M.e[3] );
00256 }

template<typename T>
Matrix2x2< T > & Matrix2x2< T >::operator+= ( Matrix2x2< T > const &  M  )  [inline]

Definition at line 215 of file TAPsMatrix2x2.cpp.

00216 {
00217     e[0] += M.e[0];  e[1] += M.e[1];  e[2] += M.e[2];  e[3] += M.e[3];
00218     return *this;
00219 }

template<typename T>
Matrix2x2< T > Matrix2x2< T >::operator- ( Matrix2x2< T > const &  M  )  const [inline]

Definition at line 259 of file TAPsMatrix2x2.cpp.

00260 {
00261     return Matrix2x2<T>( e[0]-M.e[0], e[1]-M.e[1], e[2]-M.e[2], e[3]-M.e[3] );
00262 }

template<typename T>
Matrix2x2< T > Matrix2x2< T >::operator- (  )  [inline]

Definition at line 206 of file TAPsMatrix2x2.cpp.

00207 {
00208     return Matrix2x2<T>( -e[0], -e[1], -e[2], -e[3] );
00209 }

template<typename T>
Matrix2x2< T > & Matrix2x2< T >::operator-= ( Matrix2x2< T > const &  M  )  [inline]

Definition at line 222 of file TAPsMatrix2x2.cpp.

00223 {
00224     e[0] -= M.e[0];  e[1] -= M.e[1];  e[2] -= M.e[2];  e[3] -= M.e[3];
00225     return *this;
00226 }

template<typename T>
Matrix2x2< T > Matrix2x2< T >::operator/ ( s  )  const [inline]

Definition at line 280 of file TAPsMatrix2x2.cpp.

00281 {
00282     return Matrix2x2<T>( e[0]/s, e[1]/s, e[2]/s, e[3]/s );
00283 }

template<typename T>
Matrix2x2< T > & Matrix2x2< T >::operator/= ( s  )  [inline]

Definition at line 243 of file TAPsMatrix2x2.cpp.

00244 {
00245     e[0] /= s;  e[1] /= s;  e[2] /= s;  e[3] /= s;
00246     return *this;
00247 }

template<typename T>
Matrix2x2< T > & Matrix2x2< T >::operator= ( Matrix2x2< T > const &  M  )  [inline]

Definition at line 193 of file TAPsMatrix2x2.cpp.

00194 {
00195     if ( this != &M )
00196     {
00197         e[0] = M.e[0];  e[1] = M.e[1];  e[2] = M.e[2];  e[3] = M.e[3];
00198     }
00199     return *this;
00200 }

template<typename T>
T const & Matrix2x2< T >::operator[] ( int  i  )  const [inline]

Definition at line 63 of file TAPsMatrix2x2.cpp.

00064 {   return e[i];    }

template<typename T>
T & Matrix2x2< T >::operator[] ( int  i  )  [inline]

Definition at line 59 of file TAPsMatrix2x2.cpp.

00060 {   return e[i];    }

template<typename T>
void Matrix2x2< T >::SetAllElements ( T const   af[4]  )  [inline]

Definition at line 101 of file TAPsMatrix2x2.cpp.

00102 {
00103     e[0] = af[0];  e[1] = af[1];  e[2] = af[2];  e[3] = af[3];
00104 }

template<typename T>
void Matrix2x2< T >::SetAllElements ( e00,
e01,
e10,
e11 
) [inline]

Definition at line 95 of file TAPsMatrix2x2.cpp.

00096 {
00097     e[0] = e00;  e[1] = e01;  e[2] = e10;  e[3] = e11;
00098 }

template<typename T>
void Matrix2x2< T >::SetAllElements ( t  )  [inline]

Definition at line 89 of file TAPsMatrix2x2.cpp.

00090 {
00091     e[0] = e[1] = e[2] = e[3] = t;
00092 }

template<typename T>
Matrix2x2< T > & Matrix2x2< T >::Transposed (  )  [inline]

Definition at line 147 of file TAPsMatrix2x2.cpp.

00148 {
00149     T temp;
00150     temp = e[1];  e[1] = e[2];  e[2] = temp;
00151     return *this;
00152 }


Friends And Related Function Documentation

template<typename T>
Matrix2x2<T> operator* ( s,
Matrix2x2< T > const &  M 
) [friend]

Definition at line 99 of file TAPsMatrix2x2.hpp.

00100     {   return M * s;   }

template<typename T>
std::ostream& operator<< ( std::ostream &  output,
Matrix2x2< T > const &  M 
) [friend]

Definition at line 29 of file TAPsMatrix2x2.hpp.

00030     {
00031         int width = 14;
00032         //output << typeid(*this).name() << "( ";
00033         output  << "Matrix2x2<" << typeid(T).name() << "> =\n"
00034                 << "| " << std::setw(width) << M.e[0] 
00035                         << std::setw(width) << M.e[1] << " |\n"
00036                 << "| " << std::setw(width) << M.e[2] 
00037                         << std::setw(width) << M.e[3] << " |\n";
00038         //output << std::endl;
00039         return output;
00040     }


Member Data Documentation

template<typename T>
T Matrix2x2< T >::e[4] [private]

Definition at line 24 of file TAPsMatrix2x2.hpp.


The documentation for this class was generated from the following files:

Generated on Mon Oct 13 11:45:07 2008 for TAPs by  doxygen 1.5.6