Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

CirculatorsT.hh

00001 /*===========================================================================*\
00002  *                                                                           *
00003  *                               OpenMesh                                    *
00004  *      Copyright (C) 2001-2005 by Computer Graphics Group, RWTH Aachen      *
00005  *                           www.openmesh.org                                *
00006  *                                                                           *
00007  *---------------------------------------------------------------------------* 
00008  *                                                                           *
00009  *                                License                                    *
00010  *                                                                           *
00011  *  This library is free software; you can redistribute it and/or modify it  *
00012  *  under the terms of the GNU Library General Public License as published   *
00013  *  by the Free Software Foundation, version 2.                              *
00014  *                                                                           *
00015  *  This library is distributed in the hope that it will be useful, but      *
00016  *  WITHOUT ANY WARRANTY; without even the implied warranty of               *
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        *
00018  *  Library General Public License for more details.                         *
00019  *                                                                           *
00020  *  You should have received a copy of the GNU Library General Public        *
00021  *  License along with this library; if not, write to the Free Software      *
00022  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                *
00023  *                                                                           *
00024 \*===========================================================================*/
00025 #ifndef OPENMESH_CIRCULATORS_HH
00026 #define OPENMESH_CIRCULATORS_HH
00027 //=============================================================================
00028 //
00029 //  Vertex and Face circulators for PolyMesh/TriMesh
00030 //
00031 //=============================================================================
00032 
00033 
00034 
00035 //== INCLUDES =================================================================
00036 
00037 #include <OpenMesh/Core/System/config.hh>
00038 #include <assert.h>
00039 
00040 
00041 //== NAMESPACES ===============================================================
00042 
00043 namespace OpenMesh {
00044 namespace Iterators {
00045 
00046 
00047 //== FORWARD DECLARATIONS =====================================================
00048 
00049 
00050 template <class Mesh> class VertexVertexIterT;
00051 template <class Mesh> class VertexIHalfedgeIterT;
00052 template <class Mesh> class VertexOHalfedgeIterT;
00053 template <class Mesh> class VertexEdgeIterT;
00054 template <class Mesh> class VertexFaceIterT;
00055 
00056 template <class Mesh> class ConstVertexVertexIterT;
00057 template <class Mesh> class ConstVertexIHalfedgeIterT;
00058 template <class Mesh> class ConstVertexOHalfedgeIterT;
00059 template <class Mesh> class ConstVertexEdgeIterT;
00060 template <class Mesh> class ConstVertexFaceIterT;
00061 
00062 template <class Mesh> class FaceVertexIterT;
00063 template <class Mesh> class FaceHalfedgeIterT;
00064 template <class Mesh> class FaceEdgeIterT;
00065 template <class Mesh> class FaceFaceIterT;
00066 
00067 template <class Mesh> class ConstFaceVertexIterT;
00068 template <class Mesh> class ConstFaceHalfedgeIterT;
00069 template <class Mesh> class ConstFaceEdgeIterT;
00070 template <class Mesh> class ConstFaceFaceIterT;
00071 
00072 
00073 
00074 //== CLASS DEFINITION =========================================================
00075 
00076               
00081 template <class Mesh>
00082 class VertexVertexIterT
00083 {
00084  public:
00085 
00086 
00087   //--- Typedefs ---
00088 
00089   typedef typename Mesh::HalfedgeHandle   HalfedgeHandle;
00090 
00091   typedef typename Mesh::Vertex           value_type;
00092   typedef typename Mesh::VertexHandle         value_handle;
00093 
00094 #if 0
00095   typedef const Mesh&         mesh_ref;
00096   typedef const Mesh*         mesh_ptr;
00097   typedef const typename Mesh::Vertex&   reference;
00098   typedef const typename Mesh::Vertex*   pointer;
00099 #else
00100   typedef Mesh&               mesh_ref;
00101   typedef Mesh*               mesh_ptr;
00102   typedef typename Mesh::Vertex&         reference;
00103   typedef typename Mesh::Vertex*         pointer;
00104 #endif
00105 
00106 
00107 
00109   VertexVertexIterT() : mesh_(0), active_(false) {}
00110 
00111 
00113   VertexVertexIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
00114     mesh_(&_mesh), 
00115     start_(_mesh.halfedge_handle(_start)),
00116     heh_(start_),
00117     active_(false)
00118   {  ; }
00119 
00120 
00122   VertexVertexIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
00123     mesh_(&_mesh),
00124     start_(_heh),
00125     heh_(_heh),
00126     active_(false)
00127   {  ; }
00128 
00129 
00131   VertexVertexIterT(const VertexVertexIterT& _rhs) :
00132     mesh_(_rhs.mesh_),
00133     start_(_rhs.start_),
00134     heh_(_rhs.heh_),
00135     active_(_rhs.active_)
00136   {  ; }
00137 
00138 
00140   VertexVertexIterT& operator=(const VertexVertexIterT<Mesh>& _rhs)
00141   {
00142     mesh_   = _rhs.mesh_;
00143     start_  = _rhs.start_;
00144     heh_    = _rhs.heh_;
00145     active_ = _rhs.active_;
00146     return *this;
00147   }
00148 
00149 
00150 #if 0
00151 
00152   VertexVertexIterT(const VertexVertexIterT<Mesh>& _rhs) :
00153     mesh_(_rhs.mesh_),
00154     start_(_rhs.start_),
00155     heh_(_rhs.heh_),
00156     active_(_rhs.active_)
00157   {  ; }
00158 
00159 
00161   VertexVertexIterT& operator=(const VertexVertexIterT<Mesh>& _rhs)
00162   {
00163     mesh_   = _rhs.mesh_;
00164     start_  = _rhs.start_;
00165     heh_    = _rhs.heh_;
00166     active_ = _rhs.active_;
00167     return *this;
00168   }
00169 #else
00170   friend class ConstVertexVertexIterT<Mesh>;
00171 #endif  
00172 
00173 
00175   bool operator==(const VertexVertexIterT& _rhs) const {
00176     return ((mesh_   == _rhs.mesh_) &&
00177             (start_  == _rhs.start_) &&
00178             (heh_    == _rhs.heh_) &&
00179             (active_ == _rhs.active_));
00180   }
00181 
00182 
00184   bool operator!=(const VertexVertexIterT& _rhs) const {
00185     return !operator==(_rhs);
00186   }
00187 
00188 
00190   VertexVertexIterT& operator++() { 
00191     assert(mesh_);
00192     active_ = true;
00193     heh_=mesh_->cw_rotated_halfedge_handle(heh_);;
00194     return *this;
00195   }
00196 
00197 
00199   VertexVertexIterT& operator--() { 
00200     assert(mesh_);
00201     active_ = true;
00202     heh_=mesh_->ccw_rotated_halfedge_handle(heh_);;
00203     return *this;
00204   }
00205 
00206 
00211   HalfedgeHandle current_halfedge_handle() const {
00212     return heh_;
00213   }
00214 
00215 
00217   typename Mesh::VertexHandle handle() const {
00218     assert(mesh_);
00219     return mesh_->to_vertex_handle(heh_);; 
00220   }
00221 
00222 
00224   operator typename Mesh::VertexHandle() const {
00225     assert(mesh_);
00226     return mesh_->to_vertex_handle(heh_);; 
00227   }
00228     
00229 
00231   reference operator*() const { 
00232     assert(mesh_);
00233     return mesh_->deref(handle());
00234   }
00235 
00236 
00238   pointer operator->() const { 
00239     assert(mesh_);
00240     return &mesh_->deref(handle());
00241   }
00242 
00243 
00250   operator bool() const { 
00251     return heh_.is_valid() && ((start_ != heh_) || (!active_));
00252   }
00253 
00254 
00255 private:
00256 
00257   mesh_ptr         mesh_;
00258   HalfedgeHandle   start_, heh_;
00259   bool             active_;
00260 };
00261 
00262 
00263 
00264 //== CLASS DEFINITION =========================================================
00265 
00266               
00271 template <class Mesh>
00272 class ConstVertexVertexIterT
00273 {
00274  public:
00275 
00276 
00277   //--- Typedefs ---
00278 
00279   typedef typename Mesh::HalfedgeHandle   HalfedgeHandle;
00280 
00281   typedef typename Mesh::Vertex           value_type;
00282   typedef typename Mesh::VertexHandle         value_handle;
00283 
00284 #if 1
00285   typedef const Mesh&         mesh_ref;
00286   typedef const Mesh*         mesh_ptr;
00287   typedef const typename Mesh::Vertex&   reference;
00288   typedef const typename Mesh::Vertex*   pointer;
00289 #else
00290   typedef Mesh&               mesh_ref;
00291   typedef Mesh*               mesh_ptr;
00292   typedef typename Mesh::Vertex&         reference;
00293   typedef typename Mesh::Vertex*         pointer;
00294 #endif
00295 
00296 
00297 
00299   ConstVertexVertexIterT() : mesh_(0), active_(false) {}
00300 
00301 
00303   ConstVertexVertexIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
00304     mesh_(&_mesh), 
00305     start_(_mesh.halfedge_handle(_start)),
00306     heh_(start_),
00307     active_(false)
00308   {  ; }
00309 
00310 
00312   ConstVertexVertexIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
00313     mesh_(&_mesh),
00314     start_(_heh),
00315     heh_(_heh),
00316     active_(false)
00317   {  ; }
00318 
00319 
00321   ConstVertexVertexIterT(const ConstVertexVertexIterT& _rhs) :
00322     mesh_(_rhs.mesh_),
00323     start_(_rhs.start_),
00324     heh_(_rhs.heh_),
00325     active_(_rhs.active_)
00326   {  ; }
00327 
00328 
00330   ConstVertexVertexIterT& operator=(const ConstVertexVertexIterT<Mesh>& _rhs)
00331   {
00332     mesh_   = _rhs.mesh_;
00333     start_  = _rhs.start_;
00334     heh_    = _rhs.heh_;
00335     active_ = _rhs.active_;
00336     return *this;
00337   }
00338 
00339 
00340 #if 1
00341 
00342   ConstVertexVertexIterT(const VertexVertexIterT<Mesh>& _rhs) :
00343     mesh_(_rhs.mesh_),
00344     start_(_rhs.start_),
00345     heh_(_rhs.heh_),
00346     active_(_rhs.active_)
00347   {  ; }
00348 
00349 
00351   ConstVertexVertexIterT& operator=(const VertexVertexIterT<Mesh>& _rhs)
00352   {
00353     mesh_   = _rhs.mesh_;
00354     start_  = _rhs.start_;
00355     heh_    = _rhs.heh_;
00356     active_ = _rhs.active_;
00357     return *this;
00358   }
00359 #else
00360   friend class ConstVertexVertexIterT<Mesh>;
00361 #endif  
00362 
00363 
00365   bool operator==(const ConstVertexVertexIterT& _rhs) const {
00366     return ((mesh_   == _rhs.mesh_) &&
00367             (start_  == _rhs.start_) &&
00368             (heh_    == _rhs.heh_) &&
00369             (active_ == _rhs.active_));
00370   }
00371 
00372 
00374   bool operator!=(const ConstVertexVertexIterT& _rhs) const {
00375     return !operator==(_rhs);
00376   }
00377 
00378 
00380   ConstVertexVertexIterT& operator++() { 
00381     assert(mesh_);
00382     active_ = true;
00383     heh_=mesh_->cw_rotated_halfedge_handle(heh_);;
00384     return *this;
00385   }
00386 
00387 
00389   ConstVertexVertexIterT& operator--() { 
00390     assert(mesh_);
00391     active_ = true;
00392     heh_=mesh_->ccw_rotated_halfedge_handle(heh_);;
00393     return *this;
00394   }
00395 
00396 
00401   HalfedgeHandle current_halfedge_handle() const {
00402     return heh_;
00403   }
00404 
00405 
00407   typename Mesh::VertexHandle handle() const {
00408     assert(mesh_);
00409     return mesh_->to_vertex_handle(heh_);; 
00410   }
00411 
00412 
00414   operator typename Mesh::VertexHandle() const {
00415     assert(mesh_);
00416     return mesh_->to_vertex_handle(heh_);; 
00417   }
00418     
00419 
00421   reference operator*() const { 
00422     assert(mesh_);
00423     return mesh_->deref(handle());
00424   }
00425 
00426 
00428   pointer operator->() const { 
00429     assert(mesh_);
00430     return &mesh_->deref(handle());
00431   }
00432 
00433 
00440   operator bool() const { 
00441     return heh_.is_valid() && ((start_ != heh_) || (!active_));
00442   }
00443 
00444 
00445 private:
00446 
00447   mesh_ptr         mesh_;
00448   HalfedgeHandle   start_, heh_;
00449   bool             active_;
00450 };
00451 
00452 
00453 
00454 //== CLASS DEFINITION =========================================================
00455 
00456               
00461 template <class Mesh>
00462 class VertexOHalfedgeIterT
00463 {
00464  public:
00465 
00466 
00467   //--- Typedefs ---
00468 
00469   typedef typename Mesh::HalfedgeHandle   HalfedgeHandle;
00470 
00471   typedef typename Mesh::Halfedge           value_type;
00472   typedef typename Mesh::HalfedgeHandle         value_handle;
00473 
00474 #if 0
00475   typedef const Mesh&         mesh_ref;
00476   typedef const Mesh*         mesh_ptr;
00477   typedef const typename Mesh::Halfedge&   reference;
00478   typedef const typename Mesh::Halfedge*   pointer;
00479 #else
00480   typedef Mesh&               mesh_ref;
00481   typedef Mesh*               mesh_ptr;
00482   typedef typename Mesh::Halfedge&         reference;
00483   typedef typename Mesh::Halfedge*         pointer;
00484 #endif
00485 
00486 
00487 
00489   VertexOHalfedgeIterT() : mesh_(0), active_(false) {}
00490 
00491 
00493   VertexOHalfedgeIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
00494     mesh_(&_mesh), 
00495     start_(_mesh.halfedge_handle(_start)),
00496     heh_(start_),
00497     active_(false)
00498   {  ; }
00499 
00500 
00502   VertexOHalfedgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
00503     mesh_(&_mesh),
00504     start_(_heh),
00505     heh_(_heh),
00506     active_(false)
00507   {  ; }
00508 
00509 
00511   VertexOHalfedgeIterT(const VertexOHalfedgeIterT& _rhs) :
00512     mesh_(_rhs.mesh_),
00513     start_(_rhs.start_),
00514     heh_(_rhs.heh_),
00515     active_(_rhs.active_)
00516   {  ; }
00517 
00518 
00520   VertexOHalfedgeIterT& operator=(const VertexOHalfedgeIterT<Mesh>& _rhs)
00521   {
00522     mesh_   = _rhs.mesh_;
00523     start_  = _rhs.start_;
00524     heh_    = _rhs.heh_;
00525     active_ = _rhs.active_;
00526     return *this;
00527   }
00528 
00529 
00530 #if 0
00531 
00532   VertexOHalfedgeIterT(const VertexOHalfedgeIterT<Mesh>& _rhs) :
00533     mesh_(_rhs.mesh_),
00534     start_(_rhs.start_),
00535     heh_(_rhs.heh_),
00536     active_(_rhs.active_)
00537   {  ; }
00538 
00539 
00541   VertexOHalfedgeIterT& operator=(const VertexOHalfedgeIterT<Mesh>& _rhs)
00542   {
00543     mesh_   = _rhs.mesh_;
00544     start_  = _rhs.start_;
00545     heh_    = _rhs.heh_;
00546     active_ = _rhs.active_;
00547     return *this;
00548   }
00549 #else
00550   friend class ConstVertexOHalfedgeIterT<Mesh>;
00551 #endif  
00552 
00553 
00555   bool operator==(const VertexOHalfedgeIterT& _rhs) const {
00556     return ((mesh_   == _rhs.mesh_) &&
00557             (start_  == _rhs.start_) &&
00558             (heh_    == _rhs.heh_) &&
00559             (active_ == _rhs.active_));
00560   }
00561 
00562 
00564   bool operator!=(const VertexOHalfedgeIterT& _rhs) const {
00565     return !operator==(_rhs);
00566   }
00567 
00568 
00570   VertexOHalfedgeIterT& operator++() { 
00571     assert(mesh_);
00572     active_ = true;
00573     heh_=mesh_->cw_rotated_halfedge_handle(heh_);;
00574     return *this;
00575   }
00576 
00577 
00579   VertexOHalfedgeIterT& operator--() { 
00580     assert(mesh_);
00581     active_ = true;
00582     heh_=mesh_->ccw_rotated_halfedge_handle(heh_);;
00583     return *this;
00584   }
00585 
00586 
00591   HalfedgeHandle current_halfedge_handle() const {
00592     return heh_;
00593   }
00594 
00595 
00597   typename Mesh::HalfedgeHandle handle() const {
00598     assert(mesh_);
00599     return heh_; 
00600   }
00601 
00602 
00604   operator typename Mesh::HalfedgeHandle() const {
00605     assert(mesh_);
00606     return heh_; 
00607   }
00608     
00609 
00611   reference operator*() const { 
00612     assert(mesh_);
00613     return mesh_->deref(handle());
00614   }
00615 
00616 
00618   pointer operator->() const { 
00619     assert(mesh_);
00620     return &mesh_->deref(handle());
00621   }
00622 
00623 
00630   operator bool() const { 
00631     return heh_.is_valid() && ((start_ != heh_) || (!active_));
00632   }
00633 
00634 
00635 private:
00636 
00637   mesh_ptr         mesh_;
00638   HalfedgeHandle   start_, heh_;
00639   bool             active_;
00640 };
00641 
00642 
00643 
00644 //== CLASS DEFINITION =========================================================
00645 
00646               
00651 template <class Mesh>
00652 class ConstVertexOHalfedgeIterT
00653 {
00654  public:
00655 
00656 
00657   //--- Typedefs ---
00658 
00659   typedef typename Mesh::HalfedgeHandle   HalfedgeHandle;
00660 
00661   typedef typename Mesh::Halfedge           value_type;
00662   typedef typename Mesh::HalfedgeHandle         value_handle;
00663 
00664 #if 1
00665   typedef const Mesh&         mesh_ref;
00666   typedef const Mesh*         mesh_ptr;
00667   typedef const typename Mesh::Halfedge&   reference;
00668   typedef const typename Mesh::Halfedge*   pointer;
00669 #else
00670   typedef Mesh&               mesh_ref;
00671   typedef Mesh*               mesh_ptr;
00672   typedef typename Mesh::Halfedge&         reference;
00673   typedef typename Mesh::Halfedge*         pointer;
00674 #endif
00675 
00676 
00677 
00679   ConstVertexOHalfedgeIterT() : mesh_(0), active_(false) {}
00680 
00681 
00683   ConstVertexOHalfedgeIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
00684     mesh_(&_mesh), 
00685     start_(_mesh.halfedge_handle(_start)),
00686     heh_(start_),
00687     active_(false)
00688   {  ; }
00689 
00690 
00692   ConstVertexOHalfedgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
00693     mesh_(&_mesh),
00694     start_(_heh),
00695     heh_(_heh),
00696     active_(false)
00697   {  ; }
00698 
00699 
00701   ConstVertexOHalfedgeIterT(const ConstVertexOHalfedgeIterT& _rhs) :
00702     mesh_(_rhs.mesh_),
00703     start_(_rhs.start_),
00704     heh_(_rhs.heh_),
00705     active_(_rhs.active_)
00706   {  ; }
00707 
00708 
00710   ConstVertexOHalfedgeIterT& operator=(const ConstVertexOHalfedgeIterT<Mesh>& _rhs)
00711   {
00712     mesh_   = _rhs.mesh_;
00713     start_  = _rhs.start_;
00714     heh_    = _rhs.heh_;
00715     active_ = _rhs.active_;
00716     return *this;
00717   }
00718 
00719 
00720 #if 1
00721 
00722   ConstVertexOHalfedgeIterT(const VertexOHalfedgeIterT<Mesh>& _rhs) :
00723     mesh_(_rhs.mesh_),
00724     start_(_rhs.start_),
00725     heh_(_rhs.heh_),
00726     active_(_rhs.active_)
00727   {  ; }
00728 
00729 
00731   ConstVertexOHalfedgeIterT& operator=(const VertexOHalfedgeIterT<Mesh>& _rhs)
00732   {
00733     mesh_   = _rhs.mesh_;
00734     start_  = _rhs.start_;
00735     heh_    = _rhs.heh_;
00736     active_ = _rhs.active_;
00737     return *this;
00738   }
00739 #else
00740   friend class ConstVertexOHalfedgeIterT<Mesh>;
00741 #endif  
00742 
00743 
00745   bool operator==(const ConstVertexOHalfedgeIterT& _rhs) const {
00746     return ((mesh_   == _rhs.mesh_) &&
00747             (start_  == _rhs.start_) &&
00748             (heh_    == _rhs.heh_) &&
00749             (active_ == _rhs.active_));
00750   }
00751 
00752 
00754   bool operator!=(const ConstVertexOHalfedgeIterT& _rhs) const {
00755     return !operator==(_rhs);
00756   }
00757 
00758 
00760   ConstVertexOHalfedgeIterT& operator++() { 
00761     assert(mesh_);
00762     active_ = true;
00763     heh_=mesh_->cw_rotated_halfedge_handle(heh_);;
00764     return *this;
00765   }
00766 
00767 
00769   ConstVertexOHalfedgeIterT& operator--() { 
00770     assert(mesh_);
00771     active_ = true;
00772     heh_=mesh_->ccw_rotated_halfedge_handle(heh_);;
00773     return *this;
00774   }
00775 
00776 
00781   HalfedgeHandle current_halfedge_handle() const {
00782     return heh_;
00783   }
00784 
00785 
00787   typename Mesh::HalfedgeHandle handle() const {
00788     assert(mesh_);
00789     return heh_; 
00790   }
00791 
00792 
00794   operator typename Mesh::HalfedgeHandle() const {
00795     assert(mesh_);
00796     return heh_; 
00797   }
00798     
00799 
00801   reference operator*() const { 
00802     assert(mesh_);
00803     return mesh_->deref(handle());
00804   }
00805 
00806 
00808   pointer operator->() const { 
00809     assert(mesh_);
00810     return &mesh_->deref(handle());
00811   }
00812 
00813 
00820   operator bool() const { 
00821     return heh_.is_valid() && ((start_ != heh_) || (!active_));
00822   }
00823 
00824 
00825 private:
00826 
00827   mesh_ptr         mesh_;
00828   HalfedgeHandle   start_, heh_;
00829   bool             active_;
00830 };
00831 
00832 
00833 
00834 //== CLASS DEFINITION =========================================================
00835 
00836               
00841 template <class Mesh>
00842 class VertexIHalfedgeIterT
00843 {
00844  public:
00845 
00846 
00847   //--- Typedefs ---
00848 
00849   typedef typename Mesh::HalfedgeHandle   HalfedgeHandle;
00850 
00851   typedef typename Mesh::Halfedge           value_type;
00852   typedef typename Mesh::HalfedgeHandle         value_handle;
00853 
00854 #if 0
00855   typedef const Mesh&         mesh_ref;
00856   typedef const Mesh*         mesh_ptr;
00857   typedef const typename Mesh::Halfedge&   reference;
00858   typedef const typename Mesh::Halfedge*   pointer;
00859 #else
00860   typedef Mesh&               mesh_ref;
00861   typedef Mesh*               mesh_ptr;
00862   typedef typename Mesh::Halfedge&         reference;
00863   typedef typename Mesh::Halfedge*         pointer;
00864 #endif
00865 
00866 
00867 
00869   VertexIHalfedgeIterT() : mesh_(0), active_(false) {}
00870 
00871 
00873   VertexIHalfedgeIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
00874     mesh_(&_mesh), 
00875     start_(_mesh.halfedge_handle(_start)),
00876     heh_(start_),
00877     active_(false)
00878   {  ; }
00879 
00880 
00882   VertexIHalfedgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
00883     mesh_(&_mesh),
00884     start_(_heh),
00885     heh_(_heh),
00886     active_(false)
00887   {  ; }
00888 
00889 
00891   VertexIHalfedgeIterT(const VertexIHalfedgeIterT& _rhs) :
00892     mesh_(_rhs.mesh_),
00893     start_(_rhs.start_),
00894     heh_(_rhs.heh_),
00895     active_(_rhs.active_)
00896   {  ; }
00897 
00898 
00900   VertexIHalfedgeIterT& operator=(const VertexIHalfedgeIterT<Mesh>& _rhs)
00901   {
00902     mesh_   = _rhs.mesh_;
00903     start_  = _rhs.start_;
00904     heh_    = _rhs.heh_;
00905     active_ = _rhs.active_;
00906     return *this;
00907   }
00908 
00909 
00910 #if 0
00911 
00912   VertexIHalfedgeIterT(const VertexIHalfedgeIterT<Mesh>& _rhs) :
00913     mesh_(_rhs.mesh_),
00914     start_(_rhs.start_),
00915     heh_(_rhs.heh_),
00916     active_(_rhs.active_)
00917   {  ; }
00918 
00919 
00921   VertexIHalfedgeIterT& operator=(const VertexIHalfedgeIterT<Mesh>& _rhs)
00922   {
00923     mesh_   = _rhs.mesh_;
00924     start_  = _rhs.start_;
00925     heh_    = _rhs.heh_;
00926     active_ = _rhs.active_;
00927     return *this;
00928   }
00929 #else
00930   friend class ConstVertexIHalfedgeIterT<Mesh>;
00931 #endif  
00932 
00933 
00935   bool operator==(const VertexIHalfedgeIterT& _rhs) const {
00936     return ((mesh_   == _rhs.mesh_) &&
00937             (start_  == _rhs.start_) &&
00938             (heh_    == _rhs.heh_) &&
00939             (active_ == _rhs.active_));
00940   }
00941 
00942 
00944   bool operator!=(const VertexIHalfedgeIterT& _rhs) const {
00945     return !operator==(_rhs);
00946   }
00947 
00948 
00950   VertexIHalfedgeIterT& operator++() { 
00951     assert(mesh_);
00952     active_ = true;
00953     heh_=mesh_->cw_rotated_halfedge_handle(heh_);;
00954     return *this;
00955   }
00956 
00957 
00959   VertexIHalfedgeIterT& operator--() { 
00960     assert(mesh_);
00961     active_ = true;
00962     heh_=mesh_->ccw_rotated_halfedge_handle(heh_);;
00963     return *this;
00964   }
00965 
00966 
00971   HalfedgeHandle current_halfedge_handle() const {
00972     return heh_;
00973   }
00974 
00975 
00977   typename Mesh::HalfedgeHandle handle() const {
00978     assert(mesh_);
00979     return mesh_->opposite_halfedge_handle(heh_); 
00980   }
00981 
00982 
00984   operator typename Mesh::HalfedgeHandle() const {
00985     assert(mesh_);
00986     return mesh_->opposite_halfedge_handle(heh_); 
00987   }
00988     
00989 
00991   reference operator*() const { 
00992     assert(mesh_);
00993     return mesh_->deref(handle());
00994   }
00995 
00996 
00998   pointer operator->() const { 
00999     assert(mesh_);
01000     return &mesh_->deref(handle());
01001   }
01002 
01003 
01010   operator bool() const { 
01011     return heh_.is_valid() && ((start_ != heh_) || (!active_));
01012   }
01013 
01014 
01015 private:
01016 
01017   mesh_ptr         mesh_;
01018   HalfedgeHandle   start_, heh_;
01019   bool             active_;
01020 };
01021 
01022 
01023 
01024 //== CLASS DEFINITION =========================================================
01025 
01026               
01031 template <class Mesh>
01032 class ConstVertexIHalfedgeIterT
01033 {
01034  public:
01035 
01036 
01037   //--- Typedefs ---
01038 
01039   typedef typename Mesh::HalfedgeHandle   HalfedgeHandle;
01040 
01041   typedef typename Mesh::Halfedge           value_type;
01042   typedef typename Mesh::HalfedgeHandle         value_handle;
01043 
01044 #if 1
01045   typedef const Mesh&         mesh_ref;
01046   typedef const Mesh*         mesh_ptr;
01047   typedef const typename Mesh::Halfedge&   reference;
01048   typedef const typename Mesh::Halfedge*   pointer;
01049 #else
01050   typedef Mesh&               mesh_ref;
01051   typedef Mesh*               mesh_ptr;
01052   typedef typename Mesh::Halfedge&         reference;
01053   typedef typename Mesh::Halfedge*         pointer;
01054 #endif
01055 
01056 
01057 
01059   ConstVertexIHalfedgeIterT() : mesh_(0), active_(false) {}
01060 
01061 
01063   ConstVertexIHalfedgeIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
01064     mesh_(&_mesh), 
01065     start_(_mesh.halfedge_handle(_start)),
01066     heh_(start_),
01067     active_(false)
01068   {  ; }
01069 
01070 
01072   ConstVertexIHalfedgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
01073     mesh_(&_mesh),
01074     start_(_heh),
01075     heh_(_heh),
01076     active_(false)
01077   {  ; }
01078 
01079 
01081   ConstVertexIHalfedgeIterT(const ConstVertexIHalfedgeIterT& _rhs) :
01082     mesh_(_rhs.mesh_),
01083     start_(_rhs.start_),
01084     heh_(_rhs.heh_),
01085     active_(_rhs.active_)
01086   {  ; }
01087 
01088 
01090   ConstVertexIHalfedgeIterT& operator=(const ConstVertexIHalfedgeIterT<Mesh>& _rhs)
01091   {
01092     mesh_   = _rhs.mesh_;
01093     start_  = _rhs.start_;
01094     heh_    = _rhs.heh_;
01095     active_ = _rhs.active_;
01096     return *this;
01097   }
01098 
01099 
01100 #if 1
01101 
01102   ConstVertexIHalfedgeIterT(const VertexIHalfedgeIterT<Mesh>& _rhs) :
01103     mesh_(_rhs.mesh_),
01104     start_(_rhs.start_),
01105     heh_(_rhs.heh_),
01106     active_(_rhs.active_)
01107   {  ; }
01108 
01109 
01111   ConstVertexIHalfedgeIterT& operator=(const VertexIHalfedgeIterT<Mesh>& _rhs)
01112   {
01113     mesh_   = _rhs.mesh_;
01114     start_  = _rhs.start_;
01115     heh_    = _rhs.heh_;
01116     active_ = _rhs.active_;
01117     return *this;
01118   }
01119 #else
01120   friend class ConstVertexIHalfedgeIterT<Mesh>;
01121 #endif  
01122 
01123 
01125   bool operator==(const ConstVertexIHalfedgeIterT& _rhs) const {
01126     return ((mesh_   == _rhs.mesh_) &&
01127             (start_  == _rhs.start_) &&
01128             (heh_    == _rhs.heh_) &&
01129             (active_ == _rhs.active_));
01130   }
01131 
01132 
01134   bool operator!=(const ConstVertexIHalfedgeIterT& _rhs) const {
01135     return !operator==(_rhs);
01136   }
01137 
01138 
01140   ConstVertexIHalfedgeIterT& operator++() { 
01141     assert(mesh_);
01142     active_ = true;
01143     heh_=mesh_->cw_rotated_halfedge_handle(heh_);;
01144     return *this;
01145   }
01146 
01147 
01149   ConstVertexIHalfedgeIterT& operator--() { 
01150     assert(mesh_);
01151     active_ = true;
01152     heh_=mesh_->ccw_rotated_halfedge_handle(heh_);;
01153     return *this;
01154   }
01155 
01156 
01161   HalfedgeHandle current_halfedge_handle() const {
01162     return heh_;
01163   }
01164 
01165 
01167   typename Mesh::HalfedgeHandle handle() const {
01168     assert(mesh_);
01169     return mesh_->opposite_halfedge_handle(heh_); 
01170   }
01171 
01172 
01174   operator typename Mesh::HalfedgeHandle() const {
01175     assert(mesh_);
01176     return mesh_->opposite_halfedge_handle(heh_); 
01177   }
01178     
01179 
01181   reference operator*() const { 
01182     assert(mesh_);
01183     return mesh_->deref(handle());
01184   }
01185 
01186 
01188   pointer operator->() const { 
01189     assert(mesh_);
01190     return &mesh_->deref(handle());
01191   }
01192 
01193 
01200   operator bool() const { 
01201     return heh_.is_valid() && ((start_ != heh_) || (!active_));
01202   }
01203 
01204 
01205 private:
01206 
01207   mesh_ptr         mesh_;
01208   HalfedgeHandle   start_, heh_;
01209   bool             active_;
01210 };
01211 
01212 
01213 
01214 //== CLASS DEFINITION =========================================================
01215 
01216               
01221 template <class Mesh>
01222 class VertexEdgeIterT
01223 {
01224  public:
01225 
01226 
01227   //--- Typedefs ---
01228 
01229   typedef typename Mesh::HalfedgeHandle   HalfedgeHandle;
01230 
01231   typedef typename Mesh::Edge           value_type;
01232   typedef typename Mesh::EdgeHandle         value_handle;
01233 
01234 #if 0
01235   typedef const Mesh&         mesh_ref;
01236   typedef const Mesh*         mesh_ptr;
01237   typedef const typename Mesh::Edge&   reference;
01238   typedef const typename Mesh::Edge*   pointer;
01239 #else
01240   typedef Mesh&               mesh_ref;
01241   typedef Mesh*               mesh_ptr;
01242   typedef typename Mesh::Edge&         reference;
01243   typedef typename Mesh::Edge*         pointer;
01244 #endif
01245 
01246 
01247 
01249   VertexEdgeIterT() : mesh_(0), active_(false) {}
01250 
01251 
01253   VertexEdgeIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
01254     mesh_(&_mesh), 
01255     start_(_mesh.halfedge_handle(_start)),
01256     heh_(start_),
01257     active_(false)
01258   {  ; }
01259 
01260 
01262   VertexEdgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
01263     mesh_(&_mesh),
01264     start_(_heh),
01265     heh_(_heh),
01266     active_(false)
01267   {  ; }
01268 
01269 
01271   VertexEdgeIterT(const VertexEdgeIterT& _rhs) :
01272     mesh_(_rhs.mesh_),
01273     start_(_rhs.start_),
01274     heh_(_rhs.heh_),
01275     active_(_rhs.active_)
01276   {  ; }
01277 
01278 
01280   VertexEdgeIterT& operator=(const VertexEdgeIterT<Mesh>& _rhs)
01281   {
01282     mesh_   = _rhs.mesh_;
01283     start_  = _rhs.start_;
01284     heh_    = _rhs.heh_;
01285     active_ = _rhs.active_;
01286     return *this;
01287   }
01288 
01289 
01290 #if 0
01291 
01292   VertexEdgeIterT(const VertexEdgeIterT<Mesh>& _rhs) :
01293     mesh_(_rhs.mesh_),
01294     start_(_rhs.start_),
01295     heh_(_rhs.heh_),
01296     active_(_rhs.active_)
01297   {  ; }
01298 
01299 
01301   VertexEdgeIterT& operator=(const VertexEdgeIterT<Mesh>& _rhs)
01302   {
01303     mesh_   = _rhs.mesh_;
01304     start_  = _rhs.start_;
01305     heh_    = _rhs.heh_;
01306     active_ = _rhs.active_;
01307     return *this;
01308   }
01309 #else
01310   friend class ConstVertexEdgeIterT<Mesh>;
01311 #endif  
01312 
01313 
01315   bool operator==(const VertexEdgeIterT& _rhs) const {
01316     return ((mesh_   == _rhs.mesh_) &&
01317             (start_  == _rhs.start_) &&
01318             (heh_    == _rhs.heh_) &&
01319             (active_ == _rhs.active_));
01320   }
01321 
01322 
01324   bool operator!=(const VertexEdgeIterT& _rhs) const {
01325     return !operator==(_rhs);
01326   }
01327 
01328 
01330   VertexEdgeIterT& operator++() { 
01331     assert(mesh_);
01332     active_ = true;
01333     heh_=mesh_->cw_rotated_halfedge_handle(heh_);;
01334     return *this;
01335   }
01336 
01337 
01339   VertexEdgeIterT& operator--() { 
01340     assert(mesh_);
01341     active_ = true;
01342     heh_=mesh_->ccw_rotated_halfedge_handle(heh_);;
01343     return *this;
01344   }
01345 
01346 
01351   HalfedgeHandle current_halfedge_handle() const {
01352     return heh_;
01353   }
01354 
01355 
01357   typename Mesh::EdgeHandle handle() const {
01358     assert(mesh_);
01359     return mesh_->edge_handle(heh_); 
01360   }
01361 
01362 
01364   operator typename Mesh::EdgeHandle() const {
01365     assert(mesh_);
01366     return mesh_->edge_handle(heh_); 
01367   }
01368     
01369 
01371   reference operator*() const { 
01372     assert(mesh_);
01373     return mesh_->deref(handle());
01374   }
01375 
01376 
01378   pointer operator->() const { 
01379     assert(mesh_);
01380     return &mesh_->deref(handle());
01381   }
01382 
01383 
01390   operator bool() const { 
01391     return heh_.is_valid() && ((start_ != heh_) || (!active_));
01392   }
01393 
01394 
01395 private:
01396 
01397   mesh_ptr         mesh_;
01398   HalfedgeHandle   start_, heh_;
01399   bool             active_;
01400 };
01401 
01402 
01403 
01404 //== CLASS DEFINITION =========================================================
01405 
01406               
01411 template <class Mesh>
01412 class ConstVertexEdgeIterT
01413 {
01414  public:
01415 
01416 
01417   //--- Typedefs ---
01418 
01419   typedef typename Mesh::HalfedgeHandle   HalfedgeHandle;
01420 
01421   typedef typename Mesh::Edge           value_type;
01422   typedef typename Mesh::EdgeHandle         value_handle;
01423 
01424 #if 1
01425   typedef const Mesh&         mesh_ref;
01426   typedef const Mesh*         mesh_ptr;
01427   typedef const typename Mesh::Edge&   reference;
01428   typedef const typename Mesh::Edge*   pointer;
01429 #else
01430   typedef Mesh&               mesh_ref;
01431   typedef Mesh*               mesh_ptr;
01432   typedef typename Mesh::Edge&         reference;
01433   typedef typename Mesh::Edge*         pointer;
01434 #endif
01435 
01436 
01437 
01439   ConstVertexEdgeIterT() : mesh_(0), active_(false) {}
01440 
01441 
01443   ConstVertexEdgeIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
01444     mesh_(&_mesh), 
01445     start_(_mesh.halfedge_handle(_start)),
01446     heh_(start_),
01447     active_(false)
01448   {  ; }
01449 
01450 
01452   ConstVertexEdgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
01453     mesh_(&_mesh),
01454     start_(_heh),
01455     heh_(_heh),
01456     active_(false)
01457   {  ; }
01458 
01459 
01461   ConstVertexEdgeIterT(const ConstVertexEdgeIterT& _rhs) :
01462     mesh_(_rhs.mesh_),
01463     start_(_rhs.start_),
01464     heh_(_rhs.heh_),
01465     active_(_rhs.active_)
01466   {  ; }
01467 
01468 
01470   ConstVertexEdgeIterT& operator=(const ConstVertexEdgeIterT<Mesh>& _rhs)
01471   {
01472     mesh_   = _rhs.mesh_;
01473     start_  = _rhs.start_;
01474     heh_    = _rhs.heh_;
01475     active_ = _rhs.active_;
01476     return *this;
01477   }
01478 
01479 
01480 #if 1
01481 
01482   ConstVertexEdgeIterT(const VertexEdgeIterT<Mesh>& _rhs) :
01483     mesh_(_rhs.mesh_),
01484     start_(_rhs.start_),
01485     heh_(_rhs.heh_),
01486     active_(_rhs.active_)
01487   {  ; }
01488 
01489 
01491   ConstVertexEdgeIterT& operator=(const VertexEdgeIterT<Mesh>& _rhs)
01492   {
01493     mesh_   = _rhs.mesh_;
01494     start_  = _rhs.start_;
01495     heh_    = _rhs.heh_;
01496     active_ = _rhs.active_;
01497     return *this;
01498   }
01499 #else
01500   friend class ConstVertexEdgeIterT<Mesh>;
01501 #endif  
01502 
01503 
01505   bool operator==(const ConstVertexEdgeIterT& _rhs) const {
01506     return ((mesh_   == _rhs.mesh_) &&
01507             (start_  == _rhs.start_) &&
01508             (heh_    == _rhs.heh_) &&
01509             (active_ == _rhs.active_));
01510   }
01511 
01512 
01514   bool operator!=(const ConstVertexEdgeIterT& _rhs) const {
01515     return !operator==(_rhs);
01516   }
01517 
01518 
01520   ConstVertexEdgeIterT& operator++() { 
01521     assert(mesh_);
01522     active_ = true;
01523     heh_=mesh_->cw_rotated_halfedge_handle(heh_);;
01524     return *this;
01525   }
01526 
01527 
01529   ConstVertexEdgeIterT& operator--() { 
01530     assert(mesh_);
01531     active_ = true;
01532     heh_=mesh_->ccw_rotated_halfedge_handle(heh_);;
01533     return *this;
01534   }
01535 
01536 
01541   HalfedgeHandle current_halfedge_handle() const {
01542     return heh_;
01543   }
01544 
01545 
01547   typename Mesh::EdgeHandle handle() const {
01548     assert(mesh_);
01549     return mesh_->edge_handle(heh_); 
01550   }
01551 
01552 
01554   operator typename Mesh::EdgeHandle() const {
01555     assert(mesh_);
01556     return mesh_->edge_handle(heh_); 
01557   }
01558     
01559 
01561   reference operator*() const { 
01562     assert(mesh_);
01563     return mesh_->deref(handle());
01564   }
01565 
01566 
01568   pointer operator->() const { 
01569     assert(mesh_);
01570     return &mesh_->deref(handle());
01571   }
01572 
01573 
01580   operator bool() const { 
01581     return heh_.is_valid() && ((start_ != heh_) || (!active_));
01582   }
01583 
01584 
01585 private:
01586 
01587   mesh_ptr         mesh_;
01588   HalfedgeHandle   start_, heh_;
01589   bool             active_;
01590 };
01591 
01592 
01593 
01594 //== CLASS DEFINITION =========================================================
01595 
01596               
01601 template <class Mesh>
01602 class VertexFaceIterT
01603 {
01604  public:
01605 
01606 
01607   //--- Typedefs ---
01608 
01609   typedef typename Mesh::HalfedgeHandle   HalfedgeHandle;
01610 
01611   typedef typename Mesh::Face           value_type;
01612   typedef typename Mesh::FaceHandle         value_handle;
01613 
01614 #if 0
01615   typedef const Mesh&         mesh_ref;
01616   typedef const Mesh*         mesh_ptr;
01617   typedef const typename Mesh::Face&   reference;
01618   typedef const typename Mesh::Face*   pointer;
01619 #else
01620   typedef Mesh&               mesh_ref;
01621   typedef Mesh*               mesh_ptr;
01622   typedef typename Mesh::Face&         reference;
01623   typedef typename Mesh::Face*         pointer;
01624 #endif
01625 
01626 
01627 
01629   VertexFaceIterT() : mesh_(0), active_(false) {}
01630 
01631 
01633   VertexFaceIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
01634     mesh_(&_mesh), 
01635     start_(_mesh.halfedge_handle(_start)),
01636     heh_(start_),
01637     active_(false)
01638   { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
01639 
01640 
01642   VertexFaceIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
01643     mesh_(&_mesh),
01644     start_(_heh),
01645     heh_(_heh),
01646     active_(false)
01647   { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
01648 
01649 
01651   VertexFaceIterT(const VertexFaceIterT& _rhs) :
01652     mesh_(_rhs.mesh_),
01653     start_(_rhs.start_),
01654     heh_(_rhs.heh_),
01655     active_(_rhs.active_)
01656   { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
01657 
01658 
01660   VertexFaceIterT& operator=(const VertexFaceIterT<Mesh>& _rhs)
01661   {
01662     mesh_   = _rhs.mesh_;
01663     start_  = _rhs.start_;
01664     heh_    = _rhs.heh_;
01665     active_ = _rhs.active_;
01666     return *this;
01667   }
01668 
01669 
01670 #if 0
01671 
01672   VertexFaceIterT(const VertexFaceIterT<Mesh>& _rhs) :
01673     mesh_(_rhs.mesh_),
01674     start_(_rhs.start_),
01675     heh_(_rhs.heh_),
01676     active_(_rhs.active_)
01677   { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
01678 
01679 
01681   VertexFaceIterT& operator=(const VertexFaceIterT<Mesh>& _rhs)
01682   {
01683     mesh_   = _rhs.mesh_;
01684     start_  = _rhs.start_;
01685     heh_    = _rhs.heh_;
01686     active_ = _rhs.active_;
01687     return *this;
01688   }
01689 #else
01690   friend class ConstVertexFaceIterT<Mesh>;
01691 #endif  
01692 
01693 
01695   bool operator==(const VertexFaceIterT& _rhs) const {
01696     return ((mesh_   == _rhs.mesh_) &&
01697             (start_  == _rhs.start_) &&
01698             (heh_    == _rhs.heh_) &&
01699             (active_ == _rhs.active_));
01700   }
01701 
01702 
01704   bool operator!=(const VertexFaceIterT& _rhs) const {
01705     return !operator==(_rhs);
01706   }
01707 
01708 
01710   VertexFaceIterT& operator++() { 
01711     assert(mesh_);
01712     active_ = true;
01713     do heh_=mesh_->cw_rotated_halfedge_handle(heh_);  while ((*this) && (!handle().is_valid()));;
01714     return *this;
01715   }
01716 
01717 
01719   VertexFaceIterT& operator--() { 
01720     assert(mesh_);
01721     active_ = true;
01722     do  heh_=mesh_->ccw_rotated_halfedge_handle(heh_); while ((*this) && (!handle().is_valid()));;
01723     return *this;
01724   }
01725 
01726 
01731   HalfedgeHandle current_halfedge_handle() const {
01732     return heh_;
01733   }
01734 
01735 
01737   typename Mesh::FaceHandle handle() const {
01738     assert(mesh_);
01739     return mesh_->face_handle(heh_); 
01740   }
01741 
01742 
01744   operator typename Mesh::FaceHandle() const {
01745     assert(mesh_);
01746     return mesh_->face_handle(heh_); 
01747   }
01748     
01749 
01751   reference operator*() const { 
01752     assert(mesh_);
01753     return mesh_->deref(handle());
01754   }
01755 
01756 
01758   pointer operator->() const { 
01759     assert(mesh_);
01760     return &mesh_->deref(handle());
01761   }
01762 
01763 
01770   operator bool() const { 
01771     return heh_.is_valid() && ((start_ != heh_) || (!active_));
01772   }
01773 
01774 
01775 private:
01776 
01777   mesh_ptr         mesh_;
01778   HalfedgeHandle   start_, heh_;
01779   bool             active_;
01780 };
01781 
01782 
01783 
01784 //== CLASS DEFINITION =========================================================
01785 
01786               
01791 template <class Mesh>
01792 class ConstVertexFaceIterT
01793 {
01794  public:
01795 
01796 
01797   //--- Typedefs ---
01798 
01799   typedef typename Mesh::HalfedgeHandle   HalfedgeHandle;
01800 
01801   typedef typename Mesh::Face           value_type;
01802   typedef typename Mesh::FaceHandle         value_handle;
01803 
01804 #if 1
01805   typedef const Mesh&         mesh_ref;
01806   typedef const Mesh*         mesh_ptr;
01807   typedef const typename Mesh::Face&   reference;
01808   typedef const typename Mesh::Face*   pointer;
01809 #else
01810   typedef Mesh&               mesh_ref;
01811   typedef Mesh*               mesh_ptr;
01812   typedef typename Mesh::Face&         reference;
01813   typedef typename Mesh::Face*         pointer;
01814 #endif
01815 
01816 
01817 
01819   ConstVertexFaceIterT() : mesh_(0), active_(false) {}
01820 
01821 
01823   ConstVertexFaceIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
01824     mesh_(&_mesh), 
01825     start_(_mesh.halfedge_handle(_start)),
01826     heh_(start_),
01827     active_(false)
01828   { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
01829 
01830 
01832   ConstVertexFaceIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
01833     mesh_(&_mesh),
01834     start_(_heh),
01835     heh_(_heh),
01836     active_(false)
01837   { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
01838 
01839 
01841   ConstVertexFaceIterT(const ConstVertexFaceIterT& _rhs) :
01842     mesh_(_rhs.mesh_),
01843     start_(_rhs.start_),
01844     heh_(_rhs.heh_),
01845     active_(_rhs.active_)
01846   { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
01847 
01848 
01850   ConstVertexFaceIterT& operator=(const ConstVertexFaceIterT<Mesh>& _rhs)
01851   {
01852     mesh_   = _rhs.mesh_;
01853     start_  = _rhs.start_;
01854     heh_    = _rhs.heh_;
01855     active_ = _rhs.active_;
01856     return *this;
01857   }
01858 
01859 
01860 #if 1
01861 
01862   ConstVertexFaceIterT(const VertexFaceIterT<Mesh>& _rhs) :
01863     mesh_(_rhs.mesh_),
01864     start_(_rhs.start_),
01865     heh_(_rhs.heh_),
01866     active_(_rhs.active_)
01867   { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
01868 
01869 
01871   ConstVertexFaceIterT& operator=(const VertexFaceIterT<Mesh>& _rhs)
01872   {
01873     mesh_   = _rhs.mesh_;
01874     start_  = _rhs.start_;
01875     heh_    = _rhs.heh_;
01876     active_ = _rhs.active_;
01877     return *this;
01878   }
01879 #else
01880   friend class ConstVertexFaceIterT<Mesh>;
01881 #endif  
01882 
01883 
01885   bool operator==(const ConstVertexFaceIterT& _rhs) const {
01886     return ((mesh_   == _rhs.mesh_) &&
01887             (start_  == _rhs.start_) &&
01888             (heh_    == _rhs.heh_) &&
01889             (active_ == _rhs.active_));
01890   }
01891 
01892 
01894   bool operator!=(const ConstVertexFaceIterT& _rhs) const {
01895     return !operator==(_rhs);
01896   }
01897 
01898 
01900   ConstVertexFaceIterT& operator++() { 
01901     assert(mesh_);
01902     active_ = true;
01903     do heh_=mesh_->cw_rotated_halfedge_handle(heh_);  while ((*this) && (!handle().is_valid()));;
01904     return *this;
01905   }
01906 
01907 
01909   ConstVertexFaceIterT& operator--() { 
01910     assert(mesh_);
01911     active_ = true;
01912     do  heh_=mesh_->ccw_rotated_halfedge_handle(heh_); while ((*this) && (!handle().is_valid()));;
01913     return *this;
01914   }
01915 
01916 
01921   HalfedgeHandle current_halfedge_handle() const {
01922     return heh_;
01923   }
01924 
01925 
01927   typename Mesh::FaceHandle handle() const {
01928     assert(mesh_);
01929     return mesh_->face_handle(heh_); 
01930   }
01931 
01932 
01934   operator typename Mesh::FaceHandle() const {
01935     assert(mesh_);
01936     return mesh_->face_handle(heh_); 
01937   }
01938     
01939 
01941   reference operator*() const { 
01942     assert(mesh_);
01943     return mesh_->deref(handle());
01944   }
01945 
01946 
01948   pointer operator->() const { 
01949     assert(mesh_);
01950     return &mesh_->deref(handle());
01951   }
01952 
01953 
01960   operator bool() const { 
01961     return heh_.is_valid() && ((start_ != heh_) || (!active_));
01962   }
01963 
01964 
01965 private:
01966 
01967   mesh_ptr         mesh_;
01968   HalfedgeHandle   start_, heh_;
01969   bool             active_;
01970 };
01971 
01972 
01973 
01974 //== CLASS DEFINITION =========================================================
01975 
01976               
01981 template <class Mesh>
01982 class FaceVertexIterT
01983 {
01984  public:
01985 
01986 
01987   //--- Typedefs ---
01988 
01989   typedef typename Mesh::HalfedgeHandle   HalfedgeHandle;
01990 
01991   typedef typename Mesh::Vertex           value_type;
01992   typedef typename Mesh::VertexHandle         value_handle;
01993 
01994 #if 0
01995   typedef const Mesh&         mesh_ref;
01996   typedef const Mesh*         mesh_ptr;
01997   typedef const typename Mesh::Vertex&   reference;
01998   typedef const typename Mesh::Vertex*   pointer;
01999 #else
02000   typedef Mesh&               mesh_ref;
02001   typedef Mesh*               mesh_ptr;
02002   typedef typename Mesh::Vertex&         reference;
02003   typedef typename Mesh::Vertex*         pointer;
02004 #endif
02005 
02006 
02007 
02009   FaceVertexIterT() : mesh_(0), active_(false) {}
02010 
02011 
02013   FaceVertexIterT(mesh_ref _mesh, typename Mesh::FaceHandle _start) :
02014     mesh_(&_mesh), 
02015     start_(_mesh.halfedge_handle(_start)),
02016     heh_(start_),
02017     active_(false)
02018   {  ; }
02019 
02020 
02022   FaceVertexIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
02023     mesh_(&_mesh),
02024     start_(_heh),
02025     heh_(_heh),
02026     active_(false)
02027   {  ; }
02028 
02029 
02031   FaceVertexIterT(const FaceVertexIterT& _rhs) :
02032     mesh_(_rhs.mesh_),
02033     start_(_rhs.start_),
02034     heh_(_rhs.heh_),
02035     active_(_rhs.active_)
02036   {  ; }
02037 
02038 
02040   FaceVertexIterT& operator=(const FaceVertexIterT<Mesh>& _rhs)
02041   {
02042     mesh_   = _rhs.mesh_;
02043     start_  = _rhs.start_;
02044     heh_    = _rhs.heh_;
02045     active_ = _rhs.active_;
02046     return *this;
02047   }
02048 
02049 
02050 #if 0
02051 
02052   FaceVertexIterT(const FaceVertexIterT<Mesh>& _rhs) :
02053     mesh_(_rhs.mesh_),
02054     start_(_rhs.start_),
02055     heh_(_rhs.heh_),
02056     active_(_rhs.active_)
02057   {  ; }
02058 
02059 
02061   FaceVertexIterT& operator=(const FaceVertexIterT<Mesh>& _rhs)
02062   {
02063     mesh_   = _rhs.mesh_;
02064     start_  = _rhs.start_;
02065     heh_    = _rhs.heh_;
02066     active_ = _rhs.active_;
02067     return *this;
02068   }
02069 #else
02070   friend class ConstFaceVertexIterT<Mesh>;
02071 #endif  
02072 
02073 
02075   bool operator==(const FaceVertexIterT& _rhs) const {
02076     return ((mesh_   == _rhs.mesh_) &&
02077             (start_  == _rhs.start_) &&
02078             (heh_    == _rhs.heh_) &&
02079             (active_ == _rhs.active_));
02080   }
02081 
02082 
02084   bool operator!=(const FaceVertexIterT& _rhs) const {
02085     return !operator==(_rhs);
02086   }
02087 
02088 
02090   FaceVertexIterT& operator++() { 
02091     assert(mesh_);
02092     active_ = true;
02093     heh_=mesh_->next_halfedge_handle(heh_);;
02094     return *this;
02095   }
02096 
02097 
02099   FaceVertexIterT& operator--() { 
02100     assert(mesh_);
02101     active_ = true;
02102     heh_=mesh_->prev_halfedge_handle(heh_);;
02103     return *this;
02104   }
02105 
02106 
02111   HalfedgeHandle current_halfedge_handle() const {
02112     return heh_;
02113   }
02114 
02115 
02117   typename Mesh::VertexHandle handle() const {
02118     assert(mesh_);
02119     return mesh_->to_vertex_handle(heh_); 
02120   }
02121 
02122 
02124   operator typename Mesh::VertexHandle() const {
02125     assert(mesh_);
02126     return mesh_->to_vertex_handle(heh_); 
02127   }
02128     
02129 
02131   reference operator*() const { 
02132     assert(mesh_);
02133     return mesh_->deref(handle());
02134   }
02135 
02136 
02138   pointer operator->() const { 
02139     assert(mesh_);
02140     return &mesh_->deref(handle());
02141   }
02142 
02143 
02150   operator bool() const { 
02151     return heh_.is_valid() && ((start_ != heh_) || (!active_));
02152   }
02153 
02154 
02155 private:
02156 
02157   mesh_ptr         mesh_;
02158   HalfedgeHandle   start_, heh_;
02159   bool             active_;
02160 };
02161 
02162 
02163 
02164 //== CLASS DEFINITION =========================================================
02165 
02166               
02171 template <class Mesh>
02172 class ConstFaceVertexIterT
02173 {
02174  public:
02175 
02176 
02177   //--- Typedefs ---
02178 
02179   typedef typename Mesh::HalfedgeHandle   HalfedgeHandle;
02180 
02181   typedef typename Mesh::Vertex           value_type;
02182   typedef typename Mesh::VertexHandle         value_handle;
02183 
02184 #if 1
02185   typedef const Mesh&         mesh_ref;
02186   typedef const Mesh*         mesh_ptr;
02187   typedef const typename Mesh::Vertex&   reference;
02188   typedef const typename Mesh::Vertex*   pointer;
02189 #else
02190   typedef Mesh&               mesh_ref;
02191   typedef Mesh*               mesh_ptr;
02192   typedef typename Mesh::Vertex&         reference;
02193   typedef typename Mesh::Vertex*         pointer;
02194 #endif
02195 
02196 
02197 
02199   ConstFaceVertexIterT() : mesh_(0), active_(false) {}
02200 
02201 
02203   ConstFaceVertexIterT(mesh_ref _mesh, typename Mesh::FaceHandle _start) :
02204     mesh_(&_mesh), 
02205     start_(_mesh.halfedge_handle(_start)),
02206     heh_(start_),
02207     active_(false)
02208   {  ; }
02209 
02210 
02212   ConstFaceVertexIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
02213     mesh_(&_mesh),
02214     start_(_heh),
02215     heh_(_heh),
02216     active_(false)
02217   {  ; }
02218 
02219 
02221   ConstFaceVertexIterT(const ConstFaceVertexIterT& _rhs) :
02222     mesh_(_rhs.mesh_),
02223     start_(_rhs.start_),
02224     heh_(_rhs.heh_),
02225     active_(_rhs.active_)
02226   {  ; }
02227 
02228 
02230   ConstFaceVertexIterT& operator=(const ConstFaceVertexIterT<Mesh>& _rhs)
02231   {
02232     mesh_   = _rhs.mesh_;
02233     start_  = _rhs.start_;
02234     heh_    = _rhs.heh_;
02235     active_ = _rhs.active_;
02236     return *this;
02237   }
02238 
02239 
02240 #if 1
02241 
02242   ConstFaceVertexIterT(const FaceVertexIterT<Mesh>& _rhs) :
02243     mesh_(_rhs.mesh_),
02244     start_(_rhs.start_),
02245     heh_(_rhs.heh_),
02246     active_(_rhs.active_)
02247   {  ; }
02248 
02249 
02251   ConstFaceVertexIterT& operator=(const FaceVertexIterT<Mesh>& _rhs)
02252   {
02253     mesh_   = _rhs.mesh_;
02254     start_  = _rhs.start_;
02255     heh_    = _rhs.heh_;
02256     active_ = _rhs.active_;
02257     return *this;
02258   }
02259 #else
02260   friend class ConstFaceVertexIterT<Mesh>;
02261 #endif  
02262 
02263 
02265   bool operator==(const ConstFaceVertexIterT& _rhs) const {
02266     return ((mesh_   == _rhs.mesh_) &&
02267             (start_  == _rhs.start_) &&
02268             (heh_    == _rhs.heh_) &&
02269             (active_ == _rhs.active_));
02270   }
02271 
02272 
02274   bool operator!=(const ConstFaceVertexIterT& _rhs) const {
02275     return !operator==(_rhs);
02276   }
02277 
02278 
02280   ConstFaceVertexIterT& operator++() { 
02281     assert(mesh_);
02282     active_ = true;
02283     heh_=mesh_->next_halfedge_handle(heh_);;
02284     return *this;
02285   }
02286 
02287 
02289   ConstFaceVertexIterT& operator--() { 
02290     assert(mesh_);
02291     active_ = true;
02292     heh_=mesh_->prev_halfedge_handle(heh_);;
02293     return *this;
02294   }
02295 
02296 
02301   HalfedgeHandle current_halfedge_handle() const {
02302     return heh_;
02303   }
02304 
02305 
02307   typename Mesh::VertexHandle handle() const {
02308     assert(mesh_);
02309     return mesh_->to_vertex_handle(heh_); 
02310   }
02311 
02312 
02314   operator typename Mesh::VertexHandle() const {
02315     assert(mesh_);
02316     return mesh_->to_vertex_handle(heh_); 
02317   }
02318     
02319 
02321   reference operator*() const { 
02322     assert(mesh_);
02323     return mesh_->deref(handle());
02324   }
02325 
02326 
02328   pointer operator->() const { 
02329     assert(mesh_);
02330     return &mesh_->deref(handle());
02331   }
02332 
02333 
02340   operator bool() const { 
02341     return heh_.is_valid() && ((start_ != heh_) || (!active_));
02342   }
02343 
02344 
02345 private:
02346 
02347   mesh_ptr         mesh_;
02348   HalfedgeHandle   start_, heh_;
02349   bool             active_;
02350 };
02351 
02352 
02353 
02354 //== CLASS DEFINITION =========================================================
02355 
02356               
02361 template <class Mesh>
02362 class FaceHalfedgeIterT
02363 {
02364  public:
02365 
02366 
02367   //--- Typedefs ---
02368 
02369   typedef typename Mesh::HalfedgeHandle   HalfedgeHandle;
02370 
02371   typedef typename Mesh::Halfedge           value_type;
02372   typedef typename Mesh::HalfedgeHandle         value_handle;
02373 
02374 #if 0
02375   typedef const Mesh&         mesh_ref;
02376   typedef const Mesh*         mesh_ptr;
02377   typedef const typename Mesh::Halfedge&   reference;
02378   typedef const typename Mesh::Halfedge*   pointer;
02379 #else
02380   typedef Mesh&               mesh_ref;
02381   typedef Mesh*               mesh_ptr;
02382   typedef typename Mesh::Halfedge&         reference;
02383   typedef typename Mesh::Halfedge*         pointer;
02384 #endif
02385 
02386 
02387 
02389   FaceHalfedgeIterT() : mesh_(0), active_(false) {}
02390 
02391 
02393   FaceHalfedgeIterT(mesh_ref _mesh, typename Mesh::FaceHandle _start) :
02394     mesh_(&_mesh), 
02395     start_(_mesh.halfedge_handle(_start)),
02396     heh_(start_),
02397     active_(false)
02398   {  ; }
02399 
02400 
02402   FaceHalfedgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
02403     mesh_(&_mesh),
02404     start_(_heh),
02405     heh_(_heh),
02406     active_(false)
02407   {  ; }
02408 
02409 
02411   FaceHalfedgeIterT(const FaceHalfedgeIterT& _rhs) :
02412     mesh_(_rhs.mesh_),
02413     start_(_rhs.start_),
02414     heh_(_rhs.heh_),
02415     active_(_rhs.active_)
02416   {  ; }
02417 
02418 
02420   FaceHalfedgeIterT& operator=(const FaceHalfedgeIterT<Mesh>& _rhs)
02421   {
02422     mesh_   = _rhs.mesh_;
02423     start_  = _rhs.start_;
02424     heh_    = _rhs.heh_;
02425     active_ = _rhs.active_;
02426     return *this;
02427   }
02428 
02429 
02430 #if 0
02431 
02432   FaceHalfedgeIterT(const FaceHalfedgeIterT<Mesh>& _rhs) :
02433     mesh_(_rhs.mesh_),
02434     start_(_rhs.start_),
02435     heh_(_rhs.heh_),
02436     active_(_rhs.active_)
02437   {  ; }
02438 
02439 
02441   FaceHalfedgeIterT& operator=(const FaceHalfedgeIterT<Mesh>& _rhs)
02442   {
02443     mesh_   = _rhs.mesh_;
02444     start_  = _rhs.start_;
02445     heh_    = _rhs.heh_;
02446     active_ = _rhs.active_;
02447     return *this;
02448   }
02449 #else
02450   friend class ConstFaceHalfedgeIterT<Mesh>;
02451 #endif  
02452 
02453 
02455   bool operator==(const FaceHalfedgeIterT& _rhs) const {
02456     return ((mesh_   == _rhs.mesh_) &&
02457             (start_  == _rhs.start_) &&
02458             (heh_    == _rhs.heh_) &&
02459             (active_ == _rhs.active_));
02460   }
02461 
02462 
02464   bool operator!=(const FaceHalfedgeIterT& _rhs) const {
02465     return !operator==(_rhs);
02466   }
02467 
02468 
02470   FaceHalfedgeIterT& operator++() { 
02471     assert(mesh_);
02472     active_ = true;
02473     heh_=mesh_->next_halfedge_handle(heh_);;
02474     return *this;
02475   }
02476 
02477 
02479   FaceHalfedgeIterT& operator--() { 
02480     assert(mesh_);
02481     active_ = true;
02482     heh_=mesh_->prev_halfedge_handle(heh_);;
02483     return *this;
02484   }
02485 
02486 
02491   HalfedgeHandle current_halfedge_handle() const {
02492     return heh_;
02493   }
02494 
02495 
02497   typename Mesh::HalfedgeHandle handle() const {
02498     assert(mesh_);
02499     return heh_; 
02500   }
02501 
02502 
02504   operator typename Mesh::HalfedgeHandle() const {
02505     assert(mesh_);
02506     return heh_; 
02507   }
02508     
02509 
02511   reference operator*() const { 
02512     assert(mesh_);
02513     return mesh_->deref(handle());
02514   }
02515 
02516 
02518   pointer operator->() const { 
02519     assert(mesh_);
02520     return &mesh_->deref(handle());
02521   }
02522 
02523 
02530   operator bool() const { 
02531     return heh_.is_valid() && ((start_ != heh_) || (!active_));
02532   }
02533 
02534 
02535 private:
02536 
02537   mesh_ptr         mesh_;
02538   HalfedgeHandle   start_, heh_;
02539   bool             active_;
02540 };
02541 
02542 
02543 
02544 //== CLASS DEFINITION =========================================================
02545 
02546               
02551 template <class Mesh>
02552 class ConstFaceHalfedgeIterT
02553 {
02554  public:
02555 
02556 
02557   //--- Typedefs ---
02558 
02559   typedef typename Mesh::HalfedgeHandle   HalfedgeHandle;
02560 
02561   typedef typename Mesh::Halfedge           value_type;
02562   typedef typename Mesh::HalfedgeHandle         value_handle;
02563 
02564 #if 1
02565   typedef const Mesh&         mesh_ref;
02566   typedef const Mesh*         mesh_ptr;
02567   typedef const typename Mesh::Halfedge&   reference;
02568   typedef const typename Mesh::Halfedge*   pointer;
02569 #else
02570   typedef Mesh&               mesh_ref;
02571   typedef Mesh*               mesh_ptr;
02572   typedef typename Mesh::Halfedge&         reference;
02573   typedef typename Mesh::Halfedge*         pointer;
02574 #endif
02575 
02576 
02577 
02579   ConstFaceHalfedgeIterT() : mesh_(0), active_(false) {}
02580 
02581 
02583   ConstFaceHalfedgeIterT(mesh_ref _mesh, typename Mesh::FaceHandle _start) :
02584     mesh_(&_mesh), 
02585     start_(_mesh.halfedge_handle(_start)),
02586     heh_(start_),
02587     active_(false)
02588   {  ; }
02589 
02590 
02592   ConstFaceHalfedgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
02593     mesh_(&_mesh),
02594     start_(_heh),
02595     heh_(_heh),
02596     active_(false)
02597   {  ; }
02598 
02599 
02601   ConstFaceHalfedgeIterT(const ConstFaceHalfedgeIterT& _rhs) :
02602     mesh_(_rhs.mesh_),
02603     start_(_rhs.start_),
02604     heh_(_rhs.heh_),
02605     active_(_rhs.active_)
02606   {  ; }
02607 
02608 
02610   ConstFaceHalfedgeIterT& operator=(const ConstFaceHalfedgeIterT<Mesh>& _rhs)
02611   {
02612     mesh_   = _rhs.mesh_;
02613     start_  = _rhs.start_;
02614     heh_    = _rhs.heh_;
02615     active_ = _rhs.active_;
02616     return *this;
02617   }
02618 
02619 
02620 #if 1
02621 
02622   ConstFaceHalfedgeIterT(const FaceHalfedgeIterT<Mesh>& _rhs) :
02623     mesh_(_rhs.mesh_),
02624     start_(_rhs.start_),
02625     heh_(_rhs.heh_),
02626     active_(_rhs.active_)
02627   {  ; }
02628 
02629 
02631   ConstFaceHalfedgeIterT& operator=(const FaceHalfedgeIterT<Mesh>& _rhs)
02632   {
02633     mesh_   = _rhs.mesh_;
02634     start_  = _rhs.start_;
02635     heh_    = _rhs.heh_;
02636     active_ = _rhs.active_;
02637     return *this;
02638   }
02639 #else
02640   friend class ConstFaceHalfedgeIterT<Mesh>;
02641 #endif  
02642 
02643 
02645   bool operator==(const ConstFaceHalfedgeIterT& _rhs) const {
02646     return ((mesh_   == _rhs.mesh_) &&
02647             (start_  == _rhs.start_) &&
02648             (heh_    == _rhs.heh_) &&
02649             (active_ == _rhs.active_));
02650   }
02651 
02652 
02654   bool operator!=(const ConstFaceHalfedgeIterT& _rhs) const {
02655     return !operator==(_rhs);
02656   }
02657 
02658 
02660   ConstFaceHalfedgeIterT& operator++() { 
02661     assert(mesh_);
02662     active_ = true;
02663     heh_=mesh_->next_halfedge_handle(heh_);;
02664     return *this;
02665   }
02666 
02667 
02669   ConstFaceHalfedgeIterT& operator--() { 
02670     assert(mesh_);
02671     active_ = true;
02672     heh_=mesh_->prev_halfedge_handle(heh_);;
02673     return *this;
02674   }
02675 
02676 
02681   HalfedgeHandle current_halfedge_handle() const {
02682     return heh_;
02683   }
02684 
02685 
02687   typename Mesh::HalfedgeHandle handle() const {
02688     assert(mesh_);
02689     return heh_; 
02690   }
02691 
02692 
02694   operator typename Mesh::HalfedgeHandle() const {
02695     assert(mesh_);
02696     return heh_; 
02697   }
02698     
02699 
02701   reference operator*() const { 
02702     assert(mesh_);
02703     return mesh_->deref(handle());
02704   }
02705 
02706 
02708   pointer operator->() const { 
02709     assert(mesh_);
02710     return &mesh_->deref(handle());
02711   }
02712 
02713 
02720   operator bool() const { 
02721     return heh_.is_valid() && ((start_ != heh_) || (!active_));
02722   }
02723 
02724 
02725 private:
02726 
02727   mesh_ptr         mesh_;
02728   HalfedgeHandle   start_, heh_;
02729   bool             active_;
02730 };
02731 
02732 
02733 
02734 //== CLASS DEFINITION =========================================================
02735 
02736               
02741 template <class Mesh>
02742 class FaceEdgeIterT
02743 {
02744  public:
02745 
02746 
02747   //--- Typedefs ---
02748 
02749   typedef typename Mesh::HalfedgeHandle   HalfedgeHandle;
02750 
02751   typedef typename Mesh::Edge           value_type;
02752   typedef typename Mesh::EdgeHandle         value_handle;
02753 
02754 #if 0
02755   typedef const Mesh&         mesh_ref;
02756   typedef const Mesh*         mesh_ptr;
02757   typedef const typename Mesh::Edge&   reference;
02758   typedef const typename Mesh::Edge*   pointer;
02759 #else
02760   typedef Mesh&               mesh_ref;
02761   typedef Mesh*               mesh_ptr;
02762   typedef typename Mesh::Edge&         reference;
02763   typedef typename Mesh::Edge*         pointer;
02764 #endif
02765 
02766 
02767 
02769   FaceEdgeIterT() : mesh_(0), active_(false) {}
02770 
02771 
02773   FaceEdgeIterT(mesh_ref _mesh, typename Mesh::FaceHandle _start) :
02774     mesh_(&_mesh), 
02775     start_(_mesh.halfedge_handle(_start)),
02776     heh_(start_),
02777     active_(false)
02778   {  ; }
02779 
02780 
02782   FaceEdgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
02783     mesh_(&_mesh),
02784     start_(_heh),
02785     heh_(_heh),
02786     active_(false)
02787   {  ; }
02788 
02789 
02791   FaceEdgeIterT(const FaceEdgeIterT& _rhs) :
02792     mesh_(_rhs.mesh_),
02793     start_(_rhs.start_),
02794     heh_(_rhs.heh_),
02795     active_(_rhs.active_)
02796   {  ; }
02797 
02798 
02800   FaceEdgeIterT& operator=(const FaceEdgeIterT<Mesh>& _rhs)
02801   {
02802     mesh_   = _rhs.mesh_;
02803     start_  = _rhs.start_;
02804     heh_    = _rhs.heh_;
02805     active_ = _rhs.active_;
02806     return *this;
02807   }
02808 
02809 
02810 #if 0
02811 
02812   FaceEdgeIterT(const FaceEdgeIterT<Mesh>& _rhs) :
02813     mesh_(_rhs.mesh_),
02814     start_(_rhs.start_),
02815     heh_(_rhs.heh_),
02816     active_(_rhs.active_)
02817   {  ; }
02818 
02819 
02821   FaceEdgeIterT& operator=(const FaceEdgeIterT<Mesh>& _rhs)
02822   {
02823     mesh_   = _rhs.mesh_;
02824     start_  = _rhs.start_;
02825     heh_    = _rhs.heh_;
02826     active_ = _rhs.active_;
02827     return *this;
02828   }
02829 #else
02830   friend class ConstFaceEdgeIterT<Mesh>;
02831 #endif  
02832 
02833 
02835   bool operator==(const FaceEdgeIterT& _rhs) const {
02836     return ((mesh_   == _rhs.mesh_) &&
02837             (start_  == _rhs.start_) &&
02838             (heh_    == _rhs.heh_) &&
02839             (active_ == _rhs.active_));
02840   }
02841 
02842 
02844   bool operator!=(const FaceEdgeIterT& _rhs) const {
02845     return !operator==(_rhs);
02846   }
02847 
02848 
02850   FaceEdgeIterT& operator++() { 
02851     assert(mesh_);
02852     active_ = true;
02853     heh_=mesh_->next_halfedge_handle(heh_);;
02854     return *this;
02855   }
02856 
02857 
02859   FaceEdgeIterT& operator--() { 
02860     assert(mesh_);
02861     active_ = true;
02862     heh_=mesh_->prev_halfedge_handle(heh_);;
02863     return *this;
02864   }
02865 
02866 
02871   HalfedgeHandle current_halfedge_handle() const {
02872     return heh_;
02873   }
02874 
02875 
02877   typename Mesh::EdgeHandle handle() const {
02878     assert(mesh_);
02879     return mesh_->edge_handle(heh_); 
02880   }
02881 
02882 
02884   operator typename Mesh::EdgeHandle() const {
02885     assert(mesh_);
02886     return mesh_->edge_handle(heh_); 
02887   }
02888     
02889 
02891   reference operator*() const { 
02892     assert(mesh_);
02893     return mesh_->deref(handle());
02894   }
02895 
02896 
02898   pointer operator->() const { 
02899     assert(mesh_);
02900     return &mesh_->deref(handle());
02901   }
02902 
02903 
02910   operator bool() const { 
02911     return heh_.is_valid() && ((start_ != heh_) || (!active_));
02912   }
02913 
02914 
02915 private:
02916 
02917   mesh_ptr         mesh_;
02918   HalfedgeHandle   start_, heh_;
02919   bool             active_;
02920 };
02921 
02922 
02923 
02924 //== CLASS DEFINITION =========================================================
02925 
02926               
02931 template <class Mesh>
02932 class ConstFaceEdgeIterT
02933 {
02934  public:
02935 
02936 
02937   //--- Typedefs ---
02938 
02939   typedef typename Mesh::HalfedgeHandle   HalfedgeHandle;
02940 
02941   typedef typename Mesh::Edge           value_type;
02942   typedef typename Mesh::EdgeHandle         value_handle;
02943 
02944 #if 1
02945   typedef const Mesh&         mesh_ref;
02946   typedef const Mesh*         mesh_ptr;
02947   typedef const typename Mesh::Edge&   reference;
02948   typedef const typename Mesh::Edge*   pointer;
02949 #else
02950   typedef Mesh&               mesh_ref;
02951   typedef Mesh*               mesh_ptr;
02952   typedef typename Mesh::Edge&         reference;
02953   typedef typename Mesh::Edge*         pointer;
02954 #endif
02955 
02956 
02957 
02959   ConstFaceEdgeIterT() : mesh_(0), active_(false) {}
02960 
02961 
02963   ConstFaceEdgeIterT(mesh_ref _mesh, typename Mesh::FaceHandle _start) :
02964     mesh_(&_mesh), 
02965     start_(_mesh.halfedge_handle(_start)),
02966     heh_(start_),
02967     active_(false)
02968   {  ; }
02969 
02970 
02972   ConstFaceEdgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
02973     mesh_(&_mesh),
02974     start_(_heh),
02975     heh_(_heh),
02976     active_(false)
02977   {  ; }
02978 
02979 
02981   ConstFaceEdgeIterT(const ConstFaceEdgeIterT& _rhs) :
02982     mesh_(_rhs.mesh_),
02983     start_(_rhs.start_),
02984     heh_(_rhs.heh_),
02985     active_(_rhs.active_)
02986   {  ; }
02987 
02988 
02990   ConstFaceEdgeIterT& operator=(const ConstFaceEdgeIterT<Mesh>& _rhs)
02991   {
02992     mesh_   = _rhs.mesh_;
02993     start_  = _rhs.start_;
02994     heh_    = _rhs.heh_;
02995     active_ = _rhs.active_;
02996     return *this;
02997   }
02998 
02999 
03000 #if 1
03001 
03002   ConstFaceEdgeIterT(const FaceEdgeIterT<Mesh>& _rhs) :
03003     mesh_(_rhs.mesh_),
03004     start_(_rhs.start_),
03005     heh_(_rhs.heh_),
03006     active_(_rhs.active_)
03007   {  ; }
03008 
03009 
03011   ConstFaceEdgeIterT& operator=(const FaceEdgeIterT<Mesh>& _rhs)
03012   {
03013     mesh_   = _rhs.mesh_;
03014     start_  = _rhs.start_;
03015     heh_    = _rhs.heh_;
03016     active_ = _rhs.active_;
03017     return *this;
03018   }
03019 #else
03020   friend class ConstFaceEdgeIterT<Mesh>;
03021 #endif  
03022 
03023 
03025   bool operator==(const ConstFaceEdgeIterT& _rhs) const {
03026     return ((mesh_   == _rhs.mesh_) &&
03027             (start_  == _rhs.start_) &&
03028             (heh_    == _rhs.heh_) &&
03029             (active_ == _rhs.active_));
03030   }
03031 
03032 
03034   bool operator!=(const ConstFaceEdgeIterT& _rhs) const {
03035     return !operator==(_rhs);
03036   }
03037 
03038 
03040   ConstFaceEdgeIterT& operator++() { 
03041     assert(mesh_);
03042     active_ = true;
03043     heh_=mesh_->next_halfedge_handle(heh_);;
03044     return *this;
03045   }
03046 
03047 
03049   ConstFaceEdgeIterT& operator--() { 
03050     assert(mesh_);
03051     active_ = true;
03052     heh_=mesh_->prev_halfedge_handle(heh_);;
03053     return *this;
03054   }
03055 
03056 
03061   HalfedgeHandle current_halfedge_handle() const {
03062     return heh_;
03063   }
03064 
03065 
03067   typename Mesh::EdgeHandle handle() const {
03068     assert(mesh_);
03069     return mesh_->edge_handle(heh_); 
03070   }
03071 
03072 
03074   operator typename Mesh::EdgeHandle() const {
03075     assert(mesh_);
03076     return mesh_->edge_handle(heh_); 
03077   }
03078     
03079 
03081   reference operator*() const { 
03082     assert(mesh_);
03083     return mesh_->deref(handle());
03084   }
03085 
03086 
03088   pointer operator->() const { 
03089     assert(mesh_);
03090     return &mesh_->deref(handle());
03091   }
03092 
03093 
03100   operator bool() const { 
03101     return heh_.is_valid() && ((start_ != heh_) || (!active_));
03102   }
03103 
03104 
03105 private:
03106 
03107   mesh_ptr         mesh_;
03108   HalfedgeHandle   start_, heh_;
03109   bool             active_;
03110 };
03111 
03112 
03113 
03114 //== CLASS DEFINITION =========================================================
03115 
03116               
03121 template <class Mesh>
03122 class FaceFaceIterT
03123 {
03124  public:
03125 
03126 
03127   //--- Typedefs ---
03128 
03129   typedef typename Mesh::HalfedgeHandle   HalfedgeHandle;
03130 
03131   typedef typename Mesh::Face           value_type;
03132   typedef typename Mesh::FaceHandle         value_handle;
03133 
03134 #if 0
03135   typedef const Mesh&         mesh_ref;
03136   typedef const Mesh*         mesh_ptr;
03137   typedef const typename Mesh::Face&   reference;
03138   typedef const typename Mesh::Face*   pointer;
03139 #else
03140   typedef Mesh&               mesh_ref;
03141   typedef Mesh*               mesh_ptr;
03142   typedef typename Mesh::Face&         reference;
03143   typedef typename Mesh::Face*         pointer;
03144 #endif
03145 
03146 
03147 
03149   FaceFaceIterT() : mesh_(0), active_(false) {}
03150 
03151 
03153   FaceFaceIterT(mesh_ref _mesh, typename Mesh::FaceHandle _start) :
03154     mesh_(&_mesh), 
03155     start_(_mesh.halfedge_handle(_start)),
03156     heh_(start_),
03157     active_(false)
03158   { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
03159 
03160 
03162   FaceFaceIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
03163     mesh_(&_mesh),
03164     start_(_heh),
03165     heh_(_heh),
03166     active_(false)
03167   { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
03168 
03169 
03171   FaceFaceIterT(const FaceFaceIterT& _rhs) :
03172     mesh_(_rhs.mesh_),
03173     start_(_rhs.start_),
03174     heh_(_rhs.heh_),
03175     active_(_rhs.active_)
03176   { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
03177 
03178 
03180   FaceFaceIterT& operator=(const FaceFaceIterT<Mesh>& _rhs)
03181   {
03182     mesh_   = _rhs.mesh_;
03183     start_  = _rhs.start_;
03184     heh_    = _rhs.heh_;
03185     active_ = _rhs.active_;
03186     return *this;
03187   }
03188 
03189 
03190 #if 0
03191 
03192   FaceFaceIterT(const FaceFaceIterT<Mesh>& _rhs) :
03193     mesh_(_rhs.mesh_),
03194     start_(_rhs.start_),
03195     heh_(_rhs.heh_),
03196     active_(_rhs.active_)
03197   { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
03198 
03199 
03201   FaceFaceIterT& operator=(const FaceFaceIterT<Mesh>& _rhs)
03202   {
03203     mesh_   = _rhs.mesh_;
03204     start_  = _rhs.start_;
03205     heh_    = _rhs.heh_;
03206     active_ = _rhs.active_;
03207     return *this;
03208   }
03209 #else
03210   friend class ConstFaceFaceIterT<Mesh>;
03211 #endif  
03212 
03213 
03215   bool operator==(const FaceFaceIterT& _rhs) const {
03216     return ((mesh_   == _rhs.mesh_) &&
03217             (start_  == _rhs.start_) &&
03218             (heh_    == _rhs.heh_) &&
03219             (active_ == _rhs.active_));
03220   }
03221 
03222 
03224   bool operator!=(const FaceFaceIterT& _rhs) const {
03225     return !operator==(_rhs);
03226   }
03227 
03228 
03230   FaceFaceIterT& operator++() { 
03231     assert(mesh_);
03232     active_ = true;
03233     do heh_=mesh_->next_halfedge_handle(heh_); while ((*this) && (!handle().is_valid()));;
03234     return *this;
03235   }
03236 
03237 
03239   FaceFaceIterT& operator--() { 
03240     assert(mesh_);
03241     active_ = true;
03242     do heh_=mesh_->prev_halfedge_handle(heh_); while ((*this) && (!handle().is_valid()));;
03243     return *this;
03244   }
03245 
03246 
03251   HalfedgeHandle current_halfedge_handle() const {
03252     return heh_;
03253   }
03254 
03255 
03257   typename Mesh::FaceHandle handle() const {
03258     assert(mesh_);
03259     return mesh_->face_handle(mesh_->opposite_halfedge_handle(heh_)); 
03260   }
03261 
03262 
03264   operator typename Mesh::FaceHandle() const {
03265     assert(mesh_);
03266     return mesh_->face_handle(mesh_->opposite_halfedge_handle(heh_)); 
03267   }
03268     
03269 
03271   reference operator*() const { 
03272     assert(mesh_);
03273     return mesh_->deref(handle());
03274   }
03275 
03276 
03278   pointer operator->() const { 
03279     assert(mesh_);
03280     return &mesh_->deref(handle());
03281   }
03282 
03283 
03290   operator bool() const { 
03291     return heh_.is_valid() && ((start_ != heh_) || (!active_));
03292   }
03293 
03294 
03295 private:
03296 
03297   mesh_ptr         mesh_;
03298   HalfedgeHandle   start_, heh_;
03299   bool             active_;
03300 };
03301 
03302 
03303 
03304 //== CLASS DEFINITION =========================================================
03305 
03306               
03311 template <class Mesh>
03312 class ConstFaceFaceIterT
03313 {
03314  public:
03315 
03316 
03317   //--- Typedefs ---
03318 
03319   typedef typename Mesh::HalfedgeHandle   HalfedgeHandle;
03320 
03321   typedef typename Mesh::Face           value_type;
03322   typedef typename Mesh::FaceHandle         value_handle;
03323 
03324 #if 1
03325   typedef const Mesh&         mesh_ref;
03326   typedef const Mesh*         mesh_ptr;
03327   typedef const typename Mesh::Face&   reference;
03328   typedef const typename Mesh::Face*   pointer;
03329 #else
03330   typedef Mesh&               mesh_ref;
03331   typedef Mesh*               mesh_ptr;
03332   typedef typename Mesh::Face&         reference;
03333   typedef typename Mesh::Face*         pointer;
03334 #endif
03335 
03336 
03337 
03339   ConstFaceFaceIterT() : mesh_(0), active_(false) {}
03340 
03341 
03343   ConstFaceFaceIterT(mesh_ref _mesh, typename Mesh::FaceHandle _start) :
03344     mesh_(&_mesh), 
03345     start_(_mesh.halfedge_handle(_start)),
03346     heh_(start_),
03347     active_(false)
03348   { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
03349 
03350 
03352   ConstFaceFaceIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
03353     mesh_(&_mesh),
03354     start_(_heh),
03355     heh_(_heh),
03356     active_(false)
03357   { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
03358 
03359 
03361   ConstFaceFaceIterT(const ConstFaceFaceIterT& _rhs) :
03362     mesh_(_rhs.mesh_),
03363     start_(_rhs.start_),
03364     heh_(_rhs.heh_),
03365     active_(_rhs.active_)
03366   { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
03367 
03368 
03370   ConstFaceFaceIterT& operator=(const ConstFaceFaceIterT<Mesh>& _rhs)
03371   {
03372     mesh_   = _rhs.mesh_;
03373     start_  = _rhs.start_;
03374     heh_    = _rhs.heh_;
03375     active_ = _rhs.active_;
03376     return *this;
03377   }
03378 
03379 
03380 #if 1
03381 
03382   ConstFaceFaceIterT(const FaceFaceIterT<Mesh>& _rhs) :
03383     mesh_(_rhs.mesh_),
03384     start_(_rhs.start_),
03385     heh_(_rhs.heh_),
03386     active_(_rhs.active_)
03387   { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
03388 
03389 
03391   ConstFaceFaceIterT& operator=(const FaceFaceIterT<Mesh>& _rhs)
03392   {
03393     mesh_   = _rhs.mesh_;
03394     start_  = _rhs.start_;
03395     heh_    = _rhs.heh_;
03396     active_ = _rhs.active_;
03397     return *this;
03398   }
03399 #else
03400   friend class ConstFaceFaceIterT<Mesh>;
03401 #endif  
03402 
03403 
03405   bool operator==(const ConstFaceFaceIterT& _rhs) const {
03406     return ((mesh_   == _rhs.mesh_) &&
03407             (start_  == _rhs.start_) &&
03408             (heh_    == _rhs.heh_) &&
03409             (active_ == _rhs.active_));
03410   }
03411 
03412 
03414   bool operator!=(const ConstFaceFaceIterT& _rhs) const {
03415     return !operator==(_rhs);
03416   }
03417 
03418 
03420   ConstFaceFaceIterT& operator++() { 
03421     assert(mesh_);
03422     active_ = true;
03423     do heh_=mesh_->next_halfedge_handle(heh_); while ((*this) && (!handle().is_valid()));;
03424     return *this;
03425   }
03426 
03427 
03429   ConstFaceFaceIterT& operator--() { 
03430     assert(mesh_);
03431     active_ = true;
03432     do heh_=mesh_->prev_halfedge_handle(heh_); while ((*this) && (!handle().is_valid()));;
03433     return *this;
03434   }
03435 
03436 
03441   HalfedgeHandle current_halfedge_handle() const {
03442     return heh_;
03443   }
03444 
03445 
03447   typename Mesh::FaceHandle handle() const {
03448     assert(mesh_);
03449     return mesh_->face_handle(mesh_->opposite_halfedge_handle(heh_)); 
03450   }
03451 
03452 
03454   operator typename Mesh::FaceHandle() const {
03455     assert(mesh_);
03456     return mesh_->face_handle(mesh_->opposite_halfedge_handle(heh_)); 
03457   }
03458     
03459 
03461   reference operator*() const { 
03462     assert(mesh_);
03463     return mesh_->deref(handle());
03464   }
03465 
03466 
03468   pointer operator->() const { 
03469     assert(mesh_);
03470     return &mesh_->deref(handle());
03471   }
03472 
03473 
03480   operator bool() const { 
03481     return heh_.is_valid() && ((start_ != heh_) || (!active_));
03482   }
03483 
03484 
03485 private:
03486 
03487   mesh_ptr         mesh_;
03488   HalfedgeHandle   start_, heh_;
03489   bool             active_;
03490 };
03491 
03492 
03493 
03494 //=============================================================================
03495 } // namespace Iterators
03496 } // namespace OpenMesh
03497 //=============================================================================
03498 #endif 
03499 //=============================================================================

acg pic Project OpenMesh, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .