HyperspaceExplorer 0.7.1
|
00001 /* 00002 Hyperspace Explorer - vizualizing higher-dimensional geometry 00003 Copyright (C) 2010 Lene Preuss <lene.preuss@gmail.com> 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License along 00016 with this program; if not, write to the Free Software Foundation, Inc., 00017 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 (Seriously, has anyone ever done this?) 00019 00020 */ 00021 #ifndef GRID_DRAWER_H 00022 #define GRID_DRAWER_H 00023 00024 #include "View.h" 00025 #include "MultiDimensionalVector.h" 00026 00028 00040 template <unsigned P, typename NUM = double, unsigned D = 3> 00041 class GridDrawer { 00042 public: 00043 00044 // GridDrawer(const VecMath::MultiDimensionalVector< VecMath::Vector<D, NUM>, P > &x_scr, UI::View *view); 00045 GridDrawer(const VecMath::MultiDimensionalVector< VecMath::Vector<4, NUM>, P > &x, 00046 const VecMath::MultiDimensionalVector< VecMath::Vector<D, NUM>, P > &x_scr, 00047 UI::View * view); 00048 00049 void execute(); 00050 00051 private: 00052 00053 const VecMath::MultiDimensionalVector< VecMath::Vector<4, NUM>, P > &_x; 00054 const VecMath::MultiDimensionalVector< VecMath::Vector<D, NUM>, P > &_x_scr; 00055 UI::View * _view; 00056 00057 }; 00058 00059 template<typename NUM, unsigned D> class GridDrawer<3, NUM, D> { 00060 public: 00061 00062 GridDrawer(const VecMath::MultiDimensionalVector< VecMath::Vector<4, NUM>, 3 > &x, 00063 const VecMath::MultiDimensionalVector< VecMath::Vector<D, NUM>, 3 > &x_scr, 00064 UI::View * view); 00065 00066 void execute(); 00067 00068 private: 00069 00070 void drawPlane (unsigned t); 00071 void drawStrip (unsigned t, unsigned u); 00072 void drawCube (unsigned t, unsigned u, unsigned v); 00073 00074 const VecMath::MultiDimensionalVector< VecMath::Vector<4, NUM>, 3 > &x_; 00075 const VecMath::MultiDimensionalVector< VecMath::Vector<D, NUM>, 3 > &x_scr_; 00076 UI::View * view_; 00077 00078 }; 00079 00080 template<typename NUM, unsigned D> class GridDrawer<2, NUM, D> { 00081 public: 00082 00083 GridDrawer(const VecMath::MultiDimensionalVector< VecMath::Vector<4, NUM>, 2 > &x, 00084 const VecMath::MultiDimensionalVector< VecMath::Vector<D, NUM>, 2 > &x_scr, 00085 UI::View *view); 00086 00087 void execute(); 00088 00089 private: 00090 00091 void drawStrip(unsigned t); 00092 00093 const VecMath::MultiDimensionalVector< VecMath::Vector<4, NUM>, 2 > &x_; 00094 const VecMath::MultiDimensionalVector< VecMath::Vector<D, NUM>, 2 > &x_scr_; 00095 UI::View *view_; 00096 00097 }; 00098 00099 template<typename NUM, unsigned D> class GridDrawer<1, NUM, D> { 00100 public: 00101 00102 GridDrawer(const VecMath::MultiDimensionalVector< VecMath::Vector<4, NUM>, 1 > &x, 00103 const VecMath::MultiDimensionalVector< VecMath::Vector<D, NUM>, 1 > &x_scr, 00104 UI::View *view); 00105 00106 void execute(); 00107 00108 private: 00109 00110 const VecMath::MultiDimensionalVector< VecMath::Vector<4, NUM>, 1 > &x_; 00111 const VecMath::MultiDimensionalVector< VecMath::Vector<D, NUM>, 1 > &x_scr_; 00112 UI::View *view_; 00113 00114 }; 00115 00116 #endif