00001 /* 00002 Copyright (c) 2002 Tai Meng (tmeng@sfu.ca). All Rights Reserved 00003 */ 00004 00005 /*============================================================*/ 00006 00007 /* 00008 Created on August 11 2002 (Revision 1) 00009 */ 00010 00011 /*============================================================*/ 00012 00013 /* 00014 Revision History: 00015 00016 Revision 2: 00017 */ 00018 00019 /*============================================================*/ 00020 00021 /* 00022 To-Do List: 00023 00024 */ 00025 00026 /*============================================================*/ 00027 00028 /* 00029 Q & A 00030 */ 00031 00032 /*============================================================*/ 00033 00034 /* 00035 Mini-discoveries 00036 */ 00037 00038 /*============================================================*/ 00039 00040 /* 00041 Modifications to other vuVolume classes: 00042 00043 */ 00044 00045 /*============================================================*/ 00046 00047 #ifndef _VU_GRID_H_ 00048 #define _VU_GRID_H_ 00049 00050 /*============================================================*/ 00051 00052 #include <ostream.h> //ostream doesn't exist, must have .h 00053 00054 /*============================================================*/ 00055 00056 using namespace std; //this avoid naming conflicts among globals 00057 00058 /*============================================================*/ 00059 /* Doxygen tags are marked by the special "!" symbols after */ 00060 /* comments i.e. "//!" NOTE: I used Qt-style comments */ 00061 /*============================================================*/ 00062 00064 00067 class vuGrid 00068 { 00069 private: 00070 00071 /*============================================================*/ 00072 /* PRIVATE ATTRIBUTES */ 00073 /*============================================================*/ 00074 00076 00078 float xWidth; 00079 00080 /*============================================================*/ 00081 00083 00085 float yHeight; 00086 00087 /*============================================================*/ 00088 00090 00092 float zDepth; 00093 00094 /*============================================================*/ 00095 00097 00099 bool isDrawGrid; 00100 00101 /*============================================================*/ 00102 /* PRIVATE MEMBER FUNCTIONS */ 00103 /*============================================================*/ 00104 00105 public: 00106 00107 /*============================================================*/ 00108 /* CONSTRUCTORS */ 00109 /*============================================================*/ 00110 00112 00114 vuGrid(); 00115 00116 /*============================================================*/ 00117 00119 00121 vuGrid(const vuGrid& v); 00122 00123 /*============================================================*/ 00124 00126 00128 vuGrid(float width, float height, float depth); 00129 00130 /*============================================================*/ 00131 00133 00135 vuGrid(float width, float height, float depth, bool isGrid); 00136 00137 /*============================================================*/ 00138 00140 00142 ~vuGrid(); 00143 00144 /*============================================================*/ 00145 /* MUTATORS */ 00146 /*============================================================*/ 00147 00149 00151 vuGrid& operator=(const vuGrid& v); 00152 00153 /*============================================================*/ 00154 00156 00158 void enable(); 00159 00160 /*============================================================*/ 00161 00163 00165 void disable(); 00166 00167 /*============================================================*/ 00168 00170 00172 void toggle(); 00173 00174 /*============================================================*/ 00175 /* ACCESSORS */ 00176 /*============================================================*/ 00177 00179 00181 float getWidth() const; 00182 00183 /*============================================================*/ 00184 00186 00188 float getHeight() const; 00189 00190 /*============================================================*/ 00191 00193 00195 float getDepth() const; 00196 00197 /*============================================================*/ 00198 00200 00202 bool getStatus() const; 00203 00204 /*============================================================*/ 00205 00207 00209 float getCenterX() const; 00210 00211 /*============================================================*/ 00212 00214 00216 float getCenterY() const; 00217 00218 /*============================================================*/ 00219 00221 00223 float getCenterZ() const; 00224 00225 /*============================================================*/ 00226 00228 00230 bool operator==(const vuGrid& v) const; 00231 00232 /*============================================================*/ 00233 00235 00237 bool operator!=(const vuGrid& v) const; 00238 00239 /*============================================================*/ 00240 00242 00244 void drawLine(vuVector& start, vuVector& end) const; 00245 00246 /*============================================================*/ 00247 00249 00251 void labelAxes() const; 00252 00253 /*============================================================*/ 00254 00256 00258 void drawAxes() const; 00259 00260 /*============================================================*/ 00261 00263 00268 void drawInOpenGL() const; 00269 00270 /*============================================================*/ 00271 /* Friend Functions */ 00272 /*============================================================*/ 00273 00275 00277 friend ostream& operator<<(ostream& out, const vuGrid& t); 00278 }; 00279 00280 /*============================================================*/ 00281 00282 typedef vuGrid* vuGridPointer; 00283 typedef vuGridPointer* vuGridPointerArray; 00284 00285 #endif