diff --git a/src/OpenMesh/Core/Mesh/CirculatorsT.hh b/src/OpenMesh/Core/Mesh/CirculatorsT.hh index e3aaa6e1..622134e8 100644 --- a/src/OpenMesh/Core/Mesh/CirculatorsT.hh +++ b/src/OpenMesh/Core/Mesh/CirculatorsT.hh @@ -156,7 +156,21 @@ class GenericCirculator_ValueHandleFnsT { inline static bool is_valid(const typename Mesh::HalfedgeHandle &heh, const int lap_counter) { return ( heh.is_valid() && (lap_counter == 0 ) ); } - inline static void init(const Mesh*, typename Mesh::HalfedgeHandle&, typename Mesh::HalfedgeHandle&, int&) {}; + inline static void init(const Mesh* mesh, typename Mesh::HalfedgeHandle& heh, typename Mesh::HalfedgeHandle& start, int& lap_counter, bool adjust_for_ccw) + { + if (!CW) // TODO: constexpr if + { + if (adjust_for_ccw) + { + // increment current heh and start so that cw and ccw version dont start with the same element but ranges are actually reversed + int lc = lap_counter; + increment(mesh, heh, start, lap_counter); + start = heh; + lap_counter = lc; + } + } + } + inline static void increment(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, typename Mesh::HalfedgeHandle &start, int &lap_counter) { GenericCirculator_CenterEntityFnsT::increment(mesh, heh, start, lap_counter); } @@ -173,7 +187,19 @@ class GenericCirculator_ValueHandleFnsT(mesh, mesh.halfedge_handle(start), end) { - GenericCirculator_ValueHandleFns::init(this->mesh_, this->heh_, this->start_, this->lap_counter_); + bool adjust_for_ccw = true; + GenericCirculator_ValueHandleFns::init(this->mesh_, this->heh_, this->start_, this->lap_counter_, adjust_for_ccw); } GenericCirculatorT(mesh_ref mesh, typename Mesh::HalfedgeHandle heh, bool end = false) : GenericCirculatorBaseT(mesh, heh, end) { - GenericCirculator_ValueHandleFns::init(this->mesh_, this->heh_, this->start_, this->lap_counter_); + bool adjust_for_ccw = false; // if iterator is initialized with specific heh, we want to start there + GenericCirculator_ValueHandleFns::init(this->mesh_, this->heh_, this->start_, this->lap_counter_, adjust_for_ccw); } GenericCirculatorT(const GenericCirculatorT &rhs) : GenericCirculatorBaseT(rhs) {}