00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 class const_face_iterator;
00026 class const_edge_iterator;
00027 class const_vertex_iterator;
00028
00030 class face_iterator : public std::iterator<std::forward_iterator_tag, Face*>
00031 {
00032 public:
00033 friend class const_face_iterator;
00034 face_iterator(const Polyhedron* p, unsigned f) : _base(p), _here(f) {}
00035
00036 Face* operator*() { return _base->_faces[_here]; }
00037 void operator++() { ++_here; }
00038 void operator++(int) { ++_here; }
00039 bool operator==(const face_iterator& fi) const { return _here==fi._here && _base==fi._base; }
00040 bool operator!=(const face_iterator& fi) const { return !(*this == fi); }
00041
00042 protected:
00043 const Polyhedron* _base;
00044 unsigned _here;
00045 };
00046
00048 class const_face_iterator : public std::iterator<std::forward_iterator_tag, const Face*>
00049 {
00050 public:
00051 const_face_iterator(const Polyhedron* p, unsigned f) : _base(p), _here(f) {}
00052 const_face_iterator(const face_iterator& f) : _base(f._base), _here(f._here) {}
00053
00054 const Face* operator*() const { return _base->_faces[_here]; }
00055 void operator++() { ++_here; }
00056 void operator++(int) { ++_here; }
00057 bool operator==(const const_face_iterator& fi) const { return _here==fi._here && _base==fi._base; }
00058 bool operator!=(const const_face_iterator& fi) const { return !(*this == fi); }
00059
00060 protected:
00061 const Polyhedron* _base;
00062 unsigned _here;
00063 };
00064
00065 face_iterator fBegin() { return face_iterator(this, 0); }
00066 face_iterator fEnd() { return face_iterator(this, numFaces()); }
00067
00068 const_face_iterator fBegin() const { return const_face_iterator(this, 0); }
00070 const_face_iterator fEnd() const { return const_face_iterator(this, numFaces()); }
00071
00072
00073
00075 class edge_iterator
00076 {
00077 public:
00078 friend class const_edge_iterator;
00079 edge_iterator(const Polyhedron* p, unsigned e) : _base(p), _here(e) {}
00080
00081 HalfEdge* operator*() { return _base->_halfEdges[_here]; }
00082 void operator++() { ++_here; }
00083 void operator++(int) { ++_here; }
00084 bool operator==(const edge_iterator& ei) const { return _here==ei._here && _base==ei._base; }
00085 bool operator!=(const edge_iterator& ei) const { return !(*this == ei); }
00086
00087 protected:
00088 const Polyhedron* _base;
00089 unsigned _here;
00090 };
00091
00093 class const_edge_iterator
00094 {
00095 public:
00096 const_edge_iterator(const Polyhedron* p, unsigned e) : _base(p), _here(e) {}
00097 const_edge_iterator(const edge_iterator& e) : _base(e._base), _here(e._here) {}
00098
00099 const HalfEdge* operator*() const { return _base->_halfEdges[_here]; }
00100 void operator++() { ++_here; }
00101 void operator++(int) { ++_here; }
00102 bool operator==(const const_edge_iterator& ei) const { return _here==ei._here && _base==ei._base; }
00103 bool operator!=(const const_edge_iterator& ei) const { return !(*this == ei); }
00104
00105 protected:
00106 const Polyhedron* _base;
00107 unsigned _here;
00108 };
00109 edge_iterator eBegin() { return edge_iterator(this, 0); }
00110 edge_iterator eEnd() { return edge_iterator(this, numHalfEdges()); }
00111
00113 const_edge_iterator eBegin() const { return const_edge_iterator(this, 0); }
00115 const_edge_iterator eEnd() const { return const_edge_iterator(this, numHalfEdges()); }
00116
00117
00119 class vertex_iterator
00120 {
00121 public:
00122 friend class const_vertex_iterator;
00123 vertex_iterator(const Polyhedron* p, unsigned v) : _base(p), _here(v) {}
00124
00125 Vertex* operator*() { return _base->_vertices[_here]; }
00126 void operator++() { ++_here; }
00127 void operator++(int) { ++_here; }
00128 bool operator==(const vertex_iterator& vi) const { return _here==vi._here && _base==vi._base; }
00129 bool operator!=(const vertex_iterator& vi) const { return !(*this == vi); }
00130
00131 protected:
00132 const Polyhedron* _base;
00133 unsigned _here;
00134 };
00135
00137 class const_vertex_iterator
00138 {
00139 public:
00140 const_vertex_iterator(const Polyhedron* p, unsigned v) : _base(p), _here(v) {}
00141 const_vertex_iterator(const vertex_iterator& v) : _base(v._base), _here(v._here) {}
00142
00143 const Vertex* operator*() { return _base->_vertices[_here]; }
00144 void operator++() { ++_here; }
00145 void operator++(int) { ++_here; }
00146 bool operator==(const const_vertex_iterator& vi) const { return _here==vi._here && _base==vi._base; }
00147 bool operator!=(const const_vertex_iterator& vi) const { return !(*this == vi); }
00148
00149 protected:
00150 const Polyhedron* _base;
00151 unsigned _here;
00152 };
00153
00154 vertex_iterator vBegin() { return vertex_iterator(this, 0); }
00155 vertex_iterator vEnd() { return vertex_iterator(this, numVertices()); }
00156
00158 const_vertex_iterator vBegin() const { return const_vertex_iterator(this, 0); }
00159
00161 const_vertex_iterator vEnd() const { return const_vertex_iterator(this, numVertices()); }
00162