37#include <OpenVolumeMesh/Mesh/TetrahedralMeshIterators.hh>
38#include <OpenVolumeMesh/Mesh/TetrahedralMeshTopologyKernel.hh>
39#include <OpenVolumeMesh/Core/Iterators.hh>
41namespace OpenVolumeMesh {
48TetVertexIter::TetVertexIter(CellHandle _ref_h,
49 const TetrahedralMeshTopologyKernel* _mesh,
int _max_laps) :
50BaseIter(_mesh, _ref_h, _max_laps) {
52 assert(_ref_h.is_valid());
54 assert(_mesh->valence(_ref_h) == 4);
57 TetrahedralMeshTopologyKernel::Cell cell = _mesh->cell(_ref_h);
60 HalfFaceHandle curHF = cell.halffaces()[0];
61 assert(curHF.is_valid());
64 assert(_mesh->valence(curHF.face_handle()) == 3);
65 HalfEdgeHandle curHE = *_mesh->halfface(curHF).halfedges().begin();
66 assert(curHE.is_valid());
69 vertices_[0] = _mesh->halfedge(curHE).to_vertex();
71 curHE = _mesh->next_halfedge_in_halfface(curHE, curHF);
73 vertices_[1] = _mesh->halfedge(curHE).to_vertex();
75 curHE = _mesh->next_halfedge_in_halfface(curHE, curHF);
77 vertices_[2] = _mesh->halfedge(curHE).to_vertex();
80 HalfFaceHandle other_hf = cell.halffaces()[1];
81 for (
const auto vh: _mesh->halfface_vertices(other_hf)) {
82 if (vh == vertices_[0])
continue;
83 if (vh == vertices_[1])
continue;
84 if (vh == vertices_[2])
continue;
88 BaseIter::cur_handle(vertices_[cur_index_]);
92TetVertexIter& TetVertexIter::operator--() {
94 if (cur_index_ == 0) {
95 cur_index_ = vertices_.size() - 1;
98 BaseIter::valid(
false);
103 BaseIter::cur_handle(vertices_[cur_index_]);
109TetVertexIter& TetVertexIter::operator++() {
112 if(cur_index_ == vertices_.size()) {
115 if (lap_ >= max_laps_)
116 BaseIter::valid(
false);
119 BaseIter::cur_handle(vertices_[cur_index_]);