00001 00002 #ifndef origamicube2d_hh 00003 #define origamicube2d_hh 00004 00005 #include "basics/typedefs.hh" 00006 #include "geometry/mesh.hh" 00007 #include "geometry/topology.hh" 00008 #include "geometry/cell2D.hh" 00009 00010 namespace concepts { 00011 00012 /* 00013 Simple Origami Cube with ahesive surfaces on each side of the Cube. 00014 */ 00015 00016 class OrigamiCube2D : public Mesh2 { 00017 static const uint ncell_ = 6; 00018 public: 00019 OrigamiCube2D(); 00022 OrigamiCube2D(Array<uint> attrib); 00023 virtual ~OrigamiCube2D(); 00024 00025 inline uint ncell() const { return ncell_; } 00026 inline Scan2* scan() { return new S(cell_); } 00027 00028 virtual std::ostream& info(std::ostream& os) const; 00029 private: 00030 class S : public Scan<Cell2> { 00031 uint idx_; 00032 Quad2d *(&cell_)[ncell_]; 00033 public: 00034 inline S(Quad2d *(&cell)[ncell_]) : idx_(0), cell_(cell) {} 00035 inline S(const S &scan) : idx_(scan.idx_), cell_(scan.cell_) {} 00036 00037 inline bool eos() const { return idx_ == ncell_; } 00038 inline Cell2& operator++(int) { return *cell_[idx_++]; } 00039 00040 inline Scan2* clone() const { return new S(*this); } 00041 }; 00042 00043 void construct_(const Array<uint>& attrib); 00044 00045 00046 Vertex* vtx_[14]; 00047 Edge* edg_[19]; 00048 Quad* quad_[ncell_]; 00049 00050 Quad2d* cell_[ncell_]; 00051 }; 00052 00053 } // namespace concepts 00054 00055 #endif // square_hh