Commit 9fb9ee03 authored by Jan Möbius's avatar Jan Möbius
Browse files

Provide begin/end functions for circulators for direct access

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@254 fdac6126-5c0c-442c-9429-916003d36597
parent 7d558fb9
......@@ -127,24 +127,24 @@ class VertexVertexIterT
/// Default constructor
VertexVertexIterT() : mesh_(0), active_(false) {}
VertexVertexIterT() : mesh_(0), lap_counter_(0) {}
/// Construct with mesh and a typename Mesh::VertexHandle
VertexVertexIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
VertexVertexIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start, bool _end = false) :
mesh_(&_mesh),
start_(_mesh.halfedge_handle(_start)),
heh_(start_),
active_(false)
lap_counter_(_end)
{ ; }
/// Construct with mesh and start halfedge
VertexVertexIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
VertexVertexIterT(mesh_ref _mesh, HalfedgeHandle _heh, bool _end = false) :
mesh_(&_mesh),
start_(_heh),
heh_(_heh),
active_(false)
lap_counter_(_end)
{ ; }
......@@ -153,7 +153,7 @@ class VertexVertexIterT
mesh_(_rhs.mesh_),
start_(_rhs.start_),
heh_(_rhs.heh_),
active_(_rhs.active_)
lap_counter_(_rhs.lap_counter_)
{ ; }
......@@ -163,7 +163,7 @@ class VertexVertexIterT
mesh_ = _rhs.mesh_;
start_ = _rhs.start_;
heh_ = _rhs.heh_;
active_ = _rhs.active_;
lap_counter_ = _rhs.lap_counter_;
return *this;
}
......@@ -174,7 +174,7 @@ class VertexVertexIterT
mesh_(_rhs.mesh_),
start_(_rhs.start_),
heh_(_rhs.heh_),
active_(_rhs.active_)
lap_counter_(_rhs.lap_counter_)
{ ; }
......@@ -184,7 +184,7 @@ class VertexVertexIterT
mesh_ = _rhs.mesh_;
start_ = _rhs.start_;
heh_ = _rhs.heh_;
active_ = _rhs.active_;
lap_counter_ = _rhs.lap_counter_;
return *this;
}
#else
......@@ -197,7 +197,7 @@ class VertexVertexIterT
return ((mesh_ == _rhs.mesh_) &&
(start_ == _rhs.start_) &&
(heh_ == _rhs.heh_) &&
(active_ == _rhs.active_));
(lap_counter_ == _rhs.lap_counter_));
}
......@@ -210,8 +210,8 @@ class VertexVertexIterT
/// Pre-Increment (next cw target)
VertexVertexIterT& operator++() {
assert(mesh_);
active_ = true;
heh_=mesh_->cw_rotated_halfedge_handle(heh_);;
heh_=mesh_->cw_rotated_halfedge_handle(heh_);
if(heh_ == start_) lap_counter_++;
return *this;
}
......@@ -219,8 +219,8 @@ class VertexVertexIterT
/// Pre-Decrement (next ccw target)
VertexVertexIterT& operator--() {
assert(mesh_);
active_ = true;
heh_=mesh_->ccw_rotated_halfedge_handle(heh_);;
if(heh_ == start_) lap_counter_--;
heh_=mesh_->ccw_rotated_halfedge_handle(heh_);
return *this;
}
......@@ -269,7 +269,7 @@ class VertexVertexIterT
have completed the first round.
*/
operator bool() const {
return heh_.is_valid() && ((start_ != heh_) || (!active_));
return heh_.is_valid() && ((start_ != heh_) || (lap_counter_ == 0));
}
......@@ -277,7 +277,7 @@ protected:
mesh_ptr mesh_;
HalfedgeHandle start_, heh_;
bool active_;
int lap_counter_;
};
......@@ -321,24 +321,24 @@ class ConstVertexVertexIterT
/// Default constructor
ConstVertexVertexIterT() : mesh_(0), active_(false) {}
ConstVertexVertexIterT() : mesh_(0), lap_counter_(0) {}
/// Construct with mesh and a typename Mesh::VertexHandle
ConstVertexVertexIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
ConstVertexVertexIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start, bool _end = false) :
mesh_(&_mesh),
start_(_mesh.halfedge_handle(_start)),
heh_(start_),
active_(false)
lap_counter_(_end)
{ ; }
/// Construct with mesh and start halfedge
ConstVertexVertexIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
ConstVertexVertexIterT(mesh_ref _mesh, HalfedgeHandle _heh, bool _end = false) :
mesh_(&_mesh),
start_(_heh),
heh_(_heh),
active_(false)
lap_counter_(_end)
{ ; }
......@@ -347,7 +347,7 @@ class ConstVertexVertexIterT
mesh_(_rhs.mesh_),
start_(_rhs.start_),
heh_(_rhs.heh_),
active_(_rhs.active_)
lap_counter_(_rhs.lap_counter_)
{ ; }
......@@ -357,7 +357,7 @@ class ConstVertexVertexIterT
mesh_ = _rhs.mesh_;
start_ = _rhs.start_;
heh_ = _rhs.heh_;
active_ = _rhs.active_;
lap_counter_ = _rhs.lap_counter_;
return *this;
}
......@@ -368,7 +368,7 @@ class ConstVertexVertexIterT
mesh_(_rhs.mesh_),
start_(_rhs.start_),
heh_(_rhs.heh_),
active_(_rhs.active_)
lap_counter_(_rhs.lap_counter_)
{ ; }
......@@ -378,7 +378,7 @@ class ConstVertexVertexIterT
mesh_ = _rhs.mesh_;
start_ = _rhs.start_;
heh_ = _rhs.heh_;
active_ = _rhs.active_;
lap_counter_ = _rhs.lap_counter_;
return *this;
}
#else
......@@ -391,7 +391,7 @@ class ConstVertexVertexIterT
return ((mesh_ == _rhs.mesh_) &&
(start_ == _rhs.start_) &&
(heh_ == _rhs.heh_) &&
(active_ == _rhs.active_));
(lap_counter_ == _rhs.lap_counter_));
}
......@@ -404,8 +404,8 @@ class ConstVertexVertexIterT
/// Pre-Increment (next cw target)
ConstVertexVertexIterT& operator++() {
assert(mesh_);
active_ = true;
heh_=mesh_->cw_rotated_halfedge_handle(heh_);;
heh_=mesh_->cw_rotated_halfedge_handle(heh_);
if(heh_ == start_) lap_counter_++;
return *this;
}
......@@ -413,8 +413,8 @@ class ConstVertexVertexIterT
/// Pre-Decrement (next ccw target)
ConstVertexVertexIterT& operator--() {
assert(mesh_);
active_ = true;
heh_=mesh_->ccw_rotated_halfedge_handle(heh_);;
if(heh_ == start_) lap_counter_--;
heh_=mesh_->ccw_rotated_halfedge_handle(heh_);
return *this;
}
......@@ -463,7 +463,7 @@ class ConstVertexVertexIterT
have completed the first round.
*/
operator bool() const {
return heh_.is_valid() && ((start_ != heh_) || (!active_));
return heh_.is_valid() && ((start_ != heh_) || (lap_counter_ == 0));
}
......@@ -471,7 +471,7 @@ protected:
mesh_ptr mesh_;
HalfedgeHandle start_, heh_;
bool active_;
int lap_counter_;
};
......@@ -515,24 +515,24 @@ class VertexOHalfedgeIterT
/// Default constructor
VertexOHalfedgeIterT() : mesh_(0), active_(false) {}
VertexOHalfedgeIterT() : mesh_(0), lap_counter_(false) {}
/// Construct with mesh and a typename Mesh::VertexHandle
VertexOHalfedgeIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
VertexOHalfedgeIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start, bool _end = false) :
mesh_(&_mesh),
start_(_mesh.halfedge_handle(_start)),
heh_(start_),
active_(false)
lap_counter_(_end)
{ ; }
/// Construct with mesh and start halfedge
VertexOHalfedgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
VertexOHalfedgeIterT(mesh_ref _mesh, HalfedgeHandle _heh, bool _end = false) :
mesh_(&_mesh),
start_(_heh),
heh_(_heh),
active_(false)
lap_counter_(_end)
{ ; }
......@@ -541,7 +541,7 @@ class VertexOHalfedgeIterT
mesh_(_rhs.mesh_),
start_(_rhs.start_),
heh_(_rhs.heh_),
active_(_rhs.active_)
lap_counter_(_rhs.lap_counter_)
{ ; }
......@@ -551,7 +551,7 @@ class VertexOHalfedgeIterT
mesh_ = _rhs.mesh_;
start_ = _rhs.start_;
heh_ = _rhs.heh_;
active_ = _rhs.active_;
lap_counter_ = _rhs.lap_counter_;
return *this;
}
......@@ -562,7 +562,7 @@ class VertexOHalfedgeIterT
mesh_(_rhs.mesh_),
start_(_rhs.start_),
heh_(_rhs.heh_),
active_(_rhs.active_)
lap_counter_(_rhs.lap_counter_)
{ ; }
......@@ -572,7 +572,7 @@ class VertexOHalfedgeIterT
mesh_ = _rhs.mesh_;
start_ = _rhs.start_;
heh_ = _rhs.heh_;
active_ = _rhs.active_;
lap_counter_ = _rhs.lap_counter_;
return *this;
}
#else
......@@ -585,7 +585,7 @@ class VertexOHalfedgeIterT
return ((mesh_ == _rhs.mesh_) &&
(start_ == _rhs.start_) &&
(heh_ == _rhs.heh_) &&
(active_ == _rhs.active_));
(lap_counter_ == _rhs.lap_counter_));
}
......@@ -598,8 +598,8 @@ class VertexOHalfedgeIterT
/// Pre-Increment (next cw target)
VertexOHalfedgeIterT& operator++() {
assert(mesh_);
active_ = true;
heh_=mesh_->cw_rotated_halfedge_handle(heh_);;
heh_=mesh_->cw_rotated_halfedge_handle(heh_);
if(heh_ == start_) lap_counter_++;
return *this;
}
......@@ -607,8 +607,8 @@ class VertexOHalfedgeIterT
/// Pre-Decrement (next ccw target)
VertexOHalfedgeIterT& operator--() {
assert(mesh_);
active_ = true;
heh_=mesh_->ccw_rotated_halfedge_handle(heh_);;
if(heh_ == start_) lap_counter_--;
heh_=mesh_->ccw_rotated_halfedge_handle(heh_);
return *this;
}
......@@ -657,7 +657,7 @@ class VertexOHalfedgeIterT
have completed the first round.
*/
operator bool() const {
return heh_.is_valid() && ((start_ != heh_) || (!active_));
return heh_.is_valid() && ((start_ != heh_) || (lap_counter_ == 0));
}
......@@ -665,7 +665,7 @@ protected:
mesh_ptr mesh_;
HalfedgeHandle start_, heh_;
bool active_;
int lap_counter_;
};
......@@ -709,24 +709,24 @@ class ConstVertexOHalfedgeIterT
/// Default constructor
ConstVertexOHalfedgeIterT() : mesh_(0), active_(false) {}
ConstVertexOHalfedgeIterT() : mesh_(0), lap_counter_(false) {}
/// Construct with mesh and a typename Mesh::VertexHandle
ConstVertexOHalfedgeIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
ConstVertexOHalfedgeIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start, bool _end = false) :
mesh_(&_mesh),
start_(_mesh.halfedge_handle(_start)),
heh_(start_),
active_(false)
lap_counter_(_end)
{ ; }
/// Construct with mesh and start halfedge
ConstVertexOHalfedgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
ConstVertexOHalfedgeIterT(mesh_ref _mesh, HalfedgeHandle _heh, bool _end = false) :
mesh_(&_mesh),
start_(_heh),
heh_(_heh),
active_(false)
lap_counter_(_end)
{ ; }
......@@ -735,7 +735,7 @@ class ConstVertexOHalfedgeIterT
mesh_(_rhs.mesh_),
start_(_rhs.start_),
heh_(_rhs.heh_),
active_(_rhs.active_)
lap_counter_(_rhs.lap_counter_)
{ ; }
......@@ -745,7 +745,7 @@ class ConstVertexOHalfedgeIterT
mesh_ = _rhs.mesh_;
start_ = _rhs.start_;
heh_ = _rhs.heh_;
active_ = _rhs.active_;
lap_counter_ = _rhs.lap_counter_;
return *this;
}
......@@ -756,7 +756,7 @@ class ConstVertexOHalfedgeIterT
mesh_(_rhs.mesh_),
start_(_rhs.start_),
heh_(_rhs.heh_),
active_(_rhs.active_)
lap_counter_(_rhs.lap_counter_)
{ ; }
......@@ -766,7 +766,7 @@ class ConstVertexOHalfedgeIterT
mesh_ = _rhs.mesh_;
start_ = _rhs.start_;
heh_ = _rhs.heh_;
active_ = _rhs.active_;
lap_counter_ = _rhs.lap_counter_;
return *this;
}
#else
......@@ -779,7 +779,7 @@ class ConstVertexOHalfedgeIterT
return ((mesh_ == _rhs.mesh_) &&
(start_ == _rhs.start_) &&
(heh_ == _rhs.heh_) &&
(active_ == _rhs.active_));
(lap_counter_ == _rhs.lap_counter_));
}
......@@ -792,8 +792,8 @@ class ConstVertexOHalfedgeIterT
/// Pre-Increment (next cw target)
ConstVertexOHalfedgeIterT& operator++() {
assert(mesh_);
active_ = true;
heh_=mesh_->cw_rotated_halfedge_handle(heh_);;
heh_=mesh_->cw_rotated_halfedge_handle(heh_);
if(heh_ == start_) lap_counter_++;
return *this;
}
......@@ -801,8 +801,8 @@ class ConstVertexOHalfedgeIterT
/// Pre-Decrement (next ccw target)
ConstVertexOHalfedgeIterT& operator--() {
assert(mesh_);
active_ = true;
heh_=mesh_->ccw_rotated_halfedge_handle(heh_);;
if(heh_ == start_) lap_counter_--;
heh_=mesh_->ccw_rotated_halfedge_handle(heh_);
return *this;
}
......@@ -851,7 +851,7 @@ class ConstVertexOHalfedgeIterT
have completed the first round.
*/
operator bool() const {
return heh_.is_valid() && ((start_ != heh_) || (!active_));
return heh_.is_valid() && ((start_ != heh_) || (lap_counter_ == 0));
}
......@@ -859,7 +859,7 @@ protected:
mesh_ptr mesh_;
HalfedgeHandle start_, heh_;
bool active_;
int lap_counter_;
};
......@@ -903,24 +903,24 @@ class VertexIHalfedgeIterT
/// Default constructor
VertexIHalfedgeIterT() : mesh_(0), active_(false) {}
VertexIHalfedgeIterT() : mesh_(0), lap_counter_(false) {}
/// Construct with mesh and a typename Mesh::VertexHandle
VertexIHalfedgeIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
VertexIHalfedgeIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start, bool _end = false) :
mesh_(&_mesh),
start_(_mesh.halfedge_handle(_start)),
heh_(start_),
active_(false)
lap_counter_(_end)
{ ; }
/// Construct with mesh and start halfedge
VertexIHalfedgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
VertexIHalfedgeIterT(mesh_ref _mesh, HalfedgeHandle _heh, bool _end = false) :
mesh_(&_mesh),
start_(_heh),
heh_(_heh),
active_(false)
lap_counter_(_end)
{ ; }
......@@ -929,7 +929,7 @@ class VertexIHalfedgeIterT
mesh_(_rhs.mesh_),
start_(_rhs.start_),
heh_(_rhs.heh_),
active_(_rhs.active_)
lap_counter_(_rhs.lap_counter_)
{ ; }
......@@ -939,7 +939,7 @@ class VertexIHalfedgeIterT
mesh_ = _rhs.mesh_;
start_ = _rhs.start_;
heh_ = _rhs.heh_;
active_ = _rhs.active_;
lap_counter_ = _rhs.lap_counter_;
return *this;
}
......@@ -950,7 +950,7 @@ class VertexIHalfedgeIterT
mesh_(_rhs.mesh_),
start_(_rhs.start_),
heh_(_rhs.heh_),
active_(_rhs.active_)
lap_counter_(_rhs.lap_counter_)
{ ; }
......@@ -960,7 +960,7 @@ class VertexIHalfedgeIterT
mesh_ = _rhs.mesh_;
start_ = _rhs.start_;
heh_ = _rhs.heh_;
active_ = _rhs.active_;
lap_counter_ = _rhs.lap_counter_;
return *this;
}
#else
......@@ -973,7 +973,7 @@ class VertexIHalfedgeIterT
return ((mesh_ == _rhs.mesh_) &&
(start_ == _rhs.start_) &&
(heh_ == _rhs.heh_) &&
(active_ == _rhs.active_));
(lap_counter_ == _rhs.lap_counter_));
}
......@@ -986,8 +986,8 @@ class VertexIHalfedgeIterT
/// Pre-Increment (next cw target)
VertexIHalfedgeIterT& operator++() {
assert(mesh_);
active_ = true;
heh_=mesh_->cw_rotated_halfedge_handle(heh_);;
heh_=mesh_->cw_rotated_halfedge_handle(heh_);
if(heh_ == start_) lap_counter_++;
return *this;
}
......@@ -995,8 +995,8 @@ class VertexIHalfedgeIterT
/// Pre-Decrement (next ccw target)
VertexIHalfedgeIterT& operator--() {
assert(mesh_);
active_ = true;
heh_=mesh_->ccw_rotated_halfedge_handle(heh_);;
if(heh_ == start_) lap_counter_--;
heh_=mesh_->ccw_rotated_halfedge_handle(heh_);
return *this;
}
......@@ -1045,7 +1045,7 @@ class VertexIHalfedgeIterT
have completed the first round.
*/
operator bool() const {
return heh_.is_valid() && ((start_ != heh_) || (!active_));
return heh_.is_valid() && ((start_ != heh_) || (lap_counter_ == 0));
}
......@@ -1053,7 +1053,7 @@ protected:
mesh_ptr mesh_;
HalfedgeHandle start_, heh_;
bool active_;
int lap_counter_;
};
......@@ -1097,24 +1097,24 @@ class ConstVertexIHalfedgeIterT
/// Default constructor
ConstVertexIHalfedgeIterT() : mesh_(0), active_(false) {}
ConstVertexIHalfedgeIterT() : mesh_(0), lap_counter_(false) {}
/// Construct with mesh and a typename Mesh::VertexHandle
ConstVertexIHalfedgeIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start) :
ConstVertexIHalfedgeIterT(mesh_ref _mesh, typename Mesh::VertexHandle _start, bool _end = false) :
mesh_(&_mesh),
start_(_mesh.halfedge_handle(_start)),
heh_(start_),
active_(false)
lap_counter_(_end)
{ ; }
/// Construct with mesh and start halfedge
ConstVertexIHalfedgeIterT(mesh_ref _mesh, HalfedgeHandle _heh) :
ConstVertexIHalfedgeIterT(mesh_ref _mesh, HalfedgeHandle _heh, bool _end = false) :
mesh_(&_mesh),
start_(_heh),
heh_(_heh),
active_(false)
lap_counter_(_end)
{ ; }
......@@ -1123,7 +1123,7 @@ class ConstVertexIHalfedgeIterT
mesh_(_rhs.mesh_),
start_(_rhs.start_),
heh_(_rhs.heh_),
active_(_rhs.active_)
lap_counter_(_rhs.lap_counter_)
{ ; }
......@@ -1133,7 +1133,7 @@ class ConstVertexIHalfedgeIterT
mesh_ = _rhs.mesh_;
start_ = _rhs.start_;
heh_ = _rhs.heh_;
active_ = _rhs.active_;
lap_counter_ = _rhs.lap_counter_;
return *this;
}
......@@ -1144,7 +1144,7 @@ class ConstVertexIHalfedgeIterT
mesh_(_rhs.mesh_),
start_(_rhs.start_),
heh_(_rhs.heh_),
active_(_rhs.active_)
lap_counter_(_rhs.lap_counter_)
{ ; }
......@@ -1154,7 +1154,7 @@ class ConstVertexIHalfedgeIterT
mesh_ = _rhs.mesh_;
start_ = _rhs.start_;
heh_ = _rhs.heh_;
active_ = _rhs.active_;
lap_counter_ = _rhs.lap_counter_;
return *this;
}
#else
......@@ -1167,7 +1167,7 @@ class ConstVertexIHalfedgeIterT