Commit 2f0bb6c1 authored by Mike Kremer's avatar Mike Kremer

Added HalfFaceVertex iterator

git-svn-id: http://www.openvolumemesh.org/svnrepo/OpenVolumeMesh/trunk@161 66977474-1d4b-4f09-8fe9-267525286df2
parent 0dd0d435
......@@ -414,6 +414,51 @@ CellCellIter& CellCellIter::operator++() {
return *this;
}
////================================================================================================
//// HalfFaceVertexIter
////================================================================================================
HalfFaceVertexIter::HalfFaceVertexIter(const HalfFaceHandle& _ref_h,
const TopologyKernel* _mesh) :
BaseIter(_mesh, _ref_h) {
std::vector<HalfEdgeHandle> hes = _mesh->halfface(_ref_h).halfedges();
for(std::vector<HalfEdgeHandle>::const_iterator he_it = hes.begin();
he_it != hes.end(); ++he_it) {
vertices_.push_back(_mesh->halfedge(*he_it).from_vertex());
}
BaseIter::valid(iter_ != vertices_.end());
if(BaseIter::valid()) {
BaseIter::cur_handle(*iter_);
}
}
HalfFaceVertexIter& HalfFaceVertexIter::operator--() {
if(iter_ == vertices_.end()) {
BaseIter::valid(false);
} else {
--iter_;
BaseIter::cur_handle(*iter_);
}
return *this;
}
HalfFaceVertexIter& HalfFaceVertexIter::operator++() {
++iter_;
if(iter_ != vertices_.end()) {
BaseIter::cur_handle(*iter_);
} else {
BaseIter::valid(false);
}
return *this;
}
////================================================================================================
//// BoundaryFaceIter
////================================================================================================
......
......@@ -263,10 +263,6 @@ public:
VertexHandle,
CellHandle> BaseIter;
VertexCellIter(const VertexHandle& _vIdx, const TopologyKernel* _mesh);
VertexCellIter& operator=(const VertexCellIter& _c) {
BaseIter::operator=(_c);
......@@ -387,10 +383,6 @@ public:
CellHandle,
VertexHandle> BaseIter;
CellVertexIter(const CellHandle& _cIdx, const TopologyKernel* _mesh);
CellVertexIter& operator=(const CellVertexIter& _c) {
BaseIter::operator=(_c);
......@@ -455,8 +447,6 @@ public:
CellHandle,
CellHandle> BaseIter;
CellCellIter(const CellHandle& _cIdx, const TopologyKernel* _mesh);
CellCellIter& operator=(const CellCellIter& _c) {
BaseIter::operator=(_c);
......@@ -513,6 +503,70 @@ private:
//===========================================================================
class HalfFaceVertexIter : public BaseIterator<
HalfFaceHandle,
VertexHandle> {
public:
typedef BaseIterator<
HalfFaceHandle,
VertexHandle> BaseIter;
HalfFaceVertexIter(const HalfFaceHandle& _hIdx, const TopologyKernel* _mesh);
HalfFaceVertexIter& operator=(const HalfFaceVertexIter& _c) {
BaseIter::operator=(_c);
vertices_ = _c.vertices_;
iter_ = vertices_.begin();
return *this;
}
// Post increment/decrement operator
HalfFaceVertexIter operator++(int) {
HalfFaceVertexIter cpy = *this;
++(*this);
return cpy;
}
HalfFaceVertexIter operator--(int) {
HalfFaceVertexIter cpy = *this;
--(*this);
return cpy;
}
HalfFaceVertexIter operator+(int _n) {
HalfFaceVertexIter cpy = *this;
for(int i = 0; i < _n; ++i) {
++cpy;
}
return cpy;
}
HalfFaceVertexIter operator-(int _n) {
HalfFaceVertexIter cpy = *this;
for(int i = 0; i < _n; ++i) {
--cpy;
}
return cpy;
}
HalfFaceVertexIter& operator+=(int _n) {
for(int i = 0; i < _n; ++i) {
++(*this);
}
return *this;
}
HalfFaceVertexIter& operator-=(int _n) {
for(int i = 0; i < _n; ++i) {
--(*this);
}
return *this;
}
HalfFaceVertexIter& operator++();
HalfFaceVertexIter& operator--();
private:
std::vector<VertexHandle> vertices_;
std::vector<VertexHandle>::const_iterator iter_;
};
//===========================================================================
class BoundaryFaceIter : public BaseIterator<FaceHandle,FaceHandle> {
public:
typedef BaseIterator<
......
......@@ -86,6 +86,7 @@ public:
friend class HalfEdgeCellIter;
friend class CellVertexIter;
friend class CellCellIter;
friend class HalfFaceVertexIter;
friend class BoundaryFaceIter;
friend class VertexIter;
friend class EdgeIter;
......@@ -118,6 +119,10 @@ public:
return CellCellIter(_h, this);
}
HalfFaceVertexIter hfv_iter(const HalfFaceHandle& _h) const {
return HalfFaceVertexIter(_h, this);
}
BoundaryFaceIter bf_iter() const {
return BoundaryFaceIter(this);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment