Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CellProjector.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           CellProjection.h  -  description
00003                              -------------------
00004     begin                : Thu May 1 2003
00005     copyright            : (C) 2003 by tmeng
00006     email                : tmeng@sfu.ca
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef _vu111211a_H_ //SimpleFVR was vu1112119, so 'a' is used for CellProjection
00019 #define _vu111211a_H_ //as specified by the coding conventions.
00020 
00021 //----------------------------------------------------------------------------
00022 
00023 #include "../intensity.h" //for inheritance.
00024 #include "vuImage.h" //for m_ImgBuffer
00025 #include "vuVector.h" //for m_View
00026 #include "vuGrid.h"
00027 
00028 //----------------------------------------------------------------------------
00029 
00031 
00035 enum DebugEnum { NORMAL, MANUAL_TET, ANIMATE_TET_ORDER, ANIMATE_VOXEL_ORDER }; 
00036 
00038 enum SubdivEnum { FIVE_FOLD, SIX_FOLD };
00039 
00040 //----------------------------------------------------------------------------
00041 
00042 class vu111211a;
00043 //forward declaration for friend, can be omitted, but then next line has to go to end of file.
00044 typedef vu111211a vuVolumeRegularUnimodal3d1B1CellProjector;
00045 
00047 
00052 class vuCellProjector; //forward declaration for friend so no need to include.
00053 class vu111211a : public vu111211
00054 {
00055 friend class vuCellProjector;
00056 
00057  public:
00058   
00060   vu111211a();
00061   
00063   vu111211a(const vu111211a& inst);
00064   
00066   /*virtual*/ ~vu111211a();
00067 
00069   vu111211a& operator=(const vu111211a& rhs);
00070 
00071  public:
00072    
00074   /*virtual*/ void setViewVectors(const vuVector& view,const vuVector& up,const vuVector& right);
00075 
00077   /* 
00078      This doesn't seem like a virtual function (by searching in kdevelop).
00079      If it is a virtual function or will become one, make sure the "const"
00080      matches the parent function.
00081   */
00082   void initOpenGL() const;
00083   
00085 
00089   /*virtual*/ void render();
00090 
00093   /* 
00094      This doesn't seem like a virtual function (by searching in kdevelop).
00095      If it is a virtual function or will become one, make sure the "const"
00096      matches the parent function.
00097   */
00098   void drawPic() const;
00099 
00101   /* 
00102      This doesn't seem like a virtual function (by searching in kdevelop).
00103      If it is a virtual function or will become one, make sure the the scope
00104      and qualifiers of this function matches the parent function.
00105   */
00106   vuImage* getBuffer();
00107 
00109   /*virtual*/ bool read();
00110 
00112   /*
00113     I did a search in Kdevelop, and this function seems not to have been
00114     used. When it is used, it should be implemented as a virtual function
00115     in a level above and the virtual keyword here should be commented out.
00116    */
00117   virtual bool readRaw();
00118 
00119  private:
00120   
00122   void drawVoxelsSorted() const;
00123 
00125   void drawVoxelsUnsorted() const;
00126   
00128   void drawVoxel(int x, int y, int z) const;
00129 
00131 
00134   void drawTet(const int TET_RELATIVE_INDICES[4], const int VOXEL_ORIGIN[3]) const;
00135 
00137 
00158   void drawTet(int tetVertexLocations[4][3]) const;
00159 
00161   /*
00162     A triangle has 3 vertices, each with 3 locations.
00163    */
00164   void drawTetNormals(int tetVertexLocations[4][3]) const;
00165  
00167   void getTetOrientation(int tetVertexLocations[4][3], 
00168                          char orientation[4] /* out */) const;
00169 
00171   void getTetNormals(int tetVertexLocations[4][3], 
00172                      vuVector normals[4] /* out */) const;
00173  
00175   vuVector getNormal(vuVector* v[3]) const;
00176 
00178   byte getIntensity(int vertex[3]) const;
00179 
00181   void initGrid();
00182 
00190   void writeImgBuffer();
00191 
00192  private: //for vuVolume
00193 
00195   vuImage m_ImgBuffer;
00196    
00199   vuVector m_View;
00200 
00201  private: //for CellProjector
00202 
00204 
00208   DebugEnum m_state;
00209 
00211   SubdivEnum m_subdivScheme;
00212 
00214   bool m_isSort;
00215 
00217   bool m_isRender;
00218 
00220 
00223   int m_tetIndex;
00224 
00226   vuGrid m_grid;
00227 
00228  private: //class constants
00229 
00231   static const int TETS_DEF_5_FOLD[10][4];
00232 
00234   static const int TETS_DEF_6_FOLD[6][4];
00235 
00237   static const int TRIANGLE_DEF[4][3];
00238 
00240   static const int VOXEL_VERTEX_LOCATIONS[8][3];
00241 };
00242 
00243 #endif

Generated on Wed Dec 15 21:20:28 2004 for vuVolume by  doxygen 1.3.9.1