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
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef OPENMESH_CIRCULATORS_HH
00043 #define OPENMESH_CIRCULATORS_HH
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 #include <OpenMesh/Core/System/config.h>
00055 #include <assert.h>
00056
00057
00058
00059
00060 namespace OpenMesh {
00061 namespace Iterators {
00062
00063
00064
00065
00066
00067 template <class Mesh> class VertexVertexIterT;
00068 template <class Mesh> class VertexIHalfedgeIterT;
00069 template <class Mesh> class VertexOHalfedgeIterT;
00070 template <class Mesh> class VertexEdgeIterT;
00071 template <class Mesh> class VertexFaceIterT;
00072
00073 template <class Mesh> class ConstVertexVertexIterT;
00074 template <class Mesh> class ConstVertexIHalfedgeIterT;
00075 template <class Mesh> class ConstVertexOHalfedgeIterT;
00076 template <class Mesh> class ConstVertexEdgeIterT;
00077 template <class Mesh> class ConstVertexFaceIterT;
00078
00079 template <class Mesh> class FaceVertexIterT;
00080 template <class Mesh> class FaceHalfedgeIterT;
00081 template <class Mesh> class FaceEdgeIterT;
00082 template <class Mesh> class FaceFaceIterT;
00083
00084 template <class Mesh> class ConstFaceVertexIterT;
00085 template <class Mesh> class ConstFaceHalfedgeIterT;
00086 template <class Mesh> class ConstFaceEdgeIterT;
00087 template <class Mesh> class ConstFaceFaceIterT;
00088
00089
00090
00091
00092
00093
00098 template <class Mesh>
00099 class VertexVertexIterT
00100 {
00101 public:
00102
00103
00104
00105
00106 typedef typename Mesh::HalfedgeHandle HalfedgeHandle;
00107
00108 typedef typename Mesh::Vertex value_type;
00109 typedef typename Mesh::VertexHandle value_handle;
00110
00111 #if 0
00112 typedef const Mesh& mesh_ref;
00113 typedef const Mesh* mesh_ptr;
00114 typedef const typename Mesh::Vertex& reference;
00115 typedef const typename Mesh::Vertex* pointer;
00116 #else
00117 typedef Mesh& mesh_ref;
00118 typedef Mesh* mesh_ptr;
00119 typedef typename Mesh::Vertex& reference;
00120 typedef typename Mesh::Vertex* pointer;
00121 #endif
00122
00123
00124
00126 VertexVertexIterT() : mesh_(0), active_(false) {}
00127
00128
00130 VertexVertexIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
00131 mesh_(&_mesh),
00132 start_(_mesh.halfedge_handle(_start)),
00133 heh_(start_),
00134 active_(false)
00135 { ; }
00136
00137
00139 VertexVertexIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
00140 mesh_(&_mesh),
00141 start_(_heh),
00142 heh_(_heh),
00143 active_(false)
00144 { ; }
00145
00146
00148 VertexVertexIterT(const VertexVertexIterT& _rhs) :
00149 mesh_(_rhs.mesh_),
00150 start_(_rhs.start_),
00151 heh_(_rhs.heh_),
00152 active_(_rhs.active_)
00153 { ; }
00154
00155
00157 VertexVertexIterT& operator=(const VertexVertexIterT<Mesh>& _rhs)
00158 {
00159 mesh_ = _rhs.mesh_;
00160 start_ = _rhs.start_;
00161 heh_ = _rhs.heh_;
00162 active_ = _rhs.active_;
00163 return *this;
00164 }
00165
00166
00167 #if 0
00169 VertexVertexIterT(const VertexVertexIterT<Mesh>& _rhs) :
00170 mesh_(_rhs.mesh_),
00171 start_(_rhs.start_),
00172 heh_(_rhs.heh_),
00173 active_(_rhs.active_)
00174 { ; }
00175
00176
00178 VertexVertexIterT& operator=(const VertexVertexIterT<Mesh>& _rhs)
00179 {
00180 mesh_ = _rhs.mesh_;
00181 start_ = _rhs.start_;
00182 heh_ = _rhs.heh_;
00183 active_ = _rhs.active_;
00184 return *this;
00185 }
00186 #else
00187 friend class ConstVertexVertexIterT<Mesh>;
00188 #endif
00189
00190
00192 bool operator==(const VertexVertexIterT& _rhs) const {
00193 return ((mesh_ == _rhs.mesh_) &&
00194 (start_ == _rhs.start_) &&
00195 (heh_ == _rhs.heh_) &&
00196 (active_ == _rhs.active_));
00197 }
00198
00199
00201 bool operator!=(const VertexVertexIterT& _rhs) const {
00202 return !operator==(_rhs);
00203 }
00204
00205
00207 VertexVertexIterT& operator++() {
00208 assert(mesh_);
00209 active_ = true;
00210 heh_=mesh_->cw_rotated_halfedge_handle(heh_);;
00211 return *this;
00212 }
00213
00214
00216 VertexVertexIterT& operator--() {
00217 assert(mesh_);
00218 active_ = true;
00219 heh_=mesh_->ccw_rotated_halfedge_handle(heh_);;
00220 return *this;
00221 }
00222
00223
00228 HalfedgeHandle current_halfedge_handle() const {
00229 return heh_;
00230 }
00231
00232
00234 typename Mesh::VertexHandle handle() const {
00235 assert(mesh_);
00236 return mesh_->to_vertex_handle(heh_);;
00237 }
00238
00239
00241 operator typename Mesh::VertexHandle() const {
00242 assert(mesh_);
00243 return mesh_->to_vertex_handle(heh_);;
00244 }
00245
00246
00248 reference operator*() const {
00249 assert(mesh_);
00250 return mesh_->deref(handle());
00251 }
00252
00253
00255 pointer operator->() const {
00256 assert(mesh_);
00257 return &mesh_->deref(handle());
00258 }
00259
00260
00267 operator bool() const {
00268 return heh_.is_valid() && ((start_ != heh_) || (!active_));
00269 }
00270
00271
00272 protected:
00273
00274 mesh_ptr mesh_;
00275 HalfedgeHandle start_, heh_;
00276 bool active_;
00277 };
00278
00279
00280
00281
00282
00283
00288 template <class Mesh>
00289 class ConstVertexVertexIterT
00290 {
00291 public:
00292
00293
00294
00295
00296 typedef typename Mesh::HalfedgeHandle HalfedgeHandle;
00297
00298 typedef typename Mesh::Vertex value_type;
00299 typedef typename Mesh::VertexHandle value_handle;
00300
00301 #if 1
00302 typedef const Mesh& mesh_ref;
00303 typedef const Mesh* mesh_ptr;
00304 typedef const typename Mesh::Vertex& reference;
00305 typedef const typename Mesh::Vertex* pointer;
00306 #else
00307 typedef Mesh& mesh_ref;
00308 typedef Mesh* mesh_ptr;
00309 typedef typename Mesh::Vertex& reference;
00310 typedef typename Mesh::Vertex* pointer;
00311 #endif
00312
00313
00314
00316 ConstVertexVertexIterT() : mesh_(0), active_(false) {}
00317
00318
00320 ConstVertexVertexIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
00321 mesh_(&_mesh),
00322 start_(_mesh.halfedge_handle(_start)),
00323 heh_(start_),
00324 active_(false)
00325 { ; }
00326
00327
00329 ConstVertexVertexIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
00330 mesh_(&_mesh),
00331 start_(_heh),
00332 heh_(_heh),
00333 active_(false)
00334 { ; }
00335
00336
00338 ConstVertexVertexIterT(const ConstVertexVertexIterT& _rhs) :
00339 mesh_(_rhs.mesh_),
00340 start_(_rhs.start_),
00341 heh_(_rhs.heh_),
00342 active_(_rhs.active_)
00343 { ; }
00344
00345
00347 ConstVertexVertexIterT& operator=(const ConstVertexVertexIterT<Mesh>& _rhs)
00348 {
00349 mesh_ = _rhs.mesh_;
00350 start_ = _rhs.start_;
00351 heh_ = _rhs.heh_;
00352 active_ = _rhs.active_;
00353 return *this;
00354 }
00355
00356
00357 #if 1
00359 ConstVertexVertexIterT(const VertexVertexIterT<Mesh>& _rhs) :
00360 mesh_(_rhs.mesh_),
00361 start_(_rhs.start_),
00362 heh_(_rhs.heh_),
00363 active_(_rhs.active_)
00364 { ; }
00365
00366
00368 ConstVertexVertexIterT& operator=(const VertexVertexIterT<Mesh>& _rhs)
00369 {
00370 mesh_ = _rhs.mesh_;
00371 start_ = _rhs.start_;
00372 heh_ = _rhs.heh_;
00373 active_ = _rhs.active_;
00374 return *this;
00375 }
00376 #else
00377 friend class ConstVertexVertexIterT<Mesh>;
00378 #endif
00379
00380
00382 bool operator==(const ConstVertexVertexIterT& _rhs) const {
00383 return ((mesh_ == _rhs.mesh_) &&
00384 (start_ == _rhs.start_) &&
00385 (heh_ == _rhs.heh_) &&
00386 (active_ == _rhs.active_));
00387 }
00388
00389
00391 bool operator!=(const ConstVertexVertexIterT& _rhs) const {
00392 return !operator==(_rhs);
00393 }
00394
00395
00397 ConstVertexVertexIterT& operator++() {
00398 assert(mesh_);
00399 active_ = true;
00400 heh_=mesh_->cw_rotated_halfedge_handle(heh_);;
00401 return *this;
00402 }
00403
00404
00406 ConstVertexVertexIterT& operator--() {
00407 assert(mesh_);
00408 active_ = true;
00409 heh_=mesh_->ccw_rotated_halfedge_handle(heh_);;
00410 return *this;
00411 }
00412
00413
00418 HalfedgeHandle current_halfedge_handle() const {
00419 return heh_;
00420 }
00421
00422
00424 typename Mesh::VertexHandle handle() const {
00425 assert(mesh_);
00426 return mesh_->to_vertex_handle(heh_);;
00427 }
00428
00429
00431 operator typename Mesh::VertexHandle() const {
00432 assert(mesh_);
00433 return mesh_->to_vertex_handle(heh_);;
00434 }
00435
00436
00438 reference operator*() const {
00439 assert(mesh_);
00440 return mesh_->deref(handle());
00441 }
00442
00443
00445 pointer operator->() const {
00446 assert(mesh_);
00447 return &mesh_->deref(handle());
00448 }
00449
00450
00457 operator bool() const {
00458 return heh_.is_valid() && ((start_ != heh_) || (!active_));
00459 }
00460
00461
00462 protected:
00463
00464 mesh_ptr mesh_;
00465 HalfedgeHandle start_, heh_;
00466 bool active_;
00467 };
00468
00469
00470
00471
00472
00473
00478 template <class Mesh>
00479 class VertexOHalfedgeIterT
00480 {
00481 public:
00482
00483
00484
00485
00486 typedef typename Mesh::HalfedgeHandle HalfedgeHandle;
00487
00488 typedef typename Mesh::Halfedge value_type;
00489 typedef typename Mesh::HalfedgeHandle value_handle;
00490
00491 #if 0
00492 typedef const Mesh& mesh_ref;
00493 typedef const Mesh* mesh_ptr;
00494 typedef const typename Mesh::Halfedge& reference;
00495 typedef const typename Mesh::Halfedge* pointer;
00496 #else
00497 typedef Mesh& mesh_ref;
00498 typedef Mesh* mesh_ptr;
00499 typedef typename Mesh::Halfedge& reference;
00500 typedef typename Mesh::Halfedge* pointer;
00501 #endif
00502
00503
00504
00506 VertexOHalfedgeIterT() : mesh_(0), active_(false) {}
00507
00508
00510 VertexOHalfedgeIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
00511 mesh_(&_mesh),
00512 start_(_mesh.halfedge_handle(_start)),
00513 heh_(start_),
00514 active_(false)
00515 { ; }
00516
00517
00519 VertexOHalfedgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
00520 mesh_(&_mesh),
00521 start_(_heh),
00522 heh_(_heh),
00523 active_(false)
00524 { ; }
00525
00526
00528 VertexOHalfedgeIterT(const VertexOHalfedgeIterT& _rhs) :
00529 mesh_(_rhs.mesh_),
00530 start_(_rhs.start_),
00531 heh_(_rhs.heh_),
00532 active_(_rhs.active_)
00533 { ; }
00534
00535
00537 VertexOHalfedgeIterT& operator=(const VertexOHalfedgeIterT<Mesh>& _rhs)
00538 {
00539 mesh_ = _rhs.mesh_;
00540 start_ = _rhs.start_;
00541 heh_ = _rhs.heh_;
00542 active_ = _rhs.active_;
00543 return *this;
00544 }
00545
00546
00547 #if 0
00549 VertexOHalfedgeIterT(const VertexOHalfedgeIterT<Mesh>& _rhs) :
00550 mesh_(_rhs.mesh_),
00551 start_(_rhs.start_),
00552 heh_(_rhs.heh_),
00553 active_(_rhs.active_)
00554 { ; }
00555
00556
00558 VertexOHalfedgeIterT& operator=(const VertexOHalfedgeIterT<Mesh>& _rhs)
00559 {
00560 mesh_ = _rhs.mesh_;
00561 start_ = _rhs.start_;
00562 heh_ = _rhs.heh_;
00563 active_ = _rhs.active_;
00564 return *this;
00565 }
00566 #else
00567 friend class ConstVertexOHalfedgeIterT<Mesh>;
00568 #endif
00569
00570
00572 bool operator==(const VertexOHalfedgeIterT& _rhs) const {
00573 return ((mesh_ == _rhs.mesh_) &&
00574 (start_ == _rhs.start_) &&
00575 (heh_ == _rhs.heh_) &&
00576 (active_ == _rhs.active_));
00577 }
00578
00579
00581 bool operator!=(const VertexOHalfedgeIterT& _rhs) const {
00582 return !operator==(_rhs);
00583 }
00584
00585
00587 VertexOHalfedgeIterT& operator++() {
00588 assert(mesh_);
00589 active_ = true;
00590 heh_=mesh_->cw_rotated_halfedge_handle(heh_);;
00591 return *this;
00592 }
00593
00594
00596 VertexOHalfedgeIterT& operator--() {
00597 assert(mesh_);
00598 active_ = true;
00599 heh_=mesh_->ccw_rotated_halfedge_handle(heh_);;
00600 return *this;
00601 }
00602
00603
00608 HalfedgeHandle current_halfedge_handle() const {
00609 return heh_;
00610 }
00611
00612
00614 typename Mesh::HalfedgeHandle handle() const {
00615 assert(mesh_);
00616 return heh_;
00617 }
00618
00619
00621 operator typename Mesh::HalfedgeHandle() const {
00622 assert(mesh_);
00623 return heh_;
00624 }
00625
00626
00628 reference operator*() const {
00629 assert(mesh_);
00630 return mesh_->deref(handle());
00631 }
00632
00633
00635 pointer operator->() const {
00636 assert(mesh_);
00637 return &mesh_->deref(handle());
00638 }
00639
00640
00647 operator bool() const {
00648 return heh_.is_valid() && ((start_ != heh_) || (!active_));
00649 }
00650
00651
00652 protected:
00653
00654 mesh_ptr mesh_;
00655 HalfedgeHandle start_, heh_;
00656 bool active_;
00657 };
00658
00659
00660
00661
00662
00663
00668 template <class Mesh>
00669 class ConstVertexOHalfedgeIterT
00670 {
00671 public:
00672
00673
00674
00675
00676 typedef typename Mesh::HalfedgeHandle HalfedgeHandle;
00677
00678 typedef typename Mesh::Halfedge value_type;
00679 typedef typename Mesh::HalfedgeHandle value_handle;
00680
00681 #if 1
00682 typedef const Mesh& mesh_ref;
00683 typedef const Mesh* mesh_ptr;
00684 typedef const typename Mesh::Halfedge& reference;
00685 typedef const typename Mesh::Halfedge* pointer;
00686 #else
00687 typedef Mesh& mesh_ref;
00688 typedef Mesh* mesh_ptr;
00689 typedef typename Mesh::Halfedge& reference;
00690 typedef typename Mesh::Halfedge* pointer;
00691 #endif
00692
00693
00694
00696 ConstVertexOHalfedgeIterT() : mesh_(0), active_(false) {}
00697
00698
00700 ConstVertexOHalfedgeIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
00701 mesh_(&_mesh),
00702 start_(_mesh.halfedge_handle(_start)),
00703 heh_(start_),
00704 active_(false)
00705 { ; }
00706
00707
00709 ConstVertexOHalfedgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
00710 mesh_(&_mesh),
00711 start_(_heh),
00712 heh_(_heh),
00713 active_(false)
00714 { ; }
00715
00716
00718 ConstVertexOHalfedgeIterT(const ConstVertexOHalfedgeIterT& _rhs) :
00719 mesh_(_rhs.mesh_),
00720 start_(_rhs.start_),
00721 heh_(_rhs.heh_),
00722 active_(_rhs.active_)
00723 { ; }
00724
00725
00727 ConstVertexOHalfedgeIterT& operator=(const ConstVertexOHalfedgeIterT<Mesh>& _rhs)
00728 {
00729 mesh_ = _rhs.mesh_;
00730 start_ = _rhs.start_;
00731 heh_ = _rhs.heh_;
00732 active_ = _rhs.active_;
00733 return *this;
00734 }
00735
00736
00737 #if 1
00739 ConstVertexOHalfedgeIterT(const VertexOHalfedgeIterT<Mesh>& _rhs) :
00740 mesh_(_rhs.mesh_),
00741 start_(_rhs.start_),
00742 heh_(_rhs.heh_),
00743 active_(_rhs.active_)
00744 { ; }
00745
00746
00748 ConstVertexOHalfedgeIterT& operator=(const VertexOHalfedgeIterT<Mesh>& _rhs)
00749 {
00750 mesh_ = _rhs.mesh_;
00751 start_ = _rhs.start_;
00752 heh_ = _rhs.heh_;
00753 active_ = _rhs.active_;
00754 return *this;
00755 }
00756 #else
00757 friend class ConstVertexOHalfedgeIterT<Mesh>;
00758 #endif
00759
00760
00762 bool operator==(const ConstVertexOHalfedgeIterT& _rhs) const {
00763 return ((mesh_ == _rhs.mesh_) &&
00764 (start_ == _rhs.start_) &&
00765 (heh_ == _rhs.heh_) &&
00766 (active_ == _rhs.active_));
00767 }
00768
00769
00771 bool operator!=(const ConstVertexOHalfedgeIterT& _rhs) const {
00772 return !operator==(_rhs);
00773 }
00774
00775
00777 ConstVertexOHalfedgeIterT& operator++() {
00778 assert(mesh_);
00779 active_ = true;
00780 heh_=mesh_->cw_rotated_halfedge_handle(heh_);;
00781 return *this;
00782 }
00783
00784
00786 ConstVertexOHalfedgeIterT& operator--() {
00787 assert(mesh_);
00788 active_ = true;
00789 heh_=mesh_->ccw_rotated_halfedge_handle(heh_);;
00790 return *this;
00791 }
00792
00793
00798 HalfedgeHandle current_halfedge_handle() const {
00799 return heh_;
00800 }
00801
00802
00804 typename Mesh::HalfedgeHandle handle() const {
00805 assert(mesh_);
00806 return heh_;
00807 }
00808
00809
00811 operator typename Mesh::HalfedgeHandle() const {
00812 assert(mesh_);
00813 return heh_;
00814 }
00815
00816
00818 reference operator*() const {
00819 assert(mesh_);
00820 return mesh_->deref(handle());
00821 }
00822
00823
00825 pointer operator->() const {
00826 assert(mesh_);
00827 return &mesh_->deref(handle());
00828 }
00829
00830
00837 operator bool() const {
00838 return heh_.is_valid() && ((start_ != heh_) || (!active_));
00839 }
00840
00841
00842 protected:
00843
00844 mesh_ptr mesh_;
00845 HalfedgeHandle start_, heh_;
00846 bool active_;
00847 };
00848
00849
00850
00851
00852
00853
00858 template <class Mesh>
00859 class VertexIHalfedgeIterT
00860 {
00861 public:
00862
00863
00864
00865
00866 typedef typename Mesh::HalfedgeHandle HalfedgeHandle;
00867
00868 typedef typename Mesh::Halfedge value_type;
00869 typedef typename Mesh::HalfedgeHandle value_handle;
00870
00871 #if 0
00872 typedef const Mesh& mesh_ref;
00873 typedef const Mesh* mesh_ptr;
00874 typedef const typename Mesh::Halfedge& reference;
00875 typedef const typename Mesh::Halfedge* pointer;
00876 #else
00877 typedef Mesh& mesh_ref;
00878 typedef Mesh* mesh_ptr;
00879 typedef typename Mesh::Halfedge& reference;
00880 typedef typename Mesh::Halfedge* pointer;
00881 #endif
00882
00883
00884
00886 VertexIHalfedgeIterT() : mesh_(0), active_(false) {}
00887
00888
00890 VertexIHalfedgeIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
00891 mesh_(&_mesh),
00892 start_(_mesh.halfedge_handle(_start)),
00893 heh_(start_),
00894 active_(false)
00895 { ; }
00896
00897
00899 VertexIHalfedgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
00900 mesh_(&_mesh),
00901 start_(_heh),
00902 heh_(_heh),
00903 active_(false)
00904 { ; }
00905
00906
00908 VertexIHalfedgeIterT(const VertexIHalfedgeIterT& _rhs) :
00909 mesh_(_rhs.mesh_),
00910 start_(_rhs.start_),
00911 heh_(_rhs.heh_),
00912 active_(_rhs.active_)
00913 { ; }
00914
00915
00917 VertexIHalfedgeIterT& operator=(const VertexIHalfedgeIterT<Mesh>& _rhs)
00918 {
00919 mesh_ = _rhs.mesh_;
00920 start_ = _rhs.start_;
00921 heh_ = _rhs.heh_;
00922 active_ = _rhs.active_;
00923 return *this;
00924 }
00925
00926
00927 #if 0
00929 VertexIHalfedgeIterT(const VertexIHalfedgeIterT<Mesh>& _rhs) :
00930 mesh_(_rhs.mesh_),
00931 start_(_rhs.start_),
00932 heh_(_rhs.heh_),
00933 active_(_rhs.active_)
00934 { ; }
00935
00936
00938 VertexIHalfedgeIterT& operator=(const VertexIHalfedgeIterT<Mesh>& _rhs)
00939 {
00940 mesh_ = _rhs.mesh_;
00941 start_ = _rhs.start_;
00942 heh_ = _rhs.heh_;
00943 active_ = _rhs.active_;
00944 return *this;
00945 }
00946 #else
00947 friend class ConstVertexIHalfedgeIterT<Mesh>;
00948 #endif
00949
00950
00952 bool operator==(const VertexIHalfedgeIterT& _rhs) const {
00953 return ((mesh_ == _rhs.mesh_) &&
00954 (start_ == _rhs.start_) &&
00955 (heh_ == _rhs.heh_) &&
00956 (active_ == _rhs.active_));
00957 }
00958
00959
00961 bool operator!=(const VertexIHalfedgeIterT& _rhs) const {
00962 return !operator==(_rhs);
00963 }
00964
00965
00967 VertexIHalfedgeIterT& operator++() {
00968 assert(mesh_);
00969 active_ = true;
00970 heh_=mesh_->cw_rotated_halfedge_handle(heh_);;
00971 return *this;
00972 }
00973
00974
00976 VertexIHalfedgeIterT& operator--() {
00977 assert(mesh_);
00978 active_ = true;
00979 heh_=mesh_->ccw_rotated_halfedge_handle(heh_);;
00980 return *this;
00981 }
00982
00983
00988 HalfedgeHandle current_halfedge_handle() const {
00989 return heh_;
00990 }
00991
00992
00994 typename Mesh::HalfedgeHandle handle() const {
00995 assert(mesh_);
00996 return mesh_->opposite_halfedge_handle(heh_);
00997 }
00998
00999
01001 operator typename Mesh::HalfedgeHandle() const {
01002 assert(mesh_);
01003 return mesh_->opposite_halfedge_handle(heh_);
01004 }
01005
01006
01008 reference operator*() const {
01009 assert(mesh_);
01010 return mesh_->deref(handle());
01011 }
01012
01013
01015 pointer operator->() const {
01016 assert(mesh_);
01017 return &mesh_->deref(handle());
01018 }
01019
01020
01027 operator bool() const {
01028 return heh_.is_valid() && ((start_ != heh_) || (!active_));
01029 }
01030
01031
01032 protected:
01033
01034 mesh_ptr mesh_;
01035 HalfedgeHandle start_, heh_;
01036 bool active_;
01037 };
01038
01039
01040
01041
01042
01043
01048 template <class Mesh>
01049 class ConstVertexIHalfedgeIterT
01050 {
01051 public:
01052
01053
01054
01055
01056 typedef typename Mesh::HalfedgeHandle HalfedgeHandle;
01057
01058 typedef typename Mesh::Halfedge value_type;
01059 typedef typename Mesh::HalfedgeHandle value_handle;
01060
01061 #if 1
01062 typedef const Mesh& mesh_ref;
01063 typedef const Mesh* mesh_ptr;
01064 typedef const typename Mesh::Halfedge& reference;
01065 typedef const typename Mesh::Halfedge* pointer;
01066 #else
01067 typedef Mesh& mesh_ref;
01068 typedef Mesh* mesh_ptr;
01069 typedef typename Mesh::Halfedge& reference;
01070 typedef typename Mesh::Halfedge* pointer;
01071 #endif
01072
01073
01074
01076 ConstVertexIHalfedgeIterT() : mesh_(0), active_(false) {}
01077
01078
01080 ConstVertexIHalfedgeIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
01081 mesh_(&_mesh),
01082 start_(_mesh.halfedge_handle(_start)),
01083 heh_(start_),
01084 active_(false)
01085 { ; }
01086
01087
01089 ConstVertexIHalfedgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
01090 mesh_(&_mesh),
01091 start_(_heh),
01092 heh_(_heh),
01093 active_(false)
01094 { ; }
01095
01096
01098 ConstVertexIHalfedgeIterT(const ConstVertexIHalfedgeIterT& _rhs) :
01099 mesh_(_rhs.mesh_),
01100 start_(_rhs.start_),
01101 heh_(_rhs.heh_),
01102 active_(_rhs.active_)
01103 { ; }
01104
01105
01107 ConstVertexIHalfedgeIterT& operator=(const ConstVertexIHalfedgeIterT<Mesh>& _rhs)
01108 {
01109 mesh_ = _rhs.mesh_;
01110 start_ = _rhs.start_;
01111 heh_ = _rhs.heh_;
01112 active_ = _rhs.active_;
01113 return *this;
01114 }
01115
01116
01117 #if 1
01119 ConstVertexIHalfedgeIterT(const VertexIHalfedgeIterT<Mesh>& _rhs) :
01120 mesh_(_rhs.mesh_),
01121 start_(_rhs.start_),
01122 heh_(_rhs.heh_),
01123 active_(_rhs.active_)
01124 { ; }
01125
01126
01128 ConstVertexIHalfedgeIterT& operator=(const VertexIHalfedgeIterT<Mesh>& _rhs)
01129 {
01130 mesh_ = _rhs.mesh_;
01131 start_ = _rhs.start_;
01132 heh_ = _rhs.heh_;
01133 active_ = _rhs.active_;
01134 return *this;
01135 }
01136 #else
01137 friend class ConstVertexIHalfedgeIterT<Mesh>;
01138 #endif
01139
01140
01142 bool operator==(const ConstVertexIHalfedgeIterT& _rhs) const {
01143 return ((mesh_ == _rhs.mesh_) &&
01144 (start_ == _rhs.start_) &&
01145 (heh_ == _rhs.heh_) &&
01146 (active_ == _rhs.active_));
01147 }
01148
01149
01151 bool operator!=(const ConstVertexIHalfedgeIterT& _rhs) const {
01152 return !operator==(_rhs);
01153 }
01154
01155
01157 ConstVertexIHalfedgeIterT& operator++() {
01158 assert(mesh_);
01159 active_ = true;
01160 heh_=mesh_->cw_rotated_halfedge_handle(heh_);;
01161 return *this;
01162 }
01163
01164
01166 ConstVertexIHalfedgeIterT& operator--() {
01167 assert(mesh_);
01168 active_ = true;
01169 heh_=mesh_->ccw_rotated_halfedge_handle(heh_);;
01170 return *this;
01171 }
01172
01173
01178 HalfedgeHandle current_halfedge_handle() const {
01179 return heh_;
01180 }
01181
01182
01184 typename Mesh::HalfedgeHandle handle() const {
01185 assert(mesh_);
01186 return mesh_->opposite_halfedge_handle(heh_);
01187 }
01188
01189
01191 operator typename Mesh::HalfedgeHandle() const {
01192 assert(mesh_);
01193 return mesh_->opposite_halfedge_handle(heh_);
01194 }
01195
01196
01198 reference operator*() const {
01199 assert(mesh_);
01200 return mesh_->deref(handle());
01201 }
01202
01203
01205 pointer operator->() const {
01206 assert(mesh_);
01207 return &mesh_->deref(handle());
01208 }
01209
01210
01217 operator bool() const {
01218 return heh_.is_valid() && ((start_ != heh_) || (!active_));
01219 }
01220
01221
01222 protected:
01223
01224 mesh_ptr mesh_;
01225 HalfedgeHandle start_, heh_;
01226 bool active_;
01227 };
01228
01229
01230
01231
01232
01233
01238 template <class Mesh>
01239 class VertexEdgeIterT
01240 {
01241 public:
01242
01243
01244
01245
01246 typedef typename Mesh::HalfedgeHandle HalfedgeHandle;
01247
01248 typedef typename Mesh::Edge value_type;
01249 typedef typename Mesh::EdgeHandle value_handle;
01250
01251 #if 0
01252 typedef const Mesh& mesh_ref;
01253 typedef const Mesh* mesh_ptr;
01254 typedef const typename Mesh::Edge& reference;
01255 typedef const typename Mesh::Edge* pointer;
01256 #else
01257 typedef Mesh& mesh_ref;
01258 typedef Mesh* mesh_ptr;
01259 typedef typename Mesh::Edge& reference;
01260 typedef typename Mesh::Edge* pointer;
01261 #endif
01262
01263
01264
01266 VertexEdgeIterT() : mesh_(0), active_(false) {}
01267
01268
01270 VertexEdgeIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
01271 mesh_(&_mesh),
01272 start_(_mesh.halfedge_handle(_start)),
01273 heh_(start_),
01274 active_(false)
01275 { ; }
01276
01277
01279 VertexEdgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
01280 mesh_(&_mesh),
01281 start_(_heh),
01282 heh_(_heh),
01283 active_(false)
01284 { ; }
01285
01286
01288 VertexEdgeIterT(const VertexEdgeIterT& _rhs) :
01289 mesh_(_rhs.mesh_),
01290 start_(_rhs.start_),
01291 heh_(_rhs.heh_),
01292 active_(_rhs.active_)
01293 { ; }
01294
01295
01297 VertexEdgeIterT& operator=(const VertexEdgeIterT<Mesh>& _rhs)
01298 {
01299 mesh_ = _rhs.mesh_;
01300 start_ = _rhs.start_;
01301 heh_ = _rhs.heh_;
01302 active_ = _rhs.active_;
01303 return *this;
01304 }
01305
01306
01307 #if 0
01309 VertexEdgeIterT(const VertexEdgeIterT<Mesh>& _rhs) :
01310 mesh_(_rhs.mesh_),
01311 start_(_rhs.start_),
01312 heh_(_rhs.heh_),
01313 active_(_rhs.active_)
01314 { ; }
01315
01316
01318 VertexEdgeIterT& operator=(const VertexEdgeIterT<Mesh>& _rhs)
01319 {
01320 mesh_ = _rhs.mesh_;
01321 start_ = _rhs.start_;
01322 heh_ = _rhs.heh_;
01323 active_ = _rhs.active_;
01324 return *this;
01325 }
01326 #else
01327 friend class ConstVertexEdgeIterT<Mesh>;
01328 #endif
01329
01330
01332 bool operator==(const VertexEdgeIterT& _rhs) const {
01333 return ((mesh_ == _rhs.mesh_) &&
01334 (start_ == _rhs.start_) &&
01335 (heh_ == _rhs.heh_) &&
01336 (active_ == _rhs.active_));
01337 }
01338
01339
01341 bool operator!=(const VertexEdgeIterT& _rhs) const {
01342 return !operator==(_rhs);
01343 }
01344
01345
01347 VertexEdgeIterT& operator++() {
01348 assert(mesh_);
01349 active_ = true;
01350 heh_=mesh_->cw_rotated_halfedge_handle(heh_);;
01351 return *this;
01352 }
01353
01354
01356 VertexEdgeIterT& operator--() {
01357 assert(mesh_);
01358 active_ = true;
01359 heh_=mesh_->ccw_rotated_halfedge_handle(heh_);;
01360 return *this;
01361 }
01362
01363
01368 HalfedgeHandle current_halfedge_handle() const {
01369 return heh_;
01370 }
01371
01372
01374 typename Mesh::EdgeHandle handle() const {
01375 assert(mesh_);
01376 return mesh_->edge_handle(heh_);
01377 }
01378
01379
01381 operator typename Mesh::EdgeHandle() const {
01382 assert(mesh_);
01383 return mesh_->edge_handle(heh_);
01384 }
01385
01386
01388 reference operator*() const {
01389 assert(mesh_);
01390 return mesh_->deref(handle());
01391 }
01392
01393
01395 pointer operator->() const {
01396 assert(mesh_);
01397 return &mesh_->deref(handle());
01398 }
01399
01400
01407 operator bool() const {
01408 return heh_.is_valid() && ((start_ != heh_) || (!active_));
01409 }
01410
01411
01412 protected:
01413
01414 mesh_ptr mesh_;
01415 HalfedgeHandle start_, heh_;
01416 bool active_;
01417 };
01418
01419
01420
01421
01422
01423
01428 template <class Mesh>
01429 class ConstVertexEdgeIterT
01430 {
01431 public:
01432
01433
01434
01435
01436 typedef typename Mesh::HalfedgeHandle HalfedgeHandle;
01437
01438 typedef typename Mesh::Edge value_type;
01439 typedef typename Mesh::EdgeHandle value_handle;
01440
01441 #if 1
01442 typedef const Mesh& mesh_ref;
01443 typedef const Mesh* mesh_ptr;
01444 typedef const typename Mesh::Edge& reference;
01445 typedef const typename Mesh::Edge* pointer;
01446 #else
01447 typedef Mesh& mesh_ref;
01448 typedef Mesh* mesh_ptr;
01449 typedef typename Mesh::Edge& reference;
01450 typedef typename Mesh::Edge* pointer;
01451 #endif
01452
01453
01454
01456 ConstVertexEdgeIterT() : mesh_(0), active_(false) {}
01457
01458
01460 ConstVertexEdgeIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
01461 mesh_(&_mesh),
01462 start_(_mesh.halfedge_handle(_start)),
01463 heh_(start_),
01464 active_(false)
01465 { ; }
01466
01467
01469 ConstVertexEdgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
01470 mesh_(&_mesh),
01471 start_(_heh),
01472 heh_(_heh),
01473 active_(false)
01474 { ; }
01475
01476
01478 ConstVertexEdgeIterT(const ConstVertexEdgeIterT& _rhs) :
01479 mesh_(_rhs.mesh_),
01480 start_(_rhs.start_),
01481 heh_(_rhs.heh_),
01482 active_(_rhs.active_)
01483 { ; }
01484
01485
01487 ConstVertexEdgeIterT& operator=(const ConstVertexEdgeIterT<Mesh>& _rhs)
01488 {
01489 mesh_ = _rhs.mesh_;
01490 start_ = _rhs.start_;
01491 heh_ = _rhs.heh_;
01492 active_ = _rhs.active_;
01493 return *this;
01494 }
01495
01496
01497 #if 1
01499 ConstVertexEdgeIterT(const VertexEdgeIterT<Mesh>& _rhs) :
01500 mesh_(_rhs.mesh_),
01501 start_(_rhs.start_),
01502 heh_(_rhs.heh_),
01503 active_(_rhs.active_)
01504 { ; }
01505
01506
01508 ConstVertexEdgeIterT& operator=(const VertexEdgeIterT<Mesh>& _rhs)
01509 {
01510 mesh_ = _rhs.mesh_;
01511 start_ = _rhs.start_;
01512 heh_ = _rhs.heh_;
01513 active_ = _rhs.active_;
01514 return *this;
01515 }
01516 #else
01517 friend class ConstVertexEdgeIterT<Mesh>;
01518 #endif
01519
01520
01522 bool operator==(const ConstVertexEdgeIterT& _rhs) const {
01523 return ((mesh_ == _rhs.mesh_) &&
01524 (start_ == _rhs.start_) &&
01525 (heh_ == _rhs.heh_) &&
01526 (active_ == _rhs.active_));
01527 }
01528
01529
01531 bool operator!=(const ConstVertexEdgeIterT& _rhs) const {
01532 return !operator==(_rhs);
01533 }
01534
01535
01537 ConstVertexEdgeIterT& operator++() {
01538 assert(mesh_);
01539 active_ = true;
01540 heh_=mesh_->cw_rotated_halfedge_handle(heh_);;
01541 return *this;
01542 }
01543
01544
01546 ConstVertexEdgeIterT& operator--() {
01547 assert(mesh_);
01548 active_ = true;
01549 heh_=mesh_->ccw_rotated_halfedge_handle(heh_);;
01550 return *this;
01551 }
01552
01553
01558 HalfedgeHandle current_halfedge_handle() const {
01559 return heh_;
01560 }
01561
01562
01564 typename Mesh::EdgeHandle handle() const {
01565 assert(mesh_);
01566 return mesh_->edge_handle(heh_);
01567 }
01568
01569
01571 operator typename Mesh::EdgeHandle() const {
01572 assert(mesh_);
01573 return mesh_->edge_handle(heh_);
01574 }
01575
01576
01578 reference operator*() const {
01579 assert(mesh_);
01580 return mesh_->deref(handle());
01581 }
01582
01583
01585 pointer operator->() const {
01586 assert(mesh_);
01587 return &mesh_->deref(handle());
01588 }
01589
01590
01597 operator bool() const {
01598 return heh_.is_valid() && ((start_ != heh_) || (!active_));
01599 }
01600
01601
01602 protected:
01603
01604 mesh_ptr mesh_;
01605 HalfedgeHandle start_, heh_;
01606 bool active_;
01607 };
01608
01609
01610
01611
01612
01613
01618 template <class Mesh>
01619 class VertexFaceIterT
01620 {
01621 public:
01622
01623
01624
01625
01626 typedef typename Mesh::HalfedgeHandle HalfedgeHandle;
01627
01628 typedef typename Mesh::Face value_type;
01629 typedef typename Mesh::FaceHandle value_handle;
01630
01631 #if 0
01632 typedef const Mesh& mesh_ref;
01633 typedef const Mesh* mesh_ptr;
01634 typedef const typename Mesh::Face& reference;
01635 typedef const typename Mesh::Face* pointer;
01636 #else
01637 typedef Mesh& mesh_ref;
01638 typedef Mesh* mesh_ptr;
01639 typedef typename Mesh::Face& reference;
01640 typedef typename Mesh::Face* pointer;
01641 #endif
01642
01643
01644
01646 VertexFaceIterT() : mesh_(0), active_(false) {}
01647
01648
01650 VertexFaceIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
01651 mesh_(&_mesh),
01652 start_(_mesh.halfedge_handle(_start)),
01653 heh_(start_),
01654 active_(false)
01655 { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
01656
01657
01659 VertexFaceIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
01660 mesh_(&_mesh),
01661 start_(_heh),
01662 heh_(_heh),
01663 active_(false)
01664 { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
01665
01666
01668 VertexFaceIterT(const VertexFaceIterT& _rhs) :
01669 mesh_(_rhs.mesh_),
01670 start_(_rhs.start_),
01671 heh_(_rhs.heh_),
01672 active_(_rhs.active_)
01673 { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
01674
01675
01677 VertexFaceIterT& operator=(const VertexFaceIterT<Mesh>& _rhs)
01678 {
01679 mesh_ = _rhs.mesh_;
01680 start_ = _rhs.start_;
01681 heh_ = _rhs.heh_;
01682 active_ = _rhs.active_;
01683 return *this;
01684 }
01685
01686
01687 #if 0
01689 VertexFaceIterT(const VertexFaceIterT<Mesh>& _rhs) :
01690 mesh_(_rhs.mesh_),
01691 start_(_rhs.start_),
01692 heh_(_rhs.heh_),
01693 active_(_rhs.active_)
01694 { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
01695
01696
01698 VertexFaceIterT& operator=(const VertexFaceIterT<Mesh>& _rhs)
01699 {
01700 mesh_ = _rhs.mesh_;
01701 start_ = _rhs.start_;
01702 heh_ = _rhs.heh_;
01703 active_ = _rhs.active_;
01704 return *this;
01705 }
01706 #else
01707 friend class ConstVertexFaceIterT<Mesh>;
01708 #endif
01709
01710
01712 bool operator==(const VertexFaceIterT& _rhs) const {
01713 return ((mesh_ == _rhs.mesh_) &&
01714 (start_ == _rhs.start_) &&
01715 (heh_ == _rhs.heh_) &&
01716 (active_ == _rhs.active_));
01717 }
01718
01719
01721 bool operator!=(const VertexFaceIterT& _rhs) const {
01722 return !operator==(_rhs);
01723 }
01724
01725
01727 VertexFaceIterT& operator++() {
01728 assert(mesh_);
01729 active_ = true;
01730 do heh_=mesh_->cw_rotated_halfedge_handle(heh_); while ((*this) && (!handle().is_valid()));;
01731 return *this;
01732 }
01733
01734
01736 VertexFaceIterT& operator--() {
01737 assert(mesh_);
01738 active_ = true;
01739 do heh_=mesh_->ccw_rotated_halfedge_handle(heh_); while ((*this) && (!handle().is_valid()));;
01740 return *this;
01741 }
01742
01743
01748 HalfedgeHandle current_halfedge_handle() const {
01749 return heh_;
01750 }
01751
01752
01754 typename Mesh::FaceHandle handle() const {
01755 assert(mesh_);
01756 return mesh_->face_handle(heh_);
01757 }
01758
01759
01761 operator typename Mesh::FaceHandle() const {
01762 assert(mesh_);
01763 return mesh_->face_handle(heh_);
01764 }
01765
01766
01768 reference operator*() const {
01769 assert(mesh_);
01770 return mesh_->deref(handle());
01771 }
01772
01773
01775 pointer operator->() const {
01776 assert(mesh_);
01777 return &mesh_->deref(handle());
01778 }
01779
01780
01787 operator bool() const {
01788 return heh_.is_valid() && ((start_ != heh_) || (!active_));
01789 }
01790
01791
01792 protected:
01793
01794 mesh_ptr mesh_;
01795 HalfedgeHandle start_, heh_;
01796 bool active_;
01797 };
01798
01799
01800
01801
01802
01803
01808 template <class Mesh>
01809 class ConstVertexFaceIterT
01810 {
01811 public:
01812
01813
01814
01815
01816 typedef typename Mesh::HalfedgeHandle HalfedgeHandle;
01817
01818 typedef typename Mesh::Face value_type;
01819 typedef typename Mesh::FaceHandle value_handle;
01820
01821 #if 1
01822 typedef const Mesh& mesh_ref;
01823 typedef const Mesh* mesh_ptr;
01824 typedef const typename Mesh::Face& reference;
01825 typedef const typename Mesh::Face* pointer;
01826 #else
01827 typedef Mesh& mesh_ref;
01828 typedef Mesh* mesh_ptr;
01829 typedef typename Mesh::Face& reference;
01830 typedef typename Mesh::Face* pointer;
01831 #endif
01832
01833
01834
01836 ConstVertexFaceIterT() : mesh_(0), active_(false) {}
01837
01838
01840 ConstVertexFaceIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
01841 mesh_(&_mesh),
01842 start_(_mesh.halfedge_handle(_start)),
01843 heh_(start_),
01844 active_(false)
01845 { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
01846
01847
01849 ConstVertexFaceIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
01850 mesh_(&_mesh),
01851 start_(_heh),
01852 heh_(_heh),
01853 active_(false)
01854 { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
01855
01856
01858 ConstVertexFaceIterT(const ConstVertexFaceIterT& _rhs) :
01859 mesh_(_rhs.mesh_),
01860 start_(_rhs.start_),
01861 heh_(_rhs.heh_),
01862 active_(_rhs.active_)
01863 { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
01864
01865
01867 ConstVertexFaceIterT& operator=(const ConstVertexFaceIterT<Mesh>& _rhs)
01868 {
01869 mesh_ = _rhs.mesh_;
01870 start_ = _rhs.start_;
01871 heh_ = _rhs.heh_;
01872 active_ = _rhs.active_;
01873 return *this;
01874 }
01875
01876
01877 #if 1
01879 ConstVertexFaceIterT(const VertexFaceIterT<Mesh>& _rhs) :
01880 mesh_(_rhs.mesh_),
01881 start_(_rhs.start_),
01882 heh_(_rhs.heh_),
01883 active_(_rhs.active_)
01884 { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
01885
01886
01888 ConstVertexFaceIterT& operator=(const VertexFaceIterT<Mesh>& _rhs)
01889 {
01890 mesh_ = _rhs.mesh_;
01891 start_ = _rhs.start_;
01892 heh_ = _rhs.heh_;
01893 active_ = _rhs.active_;
01894 return *this;
01895 }
01896 #else
01897 friend class ConstVertexFaceIterT<Mesh>;
01898 #endif
01899
01900
01902 bool operator==(const ConstVertexFaceIterT& _rhs) const {
01903 return ((mesh_ == _rhs.mesh_) &&
01904 (start_ == _rhs.start_) &&
01905 (heh_ == _rhs.heh_) &&
01906 (active_ == _rhs.active_));
01907 }
01908
01909
01911 bool operator!=(const ConstVertexFaceIterT& _rhs) const {
01912 return !operator==(_rhs);
01913 }
01914
01915
01917 ConstVertexFaceIterT& operator++() {
01918 assert(mesh_);
01919 active_ = true;
01920 do heh_=mesh_->cw_rotated_halfedge_handle(heh_); while ((*this) && (!handle().is_valid()));;
01921 return *this;
01922 }
01923
01924
01926 ConstVertexFaceIterT& operator--() {
01927 assert(mesh_);
01928 active_ = true;
01929 do heh_=mesh_->ccw_rotated_halfedge_handle(heh_); while ((*this) && (!handle().is_valid()));;
01930 return *this;
01931 }
01932
01933
01938 HalfedgeHandle current_halfedge_handle() const {
01939 return heh_;
01940 }
01941
01942
01944 typename Mesh::FaceHandle handle() const {
01945 assert(mesh_);
01946 return mesh_->face_handle(heh_);
01947 }
01948
01949
01951 operator typename Mesh::FaceHandle() const {
01952 assert(mesh_);
01953 return mesh_->face_handle(heh_);
01954 }
01955
01956
01958 reference operator*() const {
01959 assert(mesh_);
01960 return mesh_->deref(handle());
01961 }
01962
01963
01965 pointer operator->() const {
01966 assert(mesh_);
01967 return &mesh_->deref(handle());
01968 }
01969
01970
01977 operator bool() const {
01978 return heh_.is_valid() && ((start_ != heh_) || (!active_));
01979 }
01980
01981
01982 protected:
01983
01984 mesh_ptr mesh_;
01985 HalfedgeHandle start_, heh_;
01986 bool active_;
01987 };
01988
01989
01990
01991
01992
01993
01998 template <class Mesh>
01999 class FaceVertexIterT
02000 {
02001 public:
02002
02003
02004
02005
02006 typedef typename Mesh::HalfedgeHandle HalfedgeHandle;
02007
02008 typedef typename Mesh::Vertex value_type;
02009 typedef typename Mesh::VertexHandle value_handle;
02010
02011 #if 0
02012 typedef const Mesh& mesh_ref;
02013 typedef const Mesh* mesh_ptr;
02014 typedef const typename Mesh::Vertex& reference;
02015 typedef const typename Mesh::Vertex* pointer;
02016 #else
02017 typedef Mesh& mesh_ref;
02018 typedef Mesh* mesh_ptr;
02019 typedef typename Mesh::Vertex& reference;
02020 typedef typename Mesh::Vertex* pointer;
02021 #endif
02022
02023
02024
02026 FaceVertexIterT() : mesh_(0), active_(false) {}
02027
02028
02030 FaceVertexIterT(mesh_ref _mesh, typename Mesh::FaceHandle _start) :
02031 mesh_(&_mesh),
02032 start_(_mesh.halfedge_handle(_start)),
02033 heh_(start_),
02034 active_(false)
02035 { ; }
02036
02037
02039 FaceVertexIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
02040 mesh_(&_mesh),
02041 start_(_heh),
02042 heh_(_heh),
02043 active_(false)
02044 { ; }
02045
02046
02048 FaceVertexIterT(const FaceVertexIterT& _rhs) :
02049 mesh_(_rhs.mesh_),
02050 start_(_rhs.start_),
02051 heh_(_rhs.heh_),
02052 active_(_rhs.active_)
02053 { ; }
02054
02055
02057 FaceVertexIterT& operator=(const FaceVertexIterT<Mesh>& _rhs)
02058 {
02059 mesh_ = _rhs.mesh_;
02060 start_ = _rhs.start_;
02061 heh_ = _rhs.heh_;
02062 active_ = _rhs.active_;
02063 return *this;
02064 }
02065
02066
02067 #if 0
02069 FaceVertexIterT(const FaceVertexIterT<Mesh>& _rhs) :
02070 mesh_(_rhs.mesh_),
02071 start_(_rhs.start_),
02072 heh_(_rhs.heh_),
02073 active_(_rhs.active_)
02074 { ; }
02075
02076
02078 FaceVertexIterT& operator=(const FaceVertexIterT<Mesh>& _rhs)
02079 {
02080 mesh_ = _rhs.mesh_;
02081 start_ = _rhs.start_;
02082 heh_ = _rhs.heh_;
02083 active_ = _rhs.active_;
02084 return *this;
02085 }
02086 #else
02087 friend class ConstFaceVertexIterT<Mesh>;
02088 #endif
02089
02090
02092 bool operator==(const FaceVertexIterT& _rhs) const {
02093 return ((mesh_ == _rhs.mesh_) &&
02094 (start_ == _rhs.start_) &&
02095 (heh_ == _rhs.heh_) &&
02096 (active_ == _rhs.active_));
02097 }
02098
02099
02101 bool operator!=(const FaceVertexIterT& _rhs) const {
02102 return !operator==(_rhs);
02103 }
02104
02105
02107 FaceVertexIterT& operator++() {
02108 assert(mesh_);
02109 active_ = true;
02110 heh_=mesh_->next_halfedge_handle(heh_);;
02111 return *this;
02112 }
02113
02114
02116 FaceVertexIterT& operator--() {
02117 assert(mesh_);
02118 active_ = true;
02119 heh_=mesh_->prev_halfedge_handle(heh_);;
02120 return *this;
02121 }
02122
02123
02128 HalfedgeHandle current_halfedge_handle() const {
02129 return heh_;
02130 }
02131
02132
02134 typename Mesh::VertexHandle handle() const {
02135 assert(mesh_);
02136 return mesh_->to_vertex_handle(heh_);
02137 }
02138
02139
02141 operator typename Mesh::VertexHandle() const {
02142 assert(mesh_);
02143 return mesh_->to_vertex_handle(heh_);
02144 }
02145
02146
02148 reference operator*() const {
02149 assert(mesh_);
02150 return mesh_->deref(handle());
02151 }
02152
02153
02155 pointer operator->() const {
02156 assert(mesh_);
02157 return &mesh_->deref(handle());
02158 }
02159
02160
02167 operator bool() const {
02168 return heh_.is_valid() && ((start_ != heh_) || (!active_));
02169 }
02170
02171
02172 protected:
02173
02174 mesh_ptr mesh_;
02175 HalfedgeHandle start_, heh_;
02176 bool active_;
02177 };
02178
02179
02180
02181
02182
02183
02188 template <class Mesh>
02189 class ConstFaceVertexIterT
02190 {
02191 public:
02192
02193
02194
02195
02196 typedef typename Mesh::HalfedgeHandle HalfedgeHandle;
02197
02198 typedef typename Mesh::Vertex value_type;
02199 typedef typename Mesh::VertexHandle value_handle;
02200
02201 #if 1
02202 typedef const Mesh& mesh_ref;
02203 typedef const Mesh* mesh_ptr;
02204 typedef const typename Mesh::Vertex& reference;
02205 typedef const typename Mesh::Vertex* pointer;
02206 #else
02207 typedef Mesh& mesh_ref;
02208 typedef Mesh* mesh_ptr;
02209 typedef typename Mesh::Vertex& reference;
02210 typedef typename Mesh::Vertex* pointer;
02211 #endif
02212
02213
02214
02216 ConstFaceVertexIterT() : mesh_(0), active_(false) {}
02217
02218
02220 ConstFaceVertexIterT(mesh_ref _mesh, typename Mesh::FaceHandle _start) :
02221 mesh_(&_mesh),
02222 start_(_mesh.halfedge_handle(_start)),
02223 heh_(start_),
02224 active_(false)
02225 { ; }
02226
02227
02229 ConstFaceVertexIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
02230 mesh_(&_mesh),
02231 start_(_heh),
02232 heh_(_heh),
02233 active_(false)
02234 { ; }
02235
02236
02238 ConstFaceVertexIterT(const ConstFaceVertexIterT& _rhs) :
02239 mesh_(_rhs.mesh_),
02240 start_(_rhs.start_),
02241 heh_(_rhs.heh_),
02242 active_(_rhs.active_)
02243 { ; }
02244
02245
02247 ConstFaceVertexIterT& operator=(const ConstFaceVertexIterT<Mesh>& _rhs)
02248 {
02249 mesh_ = _rhs.mesh_;
02250 start_ = _rhs.start_;
02251 heh_ = _rhs.heh_;
02252 active_ = _rhs.active_;
02253 return *this;
02254 }
02255
02256
02257 #if 1
02259 ConstFaceVertexIterT(const FaceVertexIterT<Mesh>& _rhs) :
02260 mesh_(_rhs.mesh_),
02261 start_(_rhs.start_),
02262 heh_(_rhs.heh_),
02263 active_(_rhs.active_)
02264 { ; }
02265
02266
02268 ConstFaceVertexIterT& operator=(const FaceVertexIterT<Mesh>& _rhs)
02269 {
02270 mesh_ = _rhs.mesh_;
02271 start_ = _rhs.start_;
02272 heh_ = _rhs.heh_;
02273 active_ = _rhs.active_;
02274 return *this;
02275 }
02276 #else
02277 friend class ConstFaceVertexIterT<Mesh>;
02278 #endif
02279
02280
02282 bool operator==(const ConstFaceVertexIterT& _rhs) const {
02283 return ((mesh_ == _rhs.mesh_) &&
02284 (start_ == _rhs.start_) &&
02285 (heh_ == _rhs.heh_) &&
02286 (active_ == _rhs.active_));
02287 }
02288
02289
02291 bool operator!=(const ConstFaceVertexIterT& _rhs) const {
02292 return !operator==(_rhs);
02293 }
02294
02295
02297 ConstFaceVertexIterT& operator++() {
02298 assert(mesh_);
02299 active_ = true;
02300 heh_=mesh_->next_halfedge_handle(heh_);;
02301 return *this;
02302 }
02303
02304
02306 ConstFaceVertexIterT& operator--() {
02307 assert(mesh_);
02308 active_ = true;
02309 heh_=mesh_->prev_halfedge_handle(heh_);;
02310 return *this;
02311 }
02312
02313
02318 HalfedgeHandle current_halfedge_handle() const {
02319 return heh_;
02320 }
02321
02322
02324 typename Mesh::VertexHandle handle() const {
02325 assert(mesh_);
02326 return mesh_->to_vertex_handle(heh_);
02327 }
02328
02329
02331 operator typename Mesh::VertexHandle() const {
02332 assert(mesh_);
02333 return mesh_->to_vertex_handle(heh_);
02334 }
02335
02336
02338 reference operator*() const {
02339 assert(mesh_);
02340 return mesh_->deref(handle());
02341 }
02342
02343
02345 pointer operator->() const {
02346 assert(mesh_);
02347 return &mesh_->deref(handle());
02348 }
02349
02350
02357 operator bool() const {
02358 return heh_.is_valid() && ((start_ != heh_) || (!active_));
02359 }
02360
02361
02362 protected:
02363
02364 mesh_ptr mesh_;
02365 HalfedgeHandle start_, heh_;
02366 bool active_;
02367 };
02368
02369
02370
02371
02372
02373
02378 template <class Mesh>
02379 class FaceHalfedgeIterT
02380 {
02381 public:
02382
02383
02384
02385
02386 typedef typename Mesh::HalfedgeHandle HalfedgeHandle;
02387
02388 typedef typename Mesh::Halfedge value_type;
02389 typedef typename Mesh::HalfedgeHandle value_handle;
02390
02391 #if 0
02392 typedef const Mesh& mesh_ref;
02393 typedef const Mesh* mesh_ptr;
02394 typedef const typename Mesh::Halfedge& reference;
02395 typedef const typename Mesh::Halfedge* pointer;
02396 #else
02397 typedef Mesh& mesh_ref;
02398 typedef Mesh* mesh_ptr;
02399 typedef typename Mesh::Halfedge& reference;
02400 typedef typename Mesh::Halfedge* pointer;
02401 #endif
02402
02403
02404
02406 FaceHalfedgeIterT() : mesh_(0), active_(false) {}
02407
02408
02410 FaceHalfedgeIterT(mesh_ref _mesh, typename Mesh::FaceHandle _start) :
02411 mesh_(&_mesh),
02412 start_(_mesh.halfedge_handle(_start)),
02413 heh_(start_),
02414 active_(false)
02415 { ; }
02416
02417
02419 FaceHalfedgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
02420 mesh_(&_mesh),
02421 start_(_heh),
02422 heh_(_heh),
02423 active_(false)
02424 { ; }
02425
02426
02428 FaceHalfedgeIterT(const FaceHalfedgeIterT& _rhs) :
02429 mesh_(_rhs.mesh_),
02430 start_(_rhs.start_),
02431 heh_(_rhs.heh_),
02432 active_(_rhs.active_)
02433 { ; }
02434
02435
02437 FaceHalfedgeIterT& operator=(const FaceHalfedgeIterT<Mesh>& _rhs)
02438 {
02439 mesh_ = _rhs.mesh_;
02440 start_ = _rhs.start_;
02441 heh_ = _rhs.heh_;
02442 active_ = _rhs.active_;
02443 return *this;
02444 }
02445
02446
02447 #if 0
02449 FaceHalfedgeIterT(const FaceHalfedgeIterT<Mesh>& _rhs) :
02450 mesh_(_rhs.mesh_),
02451 start_(_rhs.start_),
02452 heh_(_rhs.heh_),
02453 active_(_rhs.active_)
02454 { ; }
02455
02456
02458 FaceHalfedgeIterT& operator=(const FaceHalfedgeIterT<Mesh>& _rhs)
02459 {
02460 mesh_ = _rhs.mesh_;
02461 start_ = _rhs.start_;
02462 heh_ = _rhs.heh_;
02463 active_ = _rhs.active_;
02464 return *this;
02465 }
02466 #else
02467 friend class ConstFaceHalfedgeIterT<Mesh>;
02468 #endif
02469
02470
02472 bool operator==(const FaceHalfedgeIterT& _rhs) const {
02473 return ((mesh_ == _rhs.mesh_) &&
02474 (start_ == _rhs.start_) &&
02475 (heh_ == _rhs.heh_) &&
02476 (active_ == _rhs.active_));
02477 }
02478
02479
02481 bool operator!=(const FaceHalfedgeIterT& _rhs) const {
02482 return !operator==(_rhs);
02483 }
02484
02485
02487 FaceHalfedgeIterT& operator++() {
02488 assert(mesh_);
02489 active_ = true;
02490 heh_=mesh_->next_halfedge_handle(heh_);;
02491 return *this;
02492 }
02493
02494
02496 FaceHalfedgeIterT& operator--() {
02497 assert(mesh_);
02498 active_ = true;
02499 heh_=mesh_->prev_halfedge_handle(heh_);;
02500 return *this;
02501 }
02502
02503
02508 HalfedgeHandle current_halfedge_handle() const {
02509 return heh_;
02510 }
02511
02512
02514 typename Mesh::HalfedgeHandle handle() const {
02515 assert(mesh_);
02516 return heh_;
02517 }
02518
02519
02521 operator typename Mesh::HalfedgeHandle() const {
02522 assert(mesh_);
02523 return heh_;
02524 }
02525
02526
02528 reference operator*() const {
02529 assert(mesh_);
02530 return mesh_->deref(handle());
02531 }
02532
02533
02535 pointer operator->() const {
02536 assert(mesh_);
02537 return &mesh_->deref(handle());
02538 }
02539
02540
02547 operator bool() const {
02548 return heh_.is_valid() && ((start_ != heh_) || (!active_));
02549 }
02550
02551
02552 protected:
02553
02554 mesh_ptr mesh_;
02555 HalfedgeHandle start_, heh_;
02556 bool active_;
02557 };
02558
02559
02560
02561
02562
02563
02568 template <class Mesh>
02569 class ConstFaceHalfedgeIterT
02570 {
02571 public:
02572
02573
02574
02575
02576 typedef typename Mesh::HalfedgeHandle HalfedgeHandle;
02577
02578 typedef typename Mesh::Halfedge value_type;
02579 typedef typename Mesh::HalfedgeHandle value_handle;
02580
02581 #if 1
02582 typedef const Mesh& mesh_ref;
02583 typedef const Mesh* mesh_ptr;
02584 typedef const typename Mesh::Halfedge& reference;
02585 typedef const typename Mesh::Halfedge* pointer;
02586 #else
02587 typedef Mesh& mesh_ref;
02588 typedef Mesh* mesh_ptr;
02589 typedef typename Mesh::Halfedge& reference;
02590 typedef typename Mesh::Halfedge* pointer;
02591 #endif
02592
02593
02594
02596 ConstFaceHalfedgeIterT() : mesh_(0), active_(false) {}
02597
02598
02600 ConstFaceHalfedgeIterT(mesh_ref _mesh, typename Mesh::FaceHandle _start) :
02601 mesh_(&_mesh),
02602 start_(_mesh.halfedge_handle(_start)),
02603 heh_(start_),
02604 active_(false)
02605 { ; }
02606
02607
02609 ConstFaceHalfedgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
02610 mesh_(&_mesh),
02611 start_(_heh),
02612 heh_(_heh),
02613 active_(false)
02614 { ; }
02615
02616
02618 ConstFaceHalfedgeIterT(const ConstFaceHalfedgeIterT& _rhs) :
02619 mesh_(_rhs.mesh_),
02620 start_(_rhs.start_),
02621 heh_(_rhs.heh_),
02622 active_(_rhs.active_)
02623 { ; }
02624
02625
02627 ConstFaceHalfedgeIterT& operator=(const ConstFaceHalfedgeIterT<Mesh>& _rhs)
02628 {
02629 mesh_ = _rhs.mesh_;
02630 start_ = _rhs.start_;
02631 heh_ = _rhs.heh_;
02632 active_ = _rhs.active_;
02633 return *this;
02634 }
02635
02636
02637 #if 1
02639 ConstFaceHalfedgeIterT(const FaceHalfedgeIterT<Mesh>& _rhs) :
02640 mesh_(_rhs.mesh_),
02641 start_(_rhs.start_),
02642 heh_(_rhs.heh_),
02643 active_(_rhs.active_)
02644 { ; }
02645
02646
02648 ConstFaceHalfedgeIterT& operator=(const FaceHalfedgeIterT<Mesh>& _rhs)
02649 {
02650 mesh_ = _rhs.mesh_;
02651 start_ = _rhs.start_;
02652 heh_ = _rhs.heh_;
02653 active_ = _rhs.active_;
02654 return *this;
02655 }
02656 #else
02657 friend class ConstFaceHalfedgeIterT<Mesh>;
02658 #endif
02659
02660
02662 bool operator==(const ConstFaceHalfedgeIterT& _rhs) const {
02663 return ((mesh_ == _rhs.mesh_) &&
02664 (start_ == _rhs.start_) &&
02665 (heh_ == _rhs.heh_) &&
02666 (active_ == _rhs.active_));
02667 }
02668
02669
02671 bool operator!=(const ConstFaceHalfedgeIterT& _rhs) const {
02672 return !operator==(_rhs);
02673 }
02674
02675
02677 ConstFaceHalfedgeIterT& operator++() {
02678 assert(mesh_);
02679 active_ = true;
02680 heh_=mesh_->next_halfedge_handle(heh_);;
02681 return *this;
02682 }
02683
02684
02686 ConstFaceHalfedgeIterT& operator--() {
02687 assert(mesh_);
02688 active_ = true;
02689 heh_=mesh_->prev_halfedge_handle(heh_);;
02690 return *this;
02691 }
02692
02693
02698 HalfedgeHandle current_halfedge_handle() const {
02699 return heh_;
02700 }
02701
02702
02704 typename Mesh::HalfedgeHandle handle() const {
02705 assert(mesh_);
02706 return heh_;
02707 }
02708
02709
02711 operator typename Mesh::HalfedgeHandle() const {
02712 assert(mesh_);
02713 return heh_;
02714 }
02715
02716
02718 reference operator*() const {
02719 assert(mesh_);
02720 return mesh_->deref(handle());
02721 }
02722
02723
02725 pointer operator->() const {
02726 assert(mesh_);
02727 return &mesh_->deref(handle());
02728 }
02729
02730
02737 operator bool() const {
02738 return heh_.is_valid() && ((start_ != heh_) || (!active_));
02739 }
02740
02741
02742 protected:
02743
02744 mesh_ptr mesh_;
02745 HalfedgeHandle start_, heh_;
02746 bool active_;
02747 };
02748
02749
02750
02751
02752
02753
02758 template <class Mesh>
02759 class FaceEdgeIterT
02760 {
02761 public:
02762
02763
02764
02765
02766 typedef typename Mesh::HalfedgeHandle HalfedgeHandle;
02767
02768 typedef typename Mesh::Edge value_type;
02769 typedef typename Mesh::EdgeHandle value_handle;
02770
02771 #if 0
02772 typedef const Mesh& mesh_ref;
02773 typedef const Mesh* mesh_ptr;
02774 typedef const typename Mesh::Edge& reference;
02775 typedef const typename Mesh::Edge* pointer;
02776 #else
02777 typedef Mesh& mesh_ref;
02778 typedef Mesh* mesh_ptr;
02779 typedef typename Mesh::Edge& reference;
02780 typedef typename Mesh::Edge* pointer;
02781 #endif
02782
02783
02784
02786 FaceEdgeIterT() : mesh_(0), active_(false) {}
02787
02788
02790 FaceEdgeIterT(mesh_ref _mesh, typename Mesh::FaceHandle _start) :
02791 mesh_(&_mesh),
02792 start_(_mesh.halfedge_handle(_start)),
02793 heh_(start_),
02794 active_(false)
02795 { ; }
02796
02797
02799 FaceEdgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
02800 mesh_(&_mesh),
02801 start_(_heh),
02802 heh_(_heh),
02803 active_(false)
02804 { ; }
02805
02806
02808 FaceEdgeIterT(const FaceEdgeIterT& _rhs) :
02809 mesh_(_rhs.mesh_),
02810 start_(_rhs.start_),
02811 heh_(_rhs.heh_),
02812 active_(_rhs.active_)
02813 { ; }
02814
02815
02817 FaceEdgeIterT& operator=(const FaceEdgeIterT<Mesh>& _rhs)
02818 {
02819 mesh_ = _rhs.mesh_;
02820 start_ = _rhs.start_;
02821 heh_ = _rhs.heh_;
02822 active_ = _rhs.active_;
02823 return *this;
02824 }
02825
02826
02827 #if 0
02829 FaceEdgeIterT(const FaceEdgeIterT<Mesh>& _rhs) :
02830 mesh_(_rhs.mesh_),
02831 start_(_rhs.start_),
02832 heh_(_rhs.heh_),
02833 active_(_rhs.active_)
02834 { ; }
02835
02836
02838 FaceEdgeIterT& operator=(const FaceEdgeIterT<Mesh>& _rhs)
02839 {
02840 mesh_ = _rhs.mesh_;
02841 start_ = _rhs.start_;
02842 heh_ = _rhs.heh_;
02843 active_ = _rhs.active_;
02844 return *this;
02845 }
02846 #else
02847 friend class ConstFaceEdgeIterT<Mesh>;
02848 #endif
02849
02850
02852 bool operator==(const FaceEdgeIterT& _rhs) const {
02853 return ((mesh_ == _rhs.mesh_) &&
02854 (start_ == _rhs.start_) &&
02855 (heh_ == _rhs.heh_) &&
02856 (active_ == _rhs.active_));
02857 }
02858
02859
02861 bool operator!=(const FaceEdgeIterT& _rhs) const {
02862 return !operator==(_rhs);
02863 }
02864
02865
02867 FaceEdgeIterT& operator++() {
02868 assert(mesh_);
02869 active_ = true;
02870 heh_=mesh_->next_halfedge_handle(heh_);;
02871 return *this;
02872 }
02873
02874
02876 FaceEdgeIterT& operator--() {
02877 assert(mesh_);
02878 active_ = true;
02879 heh_=mesh_->prev_halfedge_handle(heh_);;
02880 return *this;
02881 }
02882
02883
02888 HalfedgeHandle current_halfedge_handle() const {
02889 return heh_;
02890 }
02891
02892
02894 typename Mesh::EdgeHandle handle() const {
02895 assert(mesh_);
02896 return mesh_->edge_handle(heh_);
02897 }
02898
02899
02901 operator typename Mesh::EdgeHandle() const {
02902 assert(mesh_);
02903 return mesh_->edge_handle(heh_);
02904 }
02905
02906
02908 reference operator*() const {
02909 assert(mesh_);
02910 return mesh_->deref(handle());
02911 }
02912
02913
02915 pointer operator->() const {
02916 assert(mesh_);
02917 return &mesh_->deref(handle());
02918 }
02919
02920
02927 operator bool() const {
02928 return heh_.is_valid() && ((start_ != heh_) || (!active_));
02929 }
02930
02931
02932 protected:
02933
02934 mesh_ptr mesh_;
02935 HalfedgeHandle start_, heh_;
02936 bool active_;
02937 };
02938
02939
02940
02941
02942
02943
02948 template <class Mesh>
02949 class ConstFaceEdgeIterT
02950 {
02951 public:
02952
02953
02954
02955
02956 typedef typename Mesh::HalfedgeHandle HalfedgeHandle;
02957
02958 typedef typename Mesh::Edge value_type;
02959 typedef typename Mesh::EdgeHandle value_handle;
02960
02961 #if 1
02962 typedef const Mesh& mesh_ref;
02963 typedef const Mesh* mesh_ptr;
02964 typedef const typename Mesh::Edge& reference;
02965 typedef const typename Mesh::Edge* pointer;
02966 #else
02967 typedef Mesh& mesh_ref;
02968 typedef Mesh* mesh_ptr;
02969 typedef typename Mesh::Edge& reference;
02970 typedef typename Mesh::Edge* pointer;
02971 #endif
02972
02973
02974
02976 ConstFaceEdgeIterT() : mesh_(0), active_(false) {}
02977
02978
02980 ConstFaceEdgeIterT(mesh_ref _mesh, typename Mesh::FaceHandle _start) :
02981 mesh_(&_mesh),
02982 start_(_mesh.halfedge_handle(_start)),
02983 heh_(start_),
02984 active_(false)
02985 { ; }
02986
02987
02989 ConstFaceEdgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
02990 mesh_(&_mesh),
02991 start_(_heh),
02992 heh_(_heh),
02993 active_(false)
02994 { ; }
02995
02996
02998 ConstFaceEdgeIterT(const ConstFaceEdgeIterT& _rhs) :
02999 mesh_(_rhs.mesh_),
03000 start_(_rhs.start_),
03001 heh_(_rhs.heh_),
03002 active_(_rhs.active_)
03003 { ; }
03004
03005
03007 ConstFaceEdgeIterT& operator=(const ConstFaceEdgeIterT<Mesh>& _rhs)
03008 {
03009 mesh_ = _rhs.mesh_;
03010 start_ = _rhs.start_;
03011 heh_ = _rhs.heh_;
03012 active_ = _rhs.active_;
03013 return *this;
03014 }
03015
03016
03017 #if 1
03019 ConstFaceEdgeIterT(const FaceEdgeIterT<Mesh>& _rhs) :
03020 mesh_(_rhs.mesh_),
03021 start_(_rhs.start_),
03022 heh_(_rhs.heh_),
03023 active_(_rhs.active_)
03024 { ; }
03025
03026
03028 ConstFaceEdgeIterT& operator=(const FaceEdgeIterT<Mesh>& _rhs)
03029 {
03030 mesh_ = _rhs.mesh_;
03031 start_ = _rhs.start_;
03032 heh_ = _rhs.heh_;
03033 active_ = _rhs.active_;
03034 return *this;
03035 }
03036 #else
03037 friend class ConstFaceEdgeIterT<Mesh>;
03038 #endif
03039
03040
03042 bool operator==(const ConstFaceEdgeIterT& _rhs) const {
03043 return ((mesh_ == _rhs.mesh_) &&
03044 (start_ == _rhs.start_) &&
03045 (heh_ == _rhs.heh_) &&
03046 (active_ == _rhs.active_));
03047 }
03048
03049
03051 bool operator!=(const ConstFaceEdgeIterT& _rhs) const {
03052 return !operator==(_rhs);
03053 }
03054
03055
03057 ConstFaceEdgeIterT& operator++() {
03058 assert(mesh_);
03059 active_ = true;
03060 heh_=mesh_->next_halfedge_handle(heh_);;
03061 return *this;
03062 }
03063
03064
03066 ConstFaceEdgeIterT& operator--() {
03067 assert(mesh_);
03068 active_ = true;
03069 heh_=mesh_->prev_halfedge_handle(heh_);;
03070 return *this;
03071 }
03072
03073
03078 HalfedgeHandle current_halfedge_handle() const {
03079 return heh_;
03080 }
03081
03082
03084 typename Mesh::EdgeHandle handle() const {
03085 assert(mesh_);
03086 return mesh_->edge_handle(heh_);
03087 }
03088
03089
03091 operator typename Mesh::EdgeHandle() const {
03092 assert(mesh_);
03093 return mesh_->edge_handle(heh_);
03094 }
03095
03096
03098 reference operator*() const {
03099 assert(mesh_);
03100 return mesh_->deref(handle());
03101 }
03102
03103
03105 pointer operator->() const {
03106 assert(mesh_);
03107 return &mesh_->deref(handle());
03108 }
03109
03110
03117 operator bool() const {
03118 return heh_.is_valid() && ((start_ != heh_) || (!active_));
03119 }
03120
03121
03122 protected:
03123
03124 mesh_ptr mesh_;
03125 HalfedgeHandle start_, heh_;
03126 bool active_;
03127 };
03128
03129
03130
03131
03132
03133
03138 template <class Mesh>
03139 class FaceFaceIterT
03140 {
03141 public:
03142
03143
03144
03145
03146 typedef typename Mesh::HalfedgeHandle HalfedgeHandle;
03147
03148 typedef typename Mesh::Face value_type;
03149 typedef typename Mesh::FaceHandle value_handle;
03150
03151 #if 0
03152 typedef const Mesh& mesh_ref;
03153 typedef const Mesh* mesh_ptr;
03154 typedef const typename Mesh::Face& reference;
03155 typedef const typename Mesh::Face* pointer;
03156 #else
03157 typedef Mesh& mesh_ref;
03158 typedef Mesh* mesh_ptr;
03159 typedef typename Mesh::Face& reference;
03160 typedef typename Mesh::Face* pointer;
03161 #endif
03162
03163
03164
03166 FaceFaceIterT() : mesh_(0), active_(false) {}
03167
03168
03170 FaceFaceIterT(mesh_ref _mesh, typename Mesh::FaceHandle _start) :
03171 mesh_(&_mesh),
03172 start_(_mesh.halfedge_handle(_start)),
03173 heh_(start_),
03174 active_(false)
03175 { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
03176
03177
03179 FaceFaceIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
03180 mesh_(&_mesh),
03181 start_(_heh),
03182 heh_(_heh),
03183 active_(false)
03184 { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
03185
03186
03188 FaceFaceIterT(const FaceFaceIterT& _rhs) :
03189 mesh_(_rhs.mesh_),
03190 start_(_rhs.start_),
03191 heh_(_rhs.heh_),
03192 active_(_rhs.active_)
03193 { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
03194
03195
03197 FaceFaceIterT& operator=(const FaceFaceIterT<Mesh>& _rhs)
03198 {
03199 mesh_ = _rhs.mesh_;
03200 start_ = _rhs.start_;
03201 heh_ = _rhs.heh_;
03202 active_ = _rhs.active_;
03203 return *this;
03204 }
03205
03206
03207 #if 0
03209 FaceFaceIterT(const FaceFaceIterT<Mesh>& _rhs) :
03210 mesh_(_rhs.mesh_),
03211 start_(_rhs.start_),
03212 heh_(_rhs.heh_),
03213 active_(_rhs.active_)
03214 { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
03215
03216
03218 FaceFaceIterT& operator=(const FaceFaceIterT<Mesh>& _rhs)
03219 {
03220 mesh_ = _rhs.mesh_;
03221 start_ = _rhs.start_;
03222 heh_ = _rhs.heh_;
03223 active_ = _rhs.active_;
03224 return *this;
03225 }
03226 #else
03227 friend class ConstFaceFaceIterT<Mesh>;
03228 #endif
03229
03230
03232 bool operator==(const FaceFaceIterT& _rhs) const {
03233 return ((mesh_ == _rhs.mesh_) &&
03234 (start_ == _rhs.start_) &&
03235 (heh_ == _rhs.heh_) &&
03236 (active_ == _rhs.active_));
03237 }
03238
03239
03241 bool operator!=(const FaceFaceIterT& _rhs) const {
03242 return !operator==(_rhs);
03243 }
03244
03245
03247 FaceFaceIterT& operator++() {
03248 assert(mesh_);
03249 active_ = true;
03250 do heh_=mesh_->next_halfedge_handle(heh_); while ((*this) && (!handle().is_valid()));;
03251 return *this;
03252 }
03253
03254
03256 FaceFaceIterT& operator--() {
03257 assert(mesh_);
03258 active_ = true;
03259 do heh_=mesh_->prev_halfedge_handle(heh_); while ((*this) && (!handle().is_valid()));;
03260 return *this;
03261 }
03262
03263
03268 HalfedgeHandle current_halfedge_handle() const {
03269 return heh_;
03270 }
03271
03272
03274 typename Mesh::FaceHandle handle() const {
03275 assert(mesh_);
03276 return mesh_->face_handle(mesh_->opposite_halfedge_handle(heh_));
03277 }
03278
03279
03281 operator typename Mesh::FaceHandle() const {
03282 assert(mesh_);
03283 return mesh_->face_handle(mesh_->opposite_halfedge_handle(heh_));
03284 }
03285
03286
03288 reference operator*() const {
03289 assert(mesh_);
03290 return mesh_->deref(handle());
03291 }
03292
03293
03295 pointer operator->() const {
03296 assert(mesh_);
03297 return &mesh_->deref(handle());
03298 }
03299
03300
03307 operator bool() const {
03308 return heh_.is_valid() && ((start_ != heh_) || (!active_));
03309 }
03310
03311
03312 protected:
03313
03314 mesh_ptr mesh_;
03315 HalfedgeHandle start_, heh_;
03316 bool active_;
03317 };
03318
03319
03320
03321
03322
03323
03328 template <class Mesh>
03329 class ConstFaceFaceIterT
03330 {
03331 public:
03332
03333
03334
03335
03336 typedef typename Mesh::HalfedgeHandle HalfedgeHandle;
03337
03338 typedef typename Mesh::Face value_type;
03339 typedef typename Mesh::FaceHandle value_handle;
03340
03341 #if 1
03342 typedef const Mesh& mesh_ref;
03343 typedef const Mesh* mesh_ptr;
03344 typedef const typename Mesh::Face& reference;
03345 typedef const typename Mesh::Face* pointer;
03346 #else
03347 typedef Mesh& mesh_ref;
03348 typedef Mesh* mesh_ptr;
03349 typedef typename Mesh::Face& reference;
03350 typedef typename Mesh::Face* pointer;
03351 #endif
03352
03353
03354
03356 ConstFaceFaceIterT() : mesh_(0), active_(false) {}
03357
03358
03360 ConstFaceFaceIterT(mesh_ref _mesh, typename Mesh::FaceHandle _start) :
03361 mesh_(&_mesh),
03362 start_(_mesh.halfedge_handle(_start)),
03363 heh_(start_),
03364 active_(false)
03365 { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
03366
03367
03369 ConstFaceFaceIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
03370 mesh_(&_mesh),
03371 start_(_heh),
03372 heh_(_heh),
03373 active_(false)
03374 { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
03375
03376
03378 ConstFaceFaceIterT(const ConstFaceFaceIterT& _rhs) :
03379 mesh_(_rhs.mesh_),
03380 start_(_rhs.start_),
03381 heh_(_rhs.heh_),
03382 active_(_rhs.active_)
03383 { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
03384
03385
03387 ConstFaceFaceIterT& operator=(const ConstFaceFaceIterT<Mesh>& _rhs)
03388 {
03389 mesh_ = _rhs.mesh_;
03390 start_ = _rhs.start_;
03391 heh_ = _rhs.heh_;
03392 active_ = _rhs.active_;
03393 return *this;
03394 }
03395
03396
03397 #if 1
03399 ConstFaceFaceIterT(const FaceFaceIterT<Mesh>& _rhs) :
03400 mesh_(_rhs.mesh_),
03401 start_(_rhs.start_),
03402 heh_(_rhs.heh_),
03403 active_(_rhs.active_)
03404 { if (heh_.is_valid() && !handle().is_valid()) operator++();; }
03405
03406
03408 ConstFaceFaceIterT& operator=(const FaceFaceIterT<Mesh>& _rhs)
03409 {
03410 mesh_ = _rhs.mesh_;
03411 start_ = _rhs.start_;
03412 heh_ = _rhs.heh_;
03413 active_ = _rhs.active_;
03414 return *this;
03415 }
03416 #else
03417 friend class ConstFaceFaceIterT<Mesh>;
03418 #endif
03419
03420
03422 bool operator==(const ConstFaceFaceIterT& _rhs) const {
03423 return ((mesh_ == _rhs.mesh_) &&
03424 (start_ == _rhs.start_) &&
03425 (heh_ == _rhs.heh_) &&
03426 (active_ == _rhs.active_));
03427 }
03428
03429
03431 bool operator!=(const ConstFaceFaceIterT& _rhs) const {
03432 return !operator==(_rhs);
03433 }
03434
03435
03437 ConstFaceFaceIterT& operator++() {
03438 assert(mesh_);
03439 active_ = true;
03440 do heh_=mesh_->next_halfedge_handle(heh_); while ((*this) && (!handle().is_valid()));;
03441 return *this;
03442 }
03443
03444
03446 ConstFaceFaceIterT& operator--() {
03447 assert(mesh_);
03448 active_ = true;
03449 do heh_=mesh_->prev_halfedge_handle(heh_); while ((*this) && (!handle().is_valid()));;
03450 return *this;
03451 }
03452
03453
03458 HalfedgeHandle current_halfedge_handle() const {
03459 return heh_;
03460 }
03461
03462
03464 typename Mesh::FaceHandle handle() const {
03465 assert(mesh_);
03466 return mesh_->face_handle(mesh_->opposite_halfedge_handle(heh_));
03467 }
03468
03469
03471 operator typename Mesh::FaceHandle() const {
03472 assert(mesh_);
03473 return mesh_->face_handle(mesh_->opposite_halfedge_handle(heh_));
03474 }
03475
03476
03478 reference operator*() const {
03479 assert(mesh_);
03480 return mesh_->deref(handle());
03481 }
03482
03483
03485 pointer operator->() const {
03486 assert(mesh_);
03487 return &mesh_->deref(handle());
03488 }
03489
03490
03497 operator bool() const {
03498 return heh_.is_valid() && ((start_ != heh_) || (!active_));
03499 }
03500
03501
03502 protected:
03503
03504 mesh_ptr mesh_;
03505 HalfedgeHandle start_, heh_;
03506 bool active_;
03507 };
03508
03509
03510
03511
03512 }
03513 }
03514
03515 #endif
03516