Mercator
|
00001 // This file may be redistributed and modified only under the terms of 00002 // the GNU General Public License (See COPYING for details). 00003 // Copyright (C) 2003 Alistair Riddoch 00004 00005 #ifndef MERCATOR_MATRIX_H 00006 #define MERCATOR_MATRIX_H 00007 00008 namespace Mercator { 00009 00013 template <unsigned int COLS, unsigned int ROWS, typename FloatType = float> 00014 class Matrix { 00015 private: 00017 FloatType m_data[COLS * ROWS]; 00018 public: 00020 Matrix() { } 00021 00023 FloatType & operator()(unsigned int col, unsigned int row) { 00024 return m_data[row * COLS + col]; 00025 } 00026 00028 const FloatType & operator()(unsigned int col, unsigned int row) const { 00029 return m_data[row * COLS + col]; 00030 } 00031 00033 FloatType & operator[](unsigned int idx) { 00034 return m_data[idx]; 00035 } 00036 }; 00037 00038 } 00039 00040 #endif // MERCATOR_MATRIX_H