Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

app-gregor/cube.hh
Go to the documentation of this file.
00001 /* The surface of a cube
00002  */
00003 
00004 #ifndef cube_hh
00005 #define cube_hh
00006 
00007 #include "geometry.hh"
00008 
00009 
00010 // **************************************************************** Cube **
00011 
00014 class Cube : public concepts::Mesh2 {
00015   static const uint ncell_ = 12;
00016  
00017   class S : public concepts::Scan2 {
00018     uint                 idx_;
00019     concepts::Triangle3d *(&cell_)[ncell_];
00020   
00021    public:
00022     inline S(concepts::Triangle3d *(&cell)[ncell_]) : idx_(0), cell_(cell) {}
00023     inline S(const S &scan) : idx_(scan.idx_), cell_(scan.cell_) {}
00024     
00025     inline bool eos() const {return idx_ == ncell_;}
00026     inline concepts::Cell2& operator++(int) {return *cell_[idx_++];}
00027 
00028     inline concepts::Scan2* clone() const {return new S(*this);}
00029   };
00030 
00031   concepts::Vertex   *vtx_[8];
00032   concepts::Edge     *edg_[18];
00033   concepts::Triangle *tri_[ncell_];
00034 
00035   concepts::Triangle3d *cell_[ncell_];
00036 
00037  public:
00038   Cube();
00039   virtual ~Cube();
00040 
00041   inline uint ncell() const {return ncell_;}
00042   inline concepts::Scan2* scan() {return new S(cell_);}
00043 };
00044 
00045 #endif // cube_hh

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)