diff --git a/src/OpenMesh/Core/Mesh/CirculatorsT.hh b/src/OpenMesh/Core/Mesh/CirculatorsT.hh index e897f149..7e74afad 100644 --- a/src/OpenMesh/Core/Mesh/CirculatorsT.hh +++ b/src/OpenMesh/Core/Mesh/CirculatorsT.hh @@ -397,6 +397,210 @@ class GenericCirculatorT : protected GenericCirculatorBaseT { mutable value_type pointer_deref_value; }; +////////////////////////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////// OLD /////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// OLD CIRCULATORS +// deprecated circulators, will be removed soon +// if you remove these circulators and go to the old ones, PLEASE ENABLE FOLLOWING UNITTESTS: +// +// OpenMeshTrimeshCirculatorVertexIHalfEdge.VertexIHalfEdgeIterCheckInvalidationAtEnds +// OpenMeshTrimeshCirculatorVertexEdge.VertexEdgeIterCheckInvalidationAtEnds +// OpenMeshTrimeshCirculatorVertexVertex.VertexVertexIterCheckInvalidationAtEnds +// OpenMeshTrimeshCirculatorVertexOHalfEdge.VertexOHalfEdgeIterCheckInvalidationAtEnds +// OpenMeshTrimeshCirculatorVertexFace.VertexFaceIterCheckInvalidationAtEnds +// OpenMeshTrimeshCirculatorVertexFace.VertexFaceIterWithoutHolesDecrement +// + +template +class GenericCirculator_ValueHandleFnsT_DEPRECATED { + public: + inline static bool is_valid(const typename Mesh::HalfedgeHandle &heh,const typename Mesh::HalfedgeHandle &start, const int lap_counter) { + return ( heh.is_valid() && ((start != heh) || (lap_counter == 0 )) ); + } + inline static void init(const Mesh*, typename Mesh::HalfedgeHandle&, typename Mesh::HalfedgeHandle&, int&) {}; + 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); + } + inline static void decrement(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, typename Mesh::HalfedgeHandle &start, int &lap_counter) { + GenericCirculator_CenterEntityFnsT::decrement(mesh, heh, start, lap_counter); + } +}; + +template +class GenericCirculator_ValueHandleFnsT_DEPRECATED { + public: + typedef GenericCirculator_DereferenciabilityCheckT GenericCirculator_DereferenciabilityCheck; + + inline static bool is_valid(const typename Mesh::HalfedgeHandle &heh, const typename Mesh::HalfedgeHandle &start, const int lap_counter) { + return ( heh.is_valid() && ((start != heh) || (lap_counter == 0 ))); + } + inline static void init(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, typename Mesh::HalfedgeHandle &start, int &lap_counter) { + if (heh.is_valid() && !GenericCirculator_DereferenciabilityCheck::isDereferenciable(mesh, heh) && lap_counter == 0 ) + increment(mesh, heh, start, lap_counter); + }; + inline static void increment(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, typename Mesh::HalfedgeHandle &start, int &lap_counter) { + do { + GenericCirculator_CenterEntityFnsT::increment(mesh, heh, start, lap_counter); + } while (is_valid(heh, start, lap_counter) && !GenericCirculator_DereferenciabilityCheck::isDereferenciable(mesh, heh)); + } + inline static void decrement(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, typename Mesh::HalfedgeHandle &start, int &lap_counter) { + do { + GenericCirculator_CenterEntityFnsT::decrement(mesh, heh, start, lap_counter); + } while (is_valid(heh, start, lap_counter) && !GenericCirculator_DereferenciabilityCheck::isDereferenciable(mesh, heh)); + } +}; + +template::*Handle2Value)() const> +class GenericCirculatorT_DEPRECATED : protected GenericCirculatorBaseT { + public: + typedef std::ptrdiff_t difference_type; + typedef ValueHandle value_type; + typedef const value_type& reference; + typedef const value_type* pointer; + typedef std::bidirectional_iterator_tag iterator_category; + + typedef typename GenericCirculatorBaseT::mesh_ptr mesh_ptr; + typedef typename GenericCirculatorBaseT::mesh_ref mesh_ref; + typedef GenericCirculator_ValueHandleFnsT_DEPRECATED GenericCirculator_ValueHandleFns; + + public: + GenericCirculatorT_DEPRECATED() {} + GenericCirculatorT_DEPRECATED(mesh_ref mesh, CenterEntityHandle start, bool end = false) : + GenericCirculatorBaseT(mesh, mesh.halfedge_handle(start), end) { + + GenericCirculator_ValueHandleFns::init(this->mesh_, this->heh_, this->start_, this->lap_counter_); + } + GenericCirculatorT_DEPRECATED(mesh_ref mesh, HalfedgeHandle heh, bool end = false) : + GenericCirculatorBaseT(mesh, heh, end) { + + GenericCirculator_ValueHandleFns::init(this->mesh_, this->heh_, this->start_, this->lap_counter_); + } + GenericCirculatorT_DEPRECATED(const GenericCirculatorT_DEPRECATED &rhs) : GenericCirculatorBaseT(rhs) {} + + GenericCirculatorT_DEPRECATED& operator++() { + assert(this->mesh_); + GenericCirculator_ValueHandleFns::increment(this->mesh_, this->heh_, this->start_, this->lap_counter_); + return *this; + } + DEPRECATED("current decrement operator is deprecated. Please use CCW/CW iterators.") + GenericCirculatorT_DEPRECATED& operator--() { + assert(this->mesh_); + GenericCirculator_ValueHandleFns::decrement(this->mesh_, this->heh_, this->start_, this->lap_counter_); + return *this; + } + + /// Post-increment + GenericCirculatorT_DEPRECATED operator++(int) { + assert(this->mesh_); + GenericCirculatorT_DEPRECATED cpy(*this); + ++(*this); + return cpy; + } + + /// Post-decrement + DEPRECATED("current decrement operator is deprecated. Please use CCW/CW iterators.") + GenericCirculatorT_DEPRECATED operator--(int) { + assert(this->mesh_); + GenericCirculatorT_DEPRECATED cpy(*this); + --(*this); + return cpy; + } + + /// Standard dereferencing operator. + value_type operator*() const { +#ifndef NDEBUG + assert(this->heh_.is_valid()); + value_type res = (this->*Handle2Value)(); + assert(res.is_valid()); + return res; +#else + return (this->*Handle2Value)(); +#endif + } + + /** + * @brief Pointer dereferentiation. + * + * This returns a pointer which points to a handle + * that loses its validity once this dereferentiation is + * invoked again. Thus, do not store the result of + * this operation. + */ + pointer operator->() const { + pointer_deref_value = **this; + return &pointer_deref_value; + } + + GenericCirculatorT_DEPRECATED &operator=(const GenericCirculatorT_DEPRECATED &rhs) { + GenericCirculatorBaseT::operator=(rhs); + return *this; + }; + + bool operator==(const GenericCirculatorT_DEPRECATED &rhs) const { + return GenericCirculatorBaseT::operator==(rhs); + } + + bool operator!=(const GenericCirculatorT_DEPRECATED &rhs) const { + return GenericCirculatorBaseT::operator!=(rhs); + } + + bool is_valid() const { + return GenericCirculator_ValueHandleFns::is_valid(this->heh_,this->start_, this->lap_counter_); + } + + DEPRECATED("current_halfedge_handle() is an implementation detail and should not be accessed from outside the iterator class.") + /** + * \deprecated + * current_halfedge_handle() is an implementation detail and should not + * be accessed from outside the iterator class. + */ + const HalfedgeHandle ¤t_halfedge_handle() const { + return this->heh_; + } + + DEPRECATED("Do not use this error prone implicit cast. Compare to end-iterator or use is_valid(), instead.") + /** + * \deprecated + * Do not use this error prone implicit cast. Compare to the + * end-iterator or use is_valid() instead. + */ + operator bool() const { + return is_valid(); + } + + /** + * \brief Return the handle of the current target. + * \deprecated + * This function clutters your code. Use dereferencing operators -> and * instead. + */ + DEPRECATED("This function clutters your code. Use dereferencing operators -> and * instead.") + value_type handle() const { + return **this; + } + + /** + * \brief Cast to the handle of the current target. + * \deprecated + * Implicit casts of iterators are unsafe. Use dereferencing operators + * -> and * instead. + */ + DEPRECATED("Implicit casts of iterators are unsafe. Use dereferencing operators -> and * instead.") + operator value_type() const { + return **this; + } + + template + friend STREAM &operator<< (STREAM &s, const GenericCirculatorT_DEPRECATED &self) { + return s << self.mesh_ << ", " << self.start_.idx() << ", " << self.heh_.idx() << ", " << self.lap_counter_; + } + + private: + mutable value_type pointer_deref_value; +}; + } // namespace Iterators } // namespace OpenMesh diff --git a/src/OpenMesh/Core/Mesh/PolyConnectivity.hh b/src/OpenMesh/Core/Mesh/PolyConnectivity.hh index 802998a4..d19b4e2c 100644 --- a/src/OpenMesh/Core/Mesh/PolyConnectivity.hh +++ b/src/OpenMesh/Core/Mesh/PolyConnectivity.hh @@ -102,10 +102,11 @@ public: /** * Enumerates 1-ring vertices in a clockwise fashion. */ - typedef Iterators::GenericCirculatorT::toVertexHandle> VertexVertexIter; - typedef VertexVertexIter VertexVertexCWIter; + typedef Iterators::GenericCirculatorT::toVertexHandle> VertexVertexCWIter; /** * Enumerates 1-ring vertices in a counter clockwise fashion. @@ -117,10 +118,11 @@ public: /** * Enumerates outgoing half edges in a clockwise fashion. */ - typedef Iterators::GenericCirculatorT::toHalfedgeHandle> VertexOHalfedgeIter; - typedef VertexOHalfedgeIter VertexOHalfedgeCWIter; + typedef Iterators::GenericCirculatorT::toHalfedgeHandle> VertexOHalfedgeCWIter; /** * Enumerates outgoing half edges in a counter clockwise fashion. @@ -132,10 +134,11 @@ public: /** * Enumerates incoming half edges in a clockwise fashion. */ - typedef Iterators::GenericCirculatorT::toOppositeHalfedgeHandle> VertexIHalfedgeIter; - typedef VertexIHalfedgeIter VertexIHalfedgeCWIter; + typedef Iterators::GenericCirculatorT::toOppositeHalfedgeHandle> VertexIHalfedgeCWIter; /** * Enumerates incoming half edges in a counter clockwise fashion. @@ -147,10 +150,11 @@ public: /** * Enumerates incident faces in a clockwise fashion. */ - typedef Iterators::GenericCirculatorT::toFaceHandle> VertexFaceIter; - typedef VertexFaceIter VertexFaceCWIter; + typedef Iterators::GenericCirculatorT::toFaceHandle> VertexFaceCWIter; /** * Enumerates incident faces in a counter clockwise fashion. @@ -162,10 +166,11 @@ public: /** * Enumerates incident edges in a clockwise fashion. */ - typedef Iterators::GenericCirculatorT::toEdgeHandle> VertexEdgeIter; - typedef VertexEdgeIter VertexEdgeCWIter; + typedef Iterators::GenericCirculatorT::toEdgeHandle> VertexEdgeCWIter; /** * Enumerates incident edges in a counter clockwise fashion. */ @@ -176,10 +181,11 @@ public: /** * Identical to #FaceHalfedgeIter. God knows why this typedef exists. */ - typedef Iterators::GenericCirculatorT::toHalfedgeHandle> HalfedgeLoopIter; - typedef HalfedgeLoopIter HalfedgeLoopCWIter; + typedef Iterators::GenericCirculatorT::toHalfedgeHandle> HalfedgeLoopCWIter; /** * Identical to #FaceHalfedgeIter. God knows why this typedef exists. */ diff --git a/src/Unittests/unittests_trimesh_circulator_vertex_edge.cc b/src/Unittests/unittests_trimesh_circulator_vertex_edge.cc index 52b2d47d..655a2889 100644 --- a/src/Unittests/unittests_trimesh_circulator_vertex_edge.cc +++ b/src/Unittests/unittests_trimesh_circulator_vertex_edge.cc @@ -200,85 +200,86 @@ TEST_F(OpenMeshTrimeshCirculatorVertexEdge, VertexEdgeIterBoundaryIncrement) { /* * Test if the end iterator stays invalid after one lap + * DISABLED as long as the normal iterators using old behavior */ -TEST_F(OpenMeshTrimeshCirculatorVertexEdge, VertexEdgeIterCheckInvalidationAtEnds) { - - mesh_.clear(); - - // Add some vertices - Mesh::VertexHandle vhandle[5]; - - vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 1, 0)); - vhandle[1] = mesh_.add_vertex(Mesh::Point(1, 0, 0)); - vhandle[2] = mesh_.add_vertex(Mesh::Point(2, 1, 0)); - vhandle[3] = mesh_.add_vertex(Mesh::Point(0,-1, 0)); - vhandle[4] = mesh_.add_vertex(Mesh::Point(2,-1, 0)); - - // Add two faces - std::vector face_vhandles; - - face_vhandles.push_back(vhandle[0]); - face_vhandles.push_back(vhandle[1]); - face_vhandles.push_back(vhandle[2]); - Mesh::FaceHandle fh0 = mesh_.add_face(face_vhandles); - - face_vhandles.clear(); - - face_vhandles.push_back(vhandle[1]); - face_vhandles.push_back(vhandle[3]); - face_vhandles.push_back(vhandle[4]); - mesh_.add_face(face_vhandles); - - face_vhandles.clear(); - - face_vhandles.push_back(vhandle[0]); - face_vhandles.push_back(vhandle[3]); - face_vhandles.push_back(vhandle[1]); - mesh_.add_face(face_vhandles); - - face_vhandles.clear(); - - face_vhandles.push_back(vhandle[2]); - face_vhandles.push_back(vhandle[1]); - face_vhandles.push_back(vhandle[4]); - mesh_.add_face(face_vhandles); - - /* Test setup: - 0 ==== 2 - |\ 0 /| - | \ / | - |2 1 3| - | / \ | - |/ 1 \| - 3 ==== 4 */ - - - // Check if the end iterator stays invalid after end - Mesh::VertexEdgeIter endIter = mesh_.ve_end(vhandle[1]); - EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid"; - ++endIter ; - EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid after increment"; - - // Check if the end iterators becomes valid after decrement - endIter = mesh_.ve_end(vhandle[1]); - EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid"; - --endIter; - EXPECT_TRUE(endIter.is_valid()) << "EndIter is invalid after decrement"; - EXPECT_EQ(1,endIter->idx()) << "EndIter points on the wrong element"; - - - // Check if the start iterator decrement is invalid - Mesh::VertexEdgeIter startIter = mesh_.ve_begin(vhandle[1]); - EXPECT_TRUE(startIter.is_valid()) << "StartIter is not valid"; - --startIter; - EXPECT_FALSE(startIter.is_valid()) << "StartIter decrement is not invalid"; - - // Check if the start iterator becomes valid - ++startIter; - EXPECT_TRUE(startIter.is_valid()) << "StarIter is invalid after re-incrementing"; - EXPECT_EQ(startIter->idx(), mesh_.ve_begin(vhandle[1])->idx()) << "StartIter points on the wrong element"; - -} +//TEST_F(OpenMeshTrimeshCirculatorVertexEdge, VertexEdgeIterCheckInvalidationAtEnds) { +// +// mesh_.clear(); +// +// // Add some vertices +// Mesh::VertexHandle vhandle[5]; +// +// vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 1, 0)); +// vhandle[1] = mesh_.add_vertex(Mesh::Point(1, 0, 0)); +// vhandle[2] = mesh_.add_vertex(Mesh::Point(2, 1, 0)); +// vhandle[3] = mesh_.add_vertex(Mesh::Point(0,-1, 0)); +// vhandle[4] = mesh_.add_vertex(Mesh::Point(2,-1, 0)); +// +// // Add two faces +// std::vector face_vhandles; +// +// face_vhandles.push_back(vhandle[0]); +// face_vhandles.push_back(vhandle[1]); +// face_vhandles.push_back(vhandle[2]); +// Mesh::FaceHandle fh0 = mesh_.add_face(face_vhandles); +// +// face_vhandles.clear(); +// +// face_vhandles.push_back(vhandle[1]); +// face_vhandles.push_back(vhandle[3]); +// face_vhandles.push_back(vhandle[4]); +// mesh_.add_face(face_vhandles); +// +// face_vhandles.clear(); +// +// face_vhandles.push_back(vhandle[0]); +// face_vhandles.push_back(vhandle[3]); +// face_vhandles.push_back(vhandle[1]); +// mesh_.add_face(face_vhandles); +// +// face_vhandles.clear(); +// +// face_vhandles.push_back(vhandle[2]); +// face_vhandles.push_back(vhandle[1]); +// face_vhandles.push_back(vhandle[4]); +// mesh_.add_face(face_vhandles); +// +// /* Test setup: +// 0 ==== 2 +// |\ 0 /| +// | \ / | +// |2 1 3| +// | / \ | +// |/ 1 \| +// 3 ==== 4 */ +// +// +// // Check if the end iterator stays invalid after end +// Mesh::VertexEdgeIter endIter = mesh_.ve_end(vhandle[1]); +// EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid"; +// ++endIter ; +// EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid after increment"; +// +// // Check if the end iterators becomes valid after decrement +// endIter = mesh_.ve_end(vhandle[1]); +// EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid"; +// --endIter; +// EXPECT_TRUE(endIter.is_valid()) << "EndIter is invalid after decrement"; +// EXPECT_EQ(1,endIter->idx()) << "EndIter points on the wrong element"; +// +// +// // Check if the start iterator decrement is invalid +// Mesh::VertexEdgeIter startIter = mesh_.ve_begin(vhandle[1]); +// EXPECT_TRUE(startIter.is_valid()) << "StartIter is not valid"; +// --startIter; +// EXPECT_FALSE(startIter.is_valid()) << "StartIter decrement is not invalid"; +// +// // Check if the start iterator becomes valid +// ++startIter; +// EXPECT_TRUE(startIter.is_valid()) << "StarIter is invalid after re-incrementing"; +// EXPECT_EQ(startIter->idx(), mesh_.ve_begin(vhandle[1])->idx()) << "StartIter points on the wrong element"; +// +//} /* * Test CW and CCW iterators diff --git a/src/Unittests/unittests_trimesh_circulator_vertex_face.cc b/src/Unittests/unittests_trimesh_circulator_vertex_face.cc index 5651316e..b86c408e 100644 --- a/src/Unittests/unittests_trimesh_circulator_vertex_face.cc +++ b/src/Unittests/unittests_trimesh_circulator_vertex_face.cc @@ -269,187 +269,189 @@ TEST_F(OpenMeshTrimeshCirculatorVertexFace, VertexFaceIterBoundaryIncrement) { /* * Test if the end iterator stays invalid after one lap + * DISABLED as long as the normal iterators using old behavior */ -TEST_F(OpenMeshTrimeshCirculatorVertexFace, VertexFaceIterCheckInvalidationAtEnds) { - - mesh_.clear(); - - // Add some vertices - Mesh::VertexHandle vhandle[5]; - - vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 1, 0)); - vhandle[1] = mesh_.add_vertex(Mesh::Point(1, 0, 0)); - vhandle[2] = mesh_.add_vertex(Mesh::Point(2, 1, 0)); - vhandle[3] = mesh_.add_vertex(Mesh::Point(0,-1, 0)); - vhandle[4] = mesh_.add_vertex(Mesh::Point(2,-1, 0)); - - // Add two faces - std::vector face_vhandles; - - face_vhandles.push_back(vhandle[0]); - face_vhandles.push_back(vhandle[1]); - face_vhandles.push_back(vhandle[2]); - Mesh::FaceHandle fh0 = mesh_.add_face(face_vhandles); - - face_vhandles.clear(); - - face_vhandles.push_back(vhandle[1]); - face_vhandles.push_back(vhandle[3]); - face_vhandles.push_back(vhandle[4]); - mesh_.add_face(face_vhandles); - - face_vhandles.clear(); - - face_vhandles.push_back(vhandle[0]); - face_vhandles.push_back(vhandle[3]); - face_vhandles.push_back(vhandle[1]); - mesh_.add_face(face_vhandles); - - face_vhandles.clear(); - - face_vhandles.push_back(vhandle[2]); - face_vhandles.push_back(vhandle[1]); - face_vhandles.push_back(vhandle[4]); - mesh_.add_face(face_vhandles); - - /* Test setup: - 0 ==== 2 - |\ 0 /| - | \ / | - |2 1 3| - | / \ | - |/ 1 \| - 3 ==== 4 */ - - - // Check if the end iterator stays invalid after end - Mesh::VertexFaceIter endIter = mesh_.vf_end(vhandle[1]); - EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid"; - ++endIter ; - EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid after increment"; - - // Check if the end iterators becomes valid after decrement - endIter = mesh_.vf_end(vhandle[1]); - EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid"; - --endIter; - EXPECT_TRUE(endIter.is_valid()) << "EndIter is invalid after decrement"; - EXPECT_EQ(0,endIter->idx()) << "EndIter points on the wrong element"; - - - // Check if the start iterator decrement is invalid - Mesh::VertexFaceIter startIter = mesh_.vf_begin(vhandle[1]); - EXPECT_TRUE(startIter.is_valid()) << "StartIter is not valid"; - --startIter; - EXPECT_FALSE(startIter.is_valid()) << "StartIter decrement is not invalid"; - - // Check if the start iterator becomes valid - ++startIter; - EXPECT_TRUE(startIter.is_valid()) << "StarIter is invalid after re-incrementing"; - EXPECT_EQ(startIter->idx(), mesh_.vf_begin(vhandle[1])->idx()) << "StartIter points on the wrong element"; - -} +//TEST_F(OpenMeshTrimeshCirculatorVertexFace, VertexFaceIterCheckInvalidationAtEnds) { +// +// mesh_.clear(); +// +// // Add some vertices +// Mesh::VertexHandle vhandle[5]; +// +// vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 1, 0)); +// vhandle[1] = mesh_.add_vertex(Mesh::Point(1, 0, 0)); +// vhandle[2] = mesh_.add_vertex(Mesh::Point(2, 1, 0)); +// vhandle[3] = mesh_.add_vertex(Mesh::Point(0,-1, 0)); +// vhandle[4] = mesh_.add_vertex(Mesh::Point(2,-1, 0)); +// +// // Add two faces +// std::vector face_vhandles; +// +// face_vhandles.push_back(vhandle[0]); +// face_vhandles.push_back(vhandle[1]); +// face_vhandles.push_back(vhandle[2]); +// Mesh::FaceHandle fh0 = mesh_.add_face(face_vhandles); +// +// face_vhandles.clear(); +// +// face_vhandles.push_back(vhandle[1]); +// face_vhandles.push_back(vhandle[3]); +// face_vhandles.push_back(vhandle[4]); +// mesh_.add_face(face_vhandles); +// +// face_vhandles.clear(); +// +// face_vhandles.push_back(vhandle[0]); +// face_vhandles.push_back(vhandle[3]); +// face_vhandles.push_back(vhandle[1]); +// mesh_.add_face(face_vhandles); +// +// face_vhandles.clear(); +// +// face_vhandles.push_back(vhandle[2]); +// face_vhandles.push_back(vhandle[1]); +// face_vhandles.push_back(vhandle[4]); +// mesh_.add_face(face_vhandles); +// +// /* Test setup: +// 0 ==== 2 +// |\ 0 /| +// | \ / | +// |2 1 3| +// | / \ | +// |/ 1 \| +// 3 ==== 4 */ +// +// +// // Check if the end iterator stays invalid after end +// Mesh::VertexFaceIter endIter = mesh_.vf_end(vhandle[1]); +// EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid"; +// ++endIter ; +// EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid after increment"; +// +// // Check if the end iterators becomes valid after decrement +// endIter = mesh_.vf_end(vhandle[1]); +// EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid"; +// --endIter; +// EXPECT_TRUE(endIter.is_valid()) << "EndIter is invalid after decrement"; +// EXPECT_EQ(0,endIter->idx()) << "EndIter points on the wrong element"; +// +// +// // Check if the start iterator decrement is invalid +// Mesh::VertexFaceIter startIter = mesh_.vf_begin(vhandle[1]); +// EXPECT_TRUE(startIter.is_valid()) << "StartIter is not valid"; +// --startIter; +// EXPECT_FALSE(startIter.is_valid()) << "StartIter decrement is not invalid"; +// +// // Check if the start iterator becomes valid +// ++startIter; +// EXPECT_TRUE(startIter.is_valid()) << "StarIter is invalid after re-incrementing"; +// EXPECT_EQ(startIter->idx(), mesh_.vf_begin(vhandle[1])->idx()) << "StartIter points on the wrong element"; +// +//} /* * VertexFaceIterator Test without holes testing decrement + * DISABLED as long as the normal iterators using old behavior */ -TEST_F(OpenMeshTrimeshCirculatorVertexFace, VertexFaceIterWithoutHolesDecrement) { - - mesh_.clear(); - - // Add some vertices - Mesh::VertexHandle vhandle[5]; - - vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 1, 0)); - vhandle[1] = mesh_.add_vertex(Mesh::Point(1, 0, 0)); - vhandle[2] = mesh_.add_vertex(Mesh::Point(2, 1, 0)); - vhandle[3] = mesh_.add_vertex(Mesh::Point(0,-1, 0)); - vhandle[4] = mesh_.add_vertex(Mesh::Point(2,-1, 0)); - - // Add two faces - std::vector face_vhandles; - - face_vhandles.push_back(vhandle[0]); - face_vhandles.push_back(vhandle[1]); - face_vhandles.push_back(vhandle[2]); - mesh_.add_face(face_vhandles); - - face_vhandles.clear(); - - face_vhandles.push_back(vhandle[1]); - face_vhandles.push_back(vhandle[3]); - face_vhandles.push_back(vhandle[4]); - mesh_.add_face(face_vhandles); - - face_vhandles.clear(); - - face_vhandles.push_back(vhandle[0]); - face_vhandles.push_back(vhandle[3]); - face_vhandles.push_back(vhandle[1]); - mesh_.add_face(face_vhandles); - - face_vhandles.clear(); - - face_vhandles.push_back(vhandle[2]); - face_vhandles.push_back(vhandle[1]); - face_vhandles.push_back(vhandle[4]); - mesh_.add_face(face_vhandles); - - /* Test setup: - 0 ==== 2 - |\ 0 /| - | \ / | - |2 1 3| - | / \ | - |/ 1 \| - 3 ==== 4 */ - - mesh_.vf_begin(vhandle[1]); - - // Iterate around vertex 1 at the middle - Mesh::VertexFaceIter vf_it = mesh_.vf_begin(vhandle[1]); - std::advance(vf_it,3); - Mesh::VertexFaceIter vf_end = mesh_.vf_begin(vhandle[1]); - --vf_end; - - EXPECT_EQ(0, vf_it->idx() ) << "Index wrong in VertexFaceIter at initialization"; - EXPECT_TRUE(vf_it.is_valid()) << "Iterator invalid in VertexFaceIter at initialization"; - --vf_it ; - EXPECT_EQ(2, vf_it->idx() ) << "Index wrong in VertexFaceIter at step 1"; - EXPECT_TRUE(vf_it.is_valid()) << "Iterator invalid in VertexFaceIter at step 1"; - --vf_it ; - EXPECT_EQ(1, vf_it->idx() ) << "Index wrong in VertexFaceIter at step 2"; - EXPECT_TRUE(vf_it.is_valid()) << "Iterator invalid in VertexFaceIter at step 2"; - --vf_it ; - EXPECT_EQ(3, vf_it->idx() ) << "Index wrong in VertexFaceIter at step 3"; - EXPECT_TRUE(vf_it.is_valid()) << "Iterator invalid in VertexFaceIter at step 3"; - --vf_it ; - EXPECT_EQ(0, vf_it->idx() ) << "Index wrong in VertexFaceIter at end"; - EXPECT_FALSE(vf_it.is_valid()) << "Iterator invalid in VertexFaceIter at step 2"; - EXPECT_TRUE( vf_it == vf_end ) << "End iterator for VertexFaceIter not matching"; - - // Iterate around vertex 1 at the middle with const iterator - Mesh::ConstVertexFaceIter cvf_it = mesh_.cvf_begin(vhandle[1]); - std::advance(cvf_it,3); - Mesh::ConstVertexFaceIter cvf_end = mesh_.cvf_begin(vhandle[1]); - --cvf_end; - - EXPECT_EQ(0, cvf_it->idx() ) << "Index wrong in ConstVertexFaceIter at initialization"; - EXPECT_TRUE(cvf_it.is_valid()) << "Iterator invalid in ConstVertexFaceIter at initialization"; - --cvf_it ; - EXPECT_EQ(2, cvf_it->idx() ) << "Index wrong in ConstVertexFaceIter at step 1"; - EXPECT_TRUE(cvf_it.is_valid()) << "Iterator invalid in ConstVertexFaceIter at step 1"; - --cvf_it ; - EXPECT_EQ(1, cvf_it->idx() ) << "Index wrong in ConstVertexFaceIter at step 2"; - EXPECT_TRUE(cvf_it.is_valid()) << "Iterator invalid in ConstVertexFaceIter at step 2"; - --cvf_it ; - EXPECT_EQ(3, cvf_it->idx() ) << "Index wrong in ConstVertexFaceIter at step 3"; - EXPECT_TRUE(cvf_it.is_valid()) << "Iterator invalid in ConstVertexFaceIter at step 3"; - --cvf_it ; - EXPECT_EQ(0, cvf_it->idx() ) << "Index wrong in ConstVertexFaceIter at end"; - EXPECT_FALSE(cvf_it.is_valid()) << "Iterator invalid in VertexFaceIter at step 2"; - EXPECT_TRUE( cvf_it == cvf_end ) << "End iterator for ConstVertexFaceIter not matching"; - -} +//TEST_F(OpenMeshTrimeshCirculatorVertexFace, VertexFaceIterWithoutHolesDecrement) { +// +// mesh_.clear(); +// +// // Add some vertices +// Mesh::VertexHandle vhandle[5]; +// +// vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 1, 0)); +// vhandle[1] = mesh_.add_vertex(Mesh::Point(1, 0, 0)); +// vhandle[2] = mesh_.add_vertex(Mesh::Point(2, 1, 0)); +// vhandle[3] = mesh_.add_vertex(Mesh::Point(0,-1, 0)); +// vhandle[4] = mesh_.add_vertex(Mesh::Point(2,-1, 0)); +// +// // Add two faces +// std::vector face_vhandles; +// +// face_vhandles.push_back(vhandle[0]); +// face_vhandles.push_back(vhandle[1]); +// face_vhandles.push_back(vhandle[2]); +// mesh_.add_face(face_vhandles); +// +// face_vhandles.clear(); +// +// face_vhandles.push_back(vhandle[1]); +// face_vhandles.push_back(vhandle[3]); +// face_vhandles.push_back(vhandle[4]); +// mesh_.add_face(face_vhandles); +// +// face_vhandles.clear(); +// +// face_vhandles.push_back(vhandle[0]); +// face_vhandles.push_back(vhandle[3]); +// face_vhandles.push_back(vhandle[1]); +// mesh_.add_face(face_vhandles); +// +// face_vhandles.clear(); +// +// face_vhandles.push_back(vhandle[2]); +// face_vhandles.push_back(vhandle[1]); +// face_vhandles.push_back(vhandle[4]); +// mesh_.add_face(face_vhandles); +// +// /* Test setup: +// 0 ==== 2 +// |\ 0 /| +// | \ / | +// |2 1 3| +// | / \ | +// |/ 1 \| +// 3 ==== 4 */ +// +// mesh_.vf_begin(vhandle[1]); +// +// // Iterate around vertex 1 at the middle +// Mesh::VertexFaceIter vf_it = mesh_.vf_begin(vhandle[1]); +// std::advance(vf_it,3); +// Mesh::VertexFaceIter vf_end = mesh_.vf_begin(vhandle[1]); +// --vf_end; +// +// EXPECT_EQ(0, vf_it->idx() ) << "Index wrong in VertexFaceIter at initialization"; +// EXPECT_TRUE(vf_it.is_valid()) << "Iterator invalid in VertexFaceIter at initialization"; +// --vf_it ; +// EXPECT_EQ(2, vf_it->idx() ) << "Index wrong in VertexFaceIter at step 1"; +// EXPECT_TRUE(vf_it.is_valid()) << "Iterator invalid in VertexFaceIter at step 1"; +// --vf_it ; +// EXPECT_EQ(1, vf_it->idx() ) << "Index wrong in VertexFaceIter at step 2"; +// EXPECT_TRUE(vf_it.is_valid()) << "Iterator invalid in VertexFaceIter at step 2"; +// --vf_it ; +// EXPECT_EQ(3, vf_it->idx() ) << "Index wrong in VertexFaceIter at step 3"; +// EXPECT_TRUE(vf_it.is_valid()) << "Iterator invalid in VertexFaceIter at step 3"; +// --vf_it ; +// EXPECT_EQ(0, vf_it->idx() ) << "Index wrong in VertexFaceIter at end"; +// EXPECT_FALSE(vf_it.is_valid()) << "Iterator invalid in VertexFaceIter at step 2"; +// EXPECT_TRUE( vf_it == vf_end ) << "End iterator for VertexFaceIter not matching"; +// +// // Iterate around vertex 1 at the middle with const iterator +// Mesh::ConstVertexFaceIter cvf_it = mesh_.cvf_begin(vhandle[1]); +// std::advance(cvf_it,3); +// Mesh::ConstVertexFaceIter cvf_end = mesh_.cvf_begin(vhandle[1]); +// --cvf_end; +// +// EXPECT_EQ(0, cvf_it->idx() ) << "Index wrong in ConstVertexFaceIter at initialization"; +// EXPECT_TRUE(cvf_it.is_valid()) << "Iterator invalid in ConstVertexFaceIter at initialization"; +// --cvf_it ; +// EXPECT_EQ(2, cvf_it->idx() ) << "Index wrong in ConstVertexFaceIter at step 1"; +// EXPECT_TRUE(cvf_it.is_valid()) << "Iterator invalid in ConstVertexFaceIter at step 1"; +// --cvf_it ; +// EXPECT_EQ(1, cvf_it->idx() ) << "Index wrong in ConstVertexFaceIter at step 2"; +// EXPECT_TRUE(cvf_it.is_valid()) << "Iterator invalid in ConstVertexFaceIter at step 2"; +// --cvf_it ; +// EXPECT_EQ(3, cvf_it->idx() ) << "Index wrong in ConstVertexFaceIter at step 3"; +// EXPECT_TRUE(cvf_it.is_valid()) << "Iterator invalid in ConstVertexFaceIter at step 3"; +// --cvf_it ; +// EXPECT_EQ(0, cvf_it->idx() ) << "Index wrong in ConstVertexFaceIter at end"; +// EXPECT_FALSE(cvf_it.is_valid()) << "Iterator invalid in VertexFaceIter at step 2"; +// EXPECT_TRUE( cvf_it == cvf_end ) << "End iterator for ConstVertexFaceIter not matching"; +// +//} /* * Test CW and CCW iterators diff --git a/src/Unittests/unittests_trimesh_circulator_vertex_ihalfedge.cc b/src/Unittests/unittests_trimesh_circulator_vertex_ihalfedge.cc index 760a61df..f8c0622a 100644 --- a/src/Unittests/unittests_trimesh_circulator_vertex_ihalfedge.cc +++ b/src/Unittests/unittests_trimesh_circulator_vertex_ihalfedge.cc @@ -314,85 +314,86 @@ TEST_F(OpenMeshTrimeshCirculatorVertexIHalfEdge, VertexIncomingHalfedgeDereferen /* * Test if the end iterator stays invalid after one lap + * DISABLED as long as the normal iterators using old behavior */ -TEST_F(OpenMeshTrimeshCirculatorVertexIHalfEdge, VertexIHalfEdgeIterCheckInvalidationAtEnds) { - - mesh_.clear(); - - // Add some vertices - Mesh::VertexHandle vhandle[5]; - - vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 1, 0)); - vhandle[1] = mesh_.add_vertex(Mesh::Point(1, 0, 0)); - vhandle[2] = mesh_.add_vertex(Mesh::Point(2, 1, 0)); - vhandle[3] = mesh_.add_vertex(Mesh::Point(0,-1, 0)); - vhandle[4] = mesh_.add_vertex(Mesh::Point(2,-1, 0)); - - // Add two faces - std::vector face_vhandles; - - face_vhandles.push_back(vhandle[0]); - face_vhandles.push_back(vhandle[1]); - face_vhandles.push_back(vhandle[2]); - Mesh::FaceHandle fh0 = mesh_.add_face(face_vhandles); - - face_vhandles.clear(); - - face_vhandles.push_back(vhandle[1]); - face_vhandles.push_back(vhandle[3]); - face_vhandles.push_back(vhandle[4]); - mesh_.add_face(face_vhandles); - - face_vhandles.clear(); - - face_vhandles.push_back(vhandle[0]); - face_vhandles.push_back(vhandle[3]); - face_vhandles.push_back(vhandle[1]); - mesh_.add_face(face_vhandles); - - face_vhandles.clear(); - - face_vhandles.push_back(vhandle[2]); - face_vhandles.push_back(vhandle[1]); - face_vhandles.push_back(vhandle[4]); - mesh_.add_face(face_vhandles); - - /* Test setup: - 0 ==== 2 - |\ 0 /| - | \ / | - |2 1 3| - | / \ | - |/ 1 \| - 3 ==== 4 */ - - - // Check if the end iterator stays invalid after end - Mesh::VertexIHalfedgeIter endIter = mesh_.vih_end(vhandle[1]); - EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid"; - ++endIter ; - EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid after increment"; - - // Check if the end iterators becomes valid after decrement - endIter = mesh_.vih_end(vhandle[1]); - EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid"; - --endIter; - EXPECT_TRUE(endIter.is_valid()) << "EndIter is invalid after decrement"; - EXPECT_EQ(3,endIter->idx()) << "EndIter points on the wrong element"; - - - // Check if the start iterator decrement is invalid - Mesh::VertexIHalfedgeIter startIter = mesh_.vih_begin(vhandle[1]); - EXPECT_TRUE(startIter.is_valid()) << "StartIter is not valid"; - --startIter; - EXPECT_FALSE(startIter.is_valid()) << "StartIter decrement is not invalid"; - - // Check if the start iterator becomes valid - ++startIter; - EXPECT_TRUE(startIter.is_valid()) << "StarIter is invalid after re-incrementing"; - EXPECT_EQ(startIter->idx(), mesh_.vih_begin(vhandle[1])->idx()) << "StartIter points on the wrong element"; - -} +//TEST_F(OpenMeshTrimeshCirculatorVertexIHalfEdge, VertexIHalfEdgeIterCheckInvalidationAtEnds) { +// +// mesh_.clear(); +// +// // Add some vertices +// Mesh::VertexHandle vhandle[5]; +// +// vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 1, 0)); +// vhandle[1] = mesh_.add_vertex(Mesh::Point(1, 0, 0)); +// vhandle[2] = mesh_.add_vertex(Mesh::Point(2, 1, 0)); +// vhandle[3] = mesh_.add_vertex(Mesh::Point(0,-1, 0)); +// vhandle[4] = mesh_.add_vertex(Mesh::Point(2,-1, 0)); +// +// // Add two faces +// std::vector face_vhandles; +// +// face_vhandles.push_back(vhandle[0]); +// face_vhandles.push_back(vhandle[1]); +// face_vhandles.push_back(vhandle[2]); +// Mesh::FaceHandle fh0 = mesh_.add_face(face_vhandles); +// +// face_vhandles.clear(); +// +// face_vhandles.push_back(vhandle[1]); +// face_vhandles.push_back(vhandle[3]); +// face_vhandles.push_back(vhandle[4]); +// mesh_.add_face(face_vhandles); +// +// face_vhandles.clear(); +// +// face_vhandles.push_back(vhandle[0]); +// face_vhandles.push_back(vhandle[3]); +// face_vhandles.push_back(vhandle[1]); +// mesh_.add_face(face_vhandles); +// +// face_vhandles.clear(); +// +// face_vhandles.push_back(vhandle[2]); +// face_vhandles.push_back(vhandle[1]); +// face_vhandles.push_back(vhandle[4]); +// mesh_.add_face(face_vhandles); +// +// /* Test setup: +// 0 ==== 2 +// |\ 0 /| +// | \ / | +// |2 1 3| +// | / \ | +// |/ 1 \| +// 3 ==== 4 */ +// +// +// // Check if the end iterator stays invalid after end +// Mesh::VertexIHalfedgeIter endIter = mesh_.vih_end(vhandle[1]); +// EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid"; +// ++endIter ; +// EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid after increment"; +// +// // Check if the end iterators becomes valid after decrement +// endIter = mesh_.vih_end(vhandle[1]); +// EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid"; +// --endIter; +// EXPECT_TRUE(endIter.is_valid()) << "EndIter is invalid after decrement"; +// EXPECT_EQ(3,endIter->idx()) << "EndIter points on the wrong element"; +// +// +// // Check if the start iterator decrement is invalid +// Mesh::VertexIHalfedgeIter startIter = mesh_.vih_begin(vhandle[1]); +// EXPECT_TRUE(startIter.is_valid()) << "StartIter is not valid"; +// --startIter; +// EXPECT_FALSE(startIter.is_valid()) << "StartIter decrement is not invalid"; +// +// // Check if the start iterator becomes valid +// ++startIter; +// EXPECT_TRUE(startIter.is_valid()) << "StarIter is invalid after re-incrementing"; +// EXPECT_EQ(startIter->idx(), mesh_.vih_begin(vhandle[1])->idx()) << "StartIter points on the wrong element"; +// +//} /* * Test CW and CCW iterators diff --git a/src/Unittests/unittests_trimesh_circulator_vertex_ohalfedge.cc b/src/Unittests/unittests_trimesh_circulator_vertex_ohalfedge.cc index 70ab87d8..b0d0ee07 100644 --- a/src/Unittests/unittests_trimesh_circulator_vertex_ohalfedge.cc +++ b/src/Unittests/unittests_trimesh_circulator_vertex_ohalfedge.cc @@ -315,84 +315,85 @@ TEST_F(OpenMeshTrimeshCirculatorVertexOHalfEdge, VertexOutgoingHalfedgeDereferen /* * Test if the end iterator stays invalid after one lap + * DISABLED as long as the normal iterators using old behavior */ -TEST_F(OpenMeshTrimeshCirculatorVertexOHalfEdge, VertexOHalfEdgeIterCheckInvalidationAtEnds) { - - mesh_.clear(); - - // Add some vertices - Mesh::VertexHandle vhandle[5]; - - vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 1, 0)); - vhandle[1] = mesh_.add_vertex(Mesh::Point(1, 0, 0)); - vhandle[2] = mesh_.add_vertex(Mesh::Point(2, 1, 0)); - vhandle[3] = mesh_.add_vertex(Mesh::Point(0,-1, 0)); - vhandle[4] = mesh_.add_vertex(Mesh::Point(2,-1, 0)); - - // Add two faces - std::vector face_vhandles; - - face_vhandles.push_back(vhandle[0]); - face_vhandles.push_back(vhandle[1]); - face_vhandles.push_back(vhandle[2]); - Mesh::FaceHandle fh0 = mesh_.add_face(face_vhandles); - - face_vhandles.clear(); - - face_vhandles.push_back(vhandle[1]); - face_vhandles.push_back(vhandle[3]); - face_vhandles.push_back(vhandle[4]); - mesh_.add_face(face_vhandles); - - face_vhandles.clear(); - - face_vhandles.push_back(vhandle[0]); - face_vhandles.push_back(vhandle[3]); - face_vhandles.push_back(vhandle[1]); - mesh_.add_face(face_vhandles); - - face_vhandles.clear(); - - face_vhandles.push_back(vhandle[2]); - face_vhandles.push_back(vhandle[1]); - face_vhandles.push_back(vhandle[4]); - mesh_.add_face(face_vhandles); - - /* Test setup: - 0 ==== 2 - |\ 0 /| - | \ / | - |2 1 3| - | / \ | - |/ 1 \| - 3 ==== 4 */ - - - // Check if the end iterator stays invalid after end - Mesh::VertexOHalfedgeIter endIter = mesh_.voh_end(vhandle[1]); - EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid"; - ++endIter ; - EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid after increment"; - - endIter = mesh_.voh_end(vhandle[1]); - EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid"; - --endIter; - EXPECT_TRUE(endIter.is_valid()) << "EndIter is invalid after decrement"; - EXPECT_EQ(2,endIter->idx()) << "EndIter points on the wrong element"; - - - // Check if the start iterator decrement is invalid - Mesh::VertexOHalfedgeIter startIter = mesh_.voh_begin(vhandle[1]); - EXPECT_TRUE(startIter.is_valid()) << "StartIter is not valid"; - --startIter; - EXPECT_FALSE(startIter.is_valid()) << "StartIter decrement is not invalid"; - - // Check if the start iterator becomes valid - ++startIter; - EXPECT_TRUE(startIter.is_valid()) << "StartIter is invalid after re-incrementing"; - EXPECT_EQ(startIter->idx(), mesh_.voh_begin(vhandle[1])->idx()) << "StartIter points on the wrong element"; - -} +//TEST_F(OpenMeshTrimeshCirculatorVertexOHalfEdge, VertexOHalfEdgeIterCheckInvalidationAtEnds) { +// +// mesh_.clear(); +// +// // Add some vertices +// Mesh::VertexHandle vhandle[5]; +// +// vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 1, 0)); +// vhandle[1] = mesh_.add_vertex(Mesh::Point(1, 0, 0)); +// vhandle[2] = mesh_.add_vertex(Mesh::Point(2, 1, 0)); +// vhandle[3] = mesh_.add_vertex(Mesh::Point(0,-1, 0)); +// vhandle[4] = mesh_.add_vertex(Mesh::Point(2,-1, 0)); +// +// // Add two faces +// std::vector face_vhandles; +// +// face_vhandles.push_back(vhandle[0]); +// face_vhandles.push_back(vhandle[1]); +// face_vhandles.push_back(vhandle[2]); +// Mesh::FaceHandle fh0 = mesh_.add_face(face_vhandles); +// +// face_vhandles.clear(); +// +// face_vhandles.push_back(vhandle[1]); +// face_vhandles.push_back(vhandle[3]); +// face_vhandles.push_back(vhandle[4]); +// mesh_.add_face(face_vhandles); +// +// face_vhandles.clear(); +// +// face_vhandles.push_back(vhandle[0]); +// face_vhandles.push_back(vhandle[3]); +// face_vhandles.push_back(vhandle[1]); +// mesh_.add_face(face_vhandles); +// +// face_vhandles.clear(); +// +// face_vhandles.push_back(vhandle[2]); +// face_vhandles.push_back(vhandle[1]); +// face_vhandles.push_back(vhandle[4]); +// mesh_.add_face(face_vhandles); +// +// /* Test setup: +// 0 ==== 2 +// |\ 0 /| +// | \ / | +// |2 1 3| +// | / \ | +// |/ 1 \| +// 3 ==== 4 */ +// +// +// // Check if the end iterator stays invalid after end +// Mesh::VertexOHalfedgeIter endIter = mesh_.voh_end(vhandle[1]); +// EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid"; +// ++endIter ; +// EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid after increment"; +// +// endIter = mesh_.voh_end(vhandle[1]); +// EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid"; +// --endIter; +// EXPECT_TRUE(endIter.is_valid()) << "EndIter is invalid after decrement"; +// EXPECT_EQ(2,endIter->idx()) << "EndIter points on the wrong element"; +// +// +// // Check if the start iterator decrement is invalid +// Mesh::VertexOHalfedgeIter startIter = mesh_.voh_begin(vhandle[1]); +// EXPECT_TRUE(startIter.is_valid()) << "StartIter is not valid"; +// --startIter; +// EXPECT_FALSE(startIter.is_valid()) << "StartIter decrement is not invalid"; +// +// // Check if the start iterator becomes valid +// ++startIter; +// EXPECT_TRUE(startIter.is_valid()) << "StartIter is invalid after re-incrementing"; +// EXPECT_EQ(startIter->idx(), mesh_.voh_begin(vhandle[1])->idx()) << "StartIter points on the wrong element"; +// +//} /* * Test CW and CCW iterators diff --git a/src/Unittests/unittests_trimesh_circulator_vertex_vertex.cc b/src/Unittests/unittests_trimesh_circulator_vertex_vertex.cc index 45586973..5946cb64 100644 --- a/src/Unittests/unittests_trimesh_circulator_vertex_vertex.cc +++ b/src/Unittests/unittests_trimesh_circulator_vertex_vertex.cc @@ -203,85 +203,86 @@ TEST_F(OpenMeshTrimeshCirculatorVertexVertex, VertexVertexBoundaryIncrement) { /* * Test if the end iterator stays invalid after one lap + * DISABLED as long as the normal iterators using old behavior */ -TEST_F(OpenMeshTrimeshCirculatorVertexVertex, VertexVertexIterCheckInvalidationAtEnds) { - - mesh_.clear(); - - // Add some vertices - Mesh::VertexHandle vhandle[5]; - - vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 1, 0)); - vhandle[1] = mesh_.add_vertex(Mesh::Point(1, 0, 0)); - vhandle[2] = mesh_.add_vertex(Mesh::Point(2, 1, 0)); - vhandle[3] = mesh_.add_vertex(Mesh::Point(0,-1, 0)); - vhandle[4] = mesh_.add_vertex(Mesh::Point(2,-1, 0)); - - // Add two faces - std::vector face_vhandles; - - face_vhandles.push_back(vhandle[0]); - face_vhandles.push_back(vhandle[1]); - face_vhandles.push_back(vhandle[2]); - Mesh::FaceHandle fh0 = mesh_.add_face(face_vhandles); - - face_vhandles.clear(); - - face_vhandles.push_back(vhandle[1]); - face_vhandles.push_back(vhandle[3]); - face_vhandles.push_back(vhandle[4]); - mesh_.add_face(face_vhandles); - - face_vhandles.clear(); - - face_vhandles.push_back(vhandle[0]); - face_vhandles.push_back(vhandle[3]); - face_vhandles.push_back(vhandle[1]); - mesh_.add_face(face_vhandles); - - face_vhandles.clear(); - - face_vhandles.push_back(vhandle[2]); - face_vhandles.push_back(vhandle[1]); - face_vhandles.push_back(vhandle[4]); - mesh_.add_face(face_vhandles); - - /* Test setup: - 0 ==== 2 - |\ 0 /| - | \ / | - |2 1 3| - | / \ | - |/ 1 \| - 3 ==== 4 */ - - - // Check if the end iterator stays invalid after end - Mesh::VertexVertexIter endIter = mesh_.vv_end(vhandle[1]); - EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid"; - ++endIter ; - EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid after increment"; - - // Check if the end iterators becomes valid after decrement - endIter = mesh_.vv_end(vhandle[1]); - EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid"; - --endIter; - EXPECT_TRUE(endIter.is_valid()) << "EndIter is invalid after decrement"; - EXPECT_EQ(2,endIter->idx()) << "EndIter points on the wrong element"; - - - // Check if the start iterator decrement is invalid - Mesh::VertexVertexIter startIter = mesh_.vv_begin(vhandle[1]); - EXPECT_TRUE(startIter.is_valid()) << "StartIter is not valid"; - --startIter; - EXPECT_FALSE(startIter.is_valid()) << "StartIter decrement is not invalid"; - - // Check if the start iterator becomes valid - ++startIter; - EXPECT_TRUE(startIter.is_valid()) << "StartIter is invalid after re-incrementing"; - EXPECT_EQ(startIter->idx(), mesh_.vv_begin(vhandle[1])->idx()) << "StartIter points on the wrong element"; - -} +//TEST_F(OpenMeshTrimeshCirculatorVertexVertex, VertexVertexIterCheckInvalidationAtEnds) { +// +// mesh_.clear(); +// +// // Add some vertices +// Mesh::VertexHandle vhandle[5]; +// +// vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 1, 0)); +// vhandle[1] = mesh_.add_vertex(Mesh::Point(1, 0, 0)); +// vhandle[2] = mesh_.add_vertex(Mesh::Point(2, 1, 0)); +// vhandle[3] = mesh_.add_vertex(Mesh::Point(0,-1, 0)); +// vhandle[4] = mesh_.add_vertex(Mesh::Point(2,-1, 0)); +// +// // Add two faces +// std::vector face_vhandles; +// +// face_vhandles.push_back(vhandle[0]); +// face_vhandles.push_back(vhandle[1]); +// face_vhandles.push_back(vhandle[2]); +// Mesh::FaceHandle fh0 = mesh_.add_face(face_vhandles); +// +// face_vhandles.clear(); +// +// face_vhandles.push_back(vhandle[1]); +// face_vhandles.push_back(vhandle[3]); +// face_vhandles.push_back(vhandle[4]); +// mesh_.add_face(face_vhandles); +// +// face_vhandles.clear(); +// +// face_vhandles.push_back(vhandle[0]); +// face_vhandles.push_back(vhandle[3]); +// face_vhandles.push_back(vhandle[1]); +// mesh_.add_face(face_vhandles); +// +// face_vhandles.clear(); +// +// face_vhandles.push_back(vhandle[2]); +// face_vhandles.push_back(vhandle[1]); +// face_vhandles.push_back(vhandle[4]); +// mesh_.add_face(face_vhandles); +// +// /* Test setup: +// 0 ==== 2 +// |\ 0 /| +// | \ / | +// |2 1 3| +// | / \ | +// |/ 1 \| +// 3 ==== 4 */ +// +// +// // Check if the end iterator stays invalid after end +// Mesh::VertexVertexIter endIter = mesh_.vv_end(vhandle[1]); +// EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid"; +// ++endIter ; +// EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid after increment"; +// +// // Check if the end iterators becomes valid after decrement +// endIter = mesh_.vv_end(vhandle[1]); +// EXPECT_FALSE(endIter.is_valid()) << "EndIter is not invalid"; +// --endIter; +// EXPECT_TRUE(endIter.is_valid()) << "EndIter is invalid after decrement"; +// EXPECT_EQ(2,endIter->idx()) << "EndIter points on the wrong element"; +// +// +// // Check if the start iterator decrement is invalid +// Mesh::VertexVertexIter startIter = mesh_.vv_begin(vhandle[1]); +// EXPECT_TRUE(startIter.is_valid()) << "StartIter is not valid"; +// --startIter; +// EXPECT_FALSE(startIter.is_valid()) << "StartIter decrement is not invalid"; +// +// // Check if the start iterator becomes valid +// ++startIter; +// EXPECT_TRUE(startIter.is_valid()) << "StartIter is invalid after re-incrementing"; +// EXPECT_EQ(startIter->idx(), mesh_.vv_begin(vhandle[1])->idx()) << "StartIter points on the wrong element"; +// +//} /* * Test CW and CCW iterators