00001 /*========================================================================= 00002 UberSim Source Code Release 00003 ------------------------------------------------------------------------- 00004 Copyright (C) 2002 Manuela Veloso, Brett Browning, Mike Bowling, 00005 James Bruce; {mmv, brettb, mhb, jbruce}@cs.cmu.edu 00006 Erick Tryzelaar {erickt}@andrew.cmu.edu 00007 School of Computer Science, Carnegie Mellon University 00008 ------------------------------------------------------------------------- 00009 This software is distributed under the GNU General Public License, 00010 version 2. If you do not have a copy of this licence, visit 00011 www.gnu.org, or write: Free Software Foundation, 59 Temple Place, 00012 Suite 330 Boston, MA 02111-1307 USA. This program is distributed 00013 in the hope that it will be useful, but WITHOUT ANY WARRANTY, 00014 including MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00015 -------------------------------------------------------------------------*/ 00016 00017 #ifndef __SIM_MATRIX22_H__ 00018 #define __SIM_MATRIX22_H__ 00019 00020 #include "Vector2.h" 00026 class Matrix22 00027 { 00028 public: 00029 static const Matrix22 ZERO; 00030 static const Matrix22 IDENTITY; 00031 00032 public: 00033 Matrix22 (); 00034 Matrix22 (const Matrix22& matrix); 00035 Matrix22 (const Real m00, const Real m01, 00036 const Real m10, const Real m11); 00037 ~Matrix22 (); 00038 00039 public: 00040 Real* operator [] (const unsigned int i) const; 00041 operator Real* (); 00042 00043 Matrix22& operator = (const Matrix22& matrix); 00044 00045 Matrix22 operator + (const Matrix22& matrix) const; 00046 Matrix22 operator - (const Matrix22& matrix) const; 00047 Matrix22 operator * (const Real scalar) const; 00048 Vector2 operator * (const Vector2& vector) const; 00049 Matrix22 operator * (const Matrix22& matrix) const; 00050 00051 friend Matrix22 operator * (const Real scalar, const Matrix22& matrix); 00052 friend Vector2 operator * (const Vector2& vector, const Matrix22& matrix); 00053 00054 public: 00055 Matrix22 transpose (); 00056 00057 protected: 00058 Real m[2][2]; 00059 }; 00060 00061 #endif