From eb9d631346f5f89e76932bc9247416a3154c4282 Mon Sep 17 00:00:00 2001 From: Max Lyon Date: Tue, 9 Mar 2021 15:33:05 +0100 Subject: [PATCH] adjust unittests for new CW CCW behavior --- .../unittests_trimesh_circulator_face_edge.cc | 29 ++++++++-------- .../unittests_trimesh_circulator_face_face.cc | 27 ++++++++------- ...ttests_trimesh_circulator_face_halfedge.cc | 25 +++++++------- ...nittests_trimesh_circulator_face_vertex.cc | 25 +++++++------- ...nittests_trimesh_circulator_vertex_edge.cc | 33 +++++++++---------- ...nittests_trimesh_circulator_vertex_face.cc | 33 +++++++++---------- ...sts_trimesh_circulator_vertex_ihalfedge.cc | 33 +++++++++---------- ...sts_trimesh_circulator_vertex_ohalfedge.cc | 33 +++++++++---------- ...ttests_trimesh_circulator_vertex_vertex.cc | 33 +++++++++---------- src/Unittests/unittests_trimesh_ranges.cc | 18 +++++----- 10 files changed, 141 insertions(+), 148 deletions(-) diff --git a/src/Unittests/unittests_trimesh_circulator_face_edge.cc b/src/Unittests/unittests_trimesh_circulator_face_edge.cc index 8026da8b..f7b88f2c 100644 --- a/src/Unittests/unittests_trimesh_circulator_face_edge.cc +++ b/src/Unittests/unittests_trimesh_circulator_face_edge.cc @@ -191,9 +191,9 @@ TEST_F(OpenMeshTrimeshCirculatorFaceEdge, CWAndCCWTest) { */ - int indices[4] = {4, 1, 3, 4}; - int rev_indices[4]; - std::reverse_copy(indices,indices+4,rev_indices); + int indices[3] = {4, 1, 3}; + int rev_indices[3]; + std::reverse_copy(indices,indices+3,rev_indices); //CCW Mesh::FaceEdgeCCWIter fe_ccwit = mesh_.fe_ccwbegin(mesh_.face_handle(1)); @@ -243,29 +243,28 @@ TEST_F(OpenMeshTrimeshCirculatorFaceEdge, CWAndCCWTest) { /* * conversion properties: - * a) cw_begin == CWIter(ccw_begin()) + * a) *cw_begin == *++CWIter(ccw_end()) * b) cw_iter->idx() == CCWIter(cw_iter)->idx() for valid iterators * c) --cw_iter == CWIter(++ccwIter) for valid iterators - * d) cw_end == CWIter(ccw_end()) => --cw_end != CWIter(++ccw_end()) * + * d) *cw_begin == *++CWIter(ccw_end()) */ Mesh::FaceEdgeCWIter fe_cwIter = mesh_.fe_cwbegin(mesh_.face_handle(1)); // a) - EXPECT_TRUE( fe_cwIter == Mesh::FaceEdgeCWIter(mesh_.fe_ccwbegin(mesh_.face_handle(1))) ) << "ccw to cw conversion failed"; - EXPECT_TRUE( Mesh::FaceEdgeCCWIter(fe_cwIter) == mesh_.fe_ccwbegin(mesh_.face_handle(1)) ) << "cw to ccw conversion failed"; + EXPECT_TRUE( *fe_cwIter == *++Mesh::FaceEdgeCWIter(mesh_.fe_ccwend(mesh_.face_handle(1)))) << "ccw to cw conversion failed"; + EXPECT_TRUE( *++Mesh::FaceEdgeCCWIter(fe_cwIter) == *mesh_.fe_ccwend(mesh_.face_handle(1)) ) << "cw to ccw conversion failed"; // b) EXPECT_EQ( fe_cwIter->idx(), Mesh::FaceEdgeCCWIter(fe_cwIter)->idx()) << "iterators doesnt point on the same element"; // c) + auto fe_ccwIter = Mesh::FaceEdgeCCWIter(fe_cwIter); + EXPECT_EQ(fe_cwIter->idx(),fe_ccwIter->idx())<< "iterators dont point on the same element"; ++fe_cwIter; - fe_ccwend = mesh_.fe_ccwend(mesh_.face_handle(1)); - --fe_ccwend; - EXPECT_EQ(fe_cwIter->idx(),fe_ccwend->idx()) << "iteratoes are not equal after inc/dec"; - // additional conversion check - fe_ccwend = Mesh::FaceEdgeCCWIter(fe_cwIter); - EXPECT_EQ(fe_cwIter->idx(),fe_ccwend->idx())<< "iterators doesnt point on the same element"; + --fe_ccwIter; + EXPECT_EQ(fe_cwIter->idx(),fe_ccwIter->idx()) << "iteratoes are not equal after inc/dec"; // d) - fe_cwIter = Mesh::FaceEdgeCWIter(mesh_.fe_ccwend(mesh_.face_handle(1))); + auto fe_cwEnd = mesh_.fe_ccwend(mesh_.face_handle(1)); + fe_cwIter = Mesh::FaceEdgeCWIter(fe_cwEnd); EXPECT_FALSE(fe_cwIter.is_valid()) << "end iterator is not invalid"; - EXPECT_TRUE(Mesh::FaceEdgeCCWIter(mesh_.fe_cwend(mesh_.face_handle(1))) == mesh_.fe_ccwend(mesh_.face_handle(1))) << "end iterators are not equal"; + EXPECT_TRUE(*mesh_.fe_cwbegin(mesh_.face_handle(1)) == *++fe_cwIter) << "end iterators are not equal"; } diff --git a/src/Unittests/unittests_trimesh_circulator_face_face.cc b/src/Unittests/unittests_trimesh_circulator_face_face.cc index 0a64570c..2a2bb40d 100644 --- a/src/Unittests/unittests_trimesh_circulator_face_face.cc +++ b/src/Unittests/unittests_trimesh_circulator_face_face.cc @@ -267,9 +267,9 @@ TEST_F(OpenMeshTrimeshCirculatorFaceFace, CWAndCCWCheck) { */ - int indices[4] = {2, 0, 3, 2}; - int rev_indices[4]; - std::reverse_copy(indices,indices+4,rev_indices); + int indices[3] = {2, 0, 3}; + int rev_indices[3]; + std::reverse_copy(indices,indices+3,rev_indices); //CCW Mesh::FaceFaceCCWIter ff_ccwit = mesh_.ff_ccwbegin(mesh_.face_handle(1)); @@ -322,26 +322,25 @@ TEST_F(OpenMeshTrimeshCirculatorFaceFace, CWAndCCWCheck) { * a) cw_begin == CWIter(ccw_begin()) * b) cw_iter->idx() == CCWIter(cw_iter)->idx() for valid iterators * c) --cw_iter == CWIter(++ccwIter) for valid iterators - * d) cw_end == CWIter(ccw_end()) => --cw_end != CWIter(++ccw_end()) * + * d) cw_end == CWIter(ccw_end()) */ Mesh::FaceFaceCWIter ff_cwIter = mesh_.ff_cwbegin(mesh_.face_handle(1)); // a) - EXPECT_TRUE( ff_cwIter == Mesh::FaceFaceCWIter(mesh_.ff_ccwbegin(mesh_.face_handle(1))) ) << "ccw to cw conversion failed"; - EXPECT_TRUE( Mesh::FaceFaceCCWIter(ff_cwIter) == mesh_.ff_ccwbegin(mesh_.face_handle(1)) ) << "cw to ccw conversion failed"; + EXPECT_TRUE( *ff_cwIter == *++Mesh::FaceFaceCWIter(mesh_.ff_ccwend(mesh_.face_handle(1)))) << "ccw to cw conversion failed"; + EXPECT_TRUE( *++Mesh::FaceFaceCCWIter(ff_cwIter) == *mesh_.ff_ccwend(mesh_.face_handle(1)) ) << "cw to ccw conversion failed"; // b) EXPECT_EQ( ff_cwIter->idx(), Mesh::FaceFaceCCWIter(ff_cwIter)->idx()) << "iterators doesnt point on the same element"; // c) + auto ff_ccwIter = Mesh::FaceFaceCCWIter(ff_cwIter); + EXPECT_EQ(ff_cwIter->idx(),ff_ccwIter->idx())<< "iterators dont point on the same element"; ++ff_cwIter; - ff_ccwend = mesh_.ff_ccwend(mesh_.face_handle(1)); - --ff_ccwend; - EXPECT_EQ(ff_cwIter->idx(),ff_ccwend->idx()) << "iteratoes are not equal after inc/dec"; - // additional conversion check - ff_ccwend = Mesh::FaceFaceCCWIter(ff_cwIter); - EXPECT_EQ(ff_cwIter->idx(),ff_ccwend->idx())<< "iterators doesnt point on the same element"; + --ff_ccwIter; + EXPECT_EQ(ff_cwIter->idx(),ff_ccwIter->idx()) << "iteratoes are not equal after inc/dec"; // d) - ff_cwIter = Mesh::FaceFaceCWIter(mesh_.ff_ccwend(mesh_.face_handle(1))); + auto ff_cwEnd = mesh_.ff_ccwend(mesh_.face_handle(1)); + ff_cwIter = Mesh::FaceFaceCWIter(ff_cwEnd); EXPECT_FALSE(ff_cwIter.is_valid()) << "end iterator is not invalid"; - EXPECT_TRUE(Mesh::FaceFaceCCWIter(mesh_.ff_cwend(mesh_.face_handle(1))) == mesh_.ff_ccwend(mesh_.face_handle(1))) << "end iterators are not equal"; + EXPECT_TRUE(*mesh_.ff_cwbegin(mesh_.face_handle(1)) == *++ff_cwIter) << "end iterators are not equal"; } diff --git a/src/Unittests/unittests_trimesh_circulator_face_halfedge.cc b/src/Unittests/unittests_trimesh_circulator_face_halfedge.cc index 8b601485..57485d98 100644 --- a/src/Unittests/unittests_trimesh_circulator_face_halfedge.cc +++ b/src/Unittests/unittests_trimesh_circulator_face_halfedge.cc @@ -189,9 +189,9 @@ TEST_F(OpenMeshTrimeshCirculatorFaceHalfEdge, CWAndCCWTest) { */ - int indices[4] = {8, 3, 6, 8}; - int rev_indices[4]; - std::reverse_copy(indices,indices+4,rev_indices); + int indices[3] = {8, 3, 6}; + int rev_indices[3]; + std::reverse_copy(indices,indices+3,rev_indices); //CCW Mesh::FaceHalfedgeCCWIter fh_ccwit = mesh_.fh_ccwbegin(mesh_.face_handle(1)); @@ -248,22 +248,21 @@ TEST_F(OpenMeshTrimeshCirculatorFaceHalfEdge, CWAndCCWTest) { */ Mesh::FaceHalfedgeCWIter fh_cwIter = mesh_.fh_cwbegin(mesh_.face_handle(1)); // a) - EXPECT_TRUE( fh_cwIter == Mesh::FaceHalfedgeCWIter(mesh_.fh_ccwbegin(mesh_.face_handle(1))) ) << "ccw to cw conversion failed"; - EXPECT_TRUE( Mesh::FaceHalfedgeCCWIter(fh_cwIter) == mesh_.fh_ccwbegin(mesh_.face_handle(1)) ) << "cw to ccw conversion failed"; + EXPECT_TRUE( *fh_cwIter == *++Mesh::FaceHalfedgeCWIter(mesh_.fh_ccwend(mesh_.face_handle(1)))) << "ccw to cw conversion failed"; + EXPECT_TRUE( *++Mesh::FaceHalfedgeCCWIter(fh_cwIter) == *mesh_.fh_ccwend(mesh_.face_handle(1)) ) << "cw to ccw conversion failed"; // b) EXPECT_EQ( fh_cwIter->idx(), Mesh::FaceHalfedgeCCWIter(fh_cwIter)->idx()) << "iterators doesnt point on the same element"; // c) + auto fh_ccwIter = Mesh::FaceHalfedgeCCWIter(fh_cwIter); + EXPECT_EQ(fh_cwIter->idx(),fh_ccwIter->idx())<< "iterators dont point on the same element"; ++fh_cwIter; - fh_ccwend = mesh_.fh_ccwend(mesh_.face_handle(1)); - --fh_ccwend; - EXPECT_EQ(fh_cwIter->idx(),fh_ccwend->idx()) << "iteratoes are not equal after inc/dec"; - // additional conversion check - fh_ccwend = Mesh::FaceHalfedgeCCWIter(fh_cwIter); - EXPECT_EQ(fh_cwIter->idx(),fh_ccwend->idx())<< "iterators doesnt point on the same element"; + --fh_ccwIter; + EXPECT_EQ(fh_cwIter->idx(),fh_ccwIter->idx()) << "iteratoes are not equal after inc/dec"; // d) - fh_cwIter = Mesh::FaceHalfedgeCWIter(mesh_.fh_ccwend(mesh_.face_handle(1))); + auto fh_cwEnd = mesh_.fh_ccwend(mesh_.face_handle(1)); + fh_cwIter = Mesh::FaceHalfedgeCWIter(fh_cwEnd); EXPECT_FALSE(fh_cwIter.is_valid()) << "end iterator is not invalid"; - EXPECT_TRUE(Mesh::FaceHalfedgeCCWIter(mesh_.fh_cwend(mesh_.face_handle(1))) == mesh_.fh_ccwend(mesh_.face_handle(1))) << "end iterators are not equal"; + EXPECT_TRUE(*mesh_.fh_cwbegin(mesh_.face_handle(1)) == *++fh_cwIter) << "end iterators are not equal"; } diff --git a/src/Unittests/unittests_trimesh_circulator_face_vertex.cc b/src/Unittests/unittests_trimesh_circulator_face_vertex.cc index 7daa13bf..89d55f04 100644 --- a/src/Unittests/unittests_trimesh_circulator_face_vertex.cc +++ b/src/Unittests/unittests_trimesh_circulator_face_vertex.cc @@ -261,9 +261,9 @@ TEST_F(OpenMeshTrimeshCirculatorFaceVertex, CWAndCCWCheck) { 3 ==== 4 */ - int indices[4] = {0, 1, 2, 0}; - int rev_indices[4]; - std::reverse_copy(indices,indices+4,rev_indices); + int indices[3] = {0, 1, 2}; + int rev_indices[3]; + std::reverse_copy(indices,indices+3,rev_indices); //CCW Mesh::FaceVertexCCWIter fv_ccwit = mesh_.fv_ccwbegin(fh0); @@ -320,22 +320,21 @@ TEST_F(OpenMeshTrimeshCirculatorFaceVertex, CWAndCCWCheck) { */ Mesh::FaceVertexCWIter fv_cwIter = mesh_.fv_cwbegin(mesh_.face_handle(1)); // a) - EXPECT_TRUE( fv_cwIter == Mesh::FaceVertexCWIter(mesh_.fv_ccwbegin(mesh_.face_handle(1))) ) << "ccw to cw conversion failed"; - EXPECT_TRUE( Mesh::FaceVertexCCWIter(fv_cwIter) == mesh_.fv_ccwbegin(mesh_.face_handle(1)) ) << "cw to ccw conversion failed"; + EXPECT_TRUE( *fv_cwIter == *++Mesh::FaceVertexCWIter(mesh_.fv_ccwend(mesh_.face_handle(1)))) << "ccw to cw conversion failed"; + EXPECT_TRUE( *++Mesh::FaceVertexCCWIter(fv_cwIter) == *mesh_.fv_ccwend(mesh_.face_handle(1)) ) << "cw to ccw conversion failed"; // b) EXPECT_EQ( fv_cwIter->idx(), Mesh::FaceVertexCCWIter(fv_cwIter)->idx()) << "iterators doesnt point on the same element"; // c) + auto fv_ccwIter = Mesh::FaceVertexCCWIter(fv_cwIter); + EXPECT_EQ(fv_cwIter->idx(),fv_ccwIter->idx())<< "iterators dont point on the same element"; ++fv_cwIter; - fv_ccwend = mesh_.fv_ccwend(mesh_.face_handle(1)); - --fv_ccwend; - EXPECT_EQ(fv_cwIter->idx(),fv_ccwend->idx()) << "iteratoes are not equal after inc/dec"; - // additional conversion check - fv_ccwend = Mesh::FaceVertexCCWIter(fv_cwIter); - EXPECT_EQ(fv_cwIter->idx(),fv_ccwend->idx())<< "iterators doesnt point on the same element"; + --fv_ccwIter; + EXPECT_EQ(fv_cwIter->idx(),fv_ccwIter->idx()) << "iteratoes are not equal after inc/dec"; // d) - fv_cwIter = Mesh::FaceVertexCWIter(mesh_.fv_ccwend(mesh_.face_handle(1))); + auto fv_cwEnd = mesh_.fv_ccwend(mesh_.face_handle(1)); + fv_cwIter = Mesh::FaceVertexCWIter(fv_cwEnd); EXPECT_FALSE(fv_cwIter.is_valid()) << "end iterator is not invalid"; - EXPECT_TRUE(Mesh::FaceVertexCCWIter(mesh_.fv_cwend(mesh_.face_handle(1))) == mesh_.fv_ccwend(mesh_.face_handle(1))) << "end iterators are not equal"; + EXPECT_TRUE(*mesh_.fv_cwbegin(mesh_.face_handle(1)) == *++fv_cwIter) << "end iterators are not equal"; } diff --git a/src/Unittests/unittests_trimesh_circulator_vertex_edge.cc b/src/Unittests/unittests_trimesh_circulator_vertex_edge.cc index 9689cf89..6a224444 100644 --- a/src/Unittests/unittests_trimesh_circulator_vertex_edge.cc +++ b/src/Unittests/unittests_trimesh_circulator_vertex_edge.cc @@ -336,9 +336,9 @@ TEST_F(OpenMeshTrimeshCirculatorVertexEdge, CWAndCCWCheck) { 3 ==== 4 */ - int indices[5] = {5, 1, 0, 3, 5}; - int rev_indices[5]; - std::reverse_copy(indices,indices+5,rev_indices); + int ccw_indices[4] = {1, 0, 3, 5}; + int cw_indices[4]; + std::reverse_copy(ccw_indices,ccw_indices+4,cw_indices); Mesh::VertexHandle vh = vhandle[1]; @@ -348,7 +348,7 @@ TEST_F(OpenMeshTrimeshCirculatorVertexEdge, CWAndCCWCheck) { size_t i = 0; for (;ve_ccwit != ve_ccwend; ++ve_ccwit, ++i) { - EXPECT_EQ(indices[i], ve_ccwit->idx()) << "Index wrong in VertexEdgeCCWIter"; + EXPECT_EQ(ccw_indices[i], ve_ccwit->idx()) << "Index wrong in VertexEdgeCCWIter"; } EXPECT_FALSE(ve_ccwit.is_valid()) << "Iterator invalid in VertexEdgeCCWIter at end"; @@ -360,7 +360,7 @@ TEST_F(OpenMeshTrimeshCirculatorVertexEdge, CWAndCCWCheck) { i = 0; for (;cve_ccwit != cve_ccwend; ++cve_ccwit, ++i) { - EXPECT_EQ(indices[i], cve_ccwit->idx()) << "Index wrong in ConstVertexEdgeCCWIter"; + EXPECT_EQ(ccw_indices[i], cve_ccwit->idx()) << "Index wrong in ConstVertexEdgeCCWIter"; } EXPECT_FALSE(cve_ccwit.is_valid()) << "Iterator invalid in ConstVertexEdgeCCWIter at end"; @@ -372,7 +372,7 @@ TEST_F(OpenMeshTrimeshCirculatorVertexEdge, CWAndCCWCheck) { i = 0; for (;ve_cwit != ve_cwend; ++ve_cwit, ++i) { - EXPECT_EQ(rev_indices[i], ve_cwit->idx()) << "Index wrong in VertexEdgeCWIter"; + EXPECT_EQ(cw_indices[i], ve_cwit->idx()) << "Index wrong in VertexEdgeCWIter"; } EXPECT_FALSE(ve_cwit.is_valid()) << "Iterator invalid in VertexEdgeCWIter at end"; EXPECT_TRUE( ve_cwit == ve_cwend ) << "End iterator for VertexEdgeCWIter not matching"; @@ -383,7 +383,7 @@ TEST_F(OpenMeshTrimeshCirculatorVertexEdge, CWAndCCWCheck) { i = 0; for (;cve_cwit != cve_cwend; ++cve_cwit, ++i) { - EXPECT_EQ(rev_indices[i], cve_cwit->idx()) << "Index wrong in ConstVertexEdgeCWIter"; + EXPECT_EQ(cw_indices[i], cve_cwit->idx()) << "Index wrong in ConstVertexEdgeCWIter"; } EXPECT_FALSE(cve_cwit.is_valid()) << "Iterator invalid in ConstVertexEdgeCWIter at end"; EXPECT_TRUE( cve_cwit == cve_cwend ) << "End iterator for ConstVertexEdgeCWIter not matching"; @@ -397,22 +397,21 @@ TEST_F(OpenMeshTrimeshCirculatorVertexEdge, CWAndCCWCheck) { */ Mesh::VertexEdgeCWIter ve_cwIter = mesh_.ve_cwbegin(vh); // a) - EXPECT_TRUE( ve_cwIter == Mesh::VertexEdgeCWIter(mesh_.ve_ccwbegin(vh)) ) << "ccw to cw conversion failed"; - EXPECT_TRUE( Mesh::VertexEdgeCCWIter(ve_cwIter) == mesh_.ve_ccwbegin(vh) ) << "cw to ccw conversion failed"; + EXPECT_TRUE( *ve_cwIter == *++Mesh::VertexEdgeCWIter(mesh_.ve_ccwend(vh))) << "ccw to cw conversion failed"; + EXPECT_TRUE( *++Mesh::VertexEdgeCCWIter(ve_cwIter) == *mesh_.ve_ccwend(vh) ) << "cw to ccw conversion failed"; // b) EXPECT_EQ( ve_cwIter->idx(), Mesh::VertexEdgeCCWIter(ve_cwIter)->idx()) << "iterators doesnt point on the same element"; // c) + auto ve_ccwIter = Mesh::VertexEdgeCCWIter(ve_cwIter); + EXPECT_EQ(ve_cwIter->idx(),ve_ccwIter->idx())<< "iterators dont point on the same element"; ++ve_cwIter; - ve_ccwend = mesh_.ve_ccwend(vh); - --ve_ccwend; - EXPECT_EQ(ve_cwIter->idx(),ve_ccwend->idx()) << "iteratoes are not equal after inc/dec"; - // additional conversion check - ve_ccwend = Mesh::VertexEdgeCCWIter(ve_cwIter); - EXPECT_EQ(ve_cwIter->idx(),ve_ccwend->idx())<< "iterators doesnt point on the same element"; + --ve_ccwIter; + EXPECT_EQ(ve_cwIter->idx(),ve_ccwIter->idx()) << "iteratoes are not equal after inc/dec"; // d) - ve_cwIter = Mesh::VertexEdgeCWIter(mesh_.ve_ccwend(vh)); + auto ve_cwEnd = mesh_.ve_ccwend(vh); + ve_cwIter = Mesh::VertexEdgeCWIter(ve_cwEnd); EXPECT_FALSE(ve_cwIter.is_valid()) << "end iterator is not invalid"; - EXPECT_TRUE(Mesh::VertexEdgeCCWIter(mesh_.ve_cwend(vh)) == mesh_.ve_ccwend(vh)) << "end iterators are not equal"; + EXPECT_TRUE(*mesh_.ve_cwbegin(vh) == *++ve_cwIter) << "end iterators are not equal"; } diff --git a/src/Unittests/unittests_trimesh_circulator_vertex_face.cc b/src/Unittests/unittests_trimesh_circulator_vertex_face.cc index de3db015..a97c4e77 100644 --- a/src/Unittests/unittests_trimesh_circulator_vertex_face.cc +++ b/src/Unittests/unittests_trimesh_circulator_vertex_face.cc @@ -509,9 +509,9 @@ TEST_F(OpenMeshTrimeshCirculatorVertexFace, CWAndCCWCheck) { 3 ==== 4 */ - int indices[5] = {3, 0, 2, 1, 3}; - int rev_indices[5]; - std::reverse_copy(indices,indices+5,rev_indices); + int ccw_indices[4] = {0, 2, 1, 3}; + int cw_indices[4]; + std::reverse_copy(ccw_indices,ccw_indices+4,cw_indices); Mesh::VertexHandle vh = vhandle[1]; @@ -521,7 +521,7 @@ TEST_F(OpenMeshTrimeshCirculatorVertexFace, CWAndCCWCheck) { size_t i = 0; for (;vf_ccwit != vf_ccwend; ++vf_ccwit, ++i) { - EXPECT_EQ(indices[i], vf_ccwit->idx()) << "Index wrong in VertexFaceCCWIter"; + EXPECT_EQ(ccw_indices[i], vf_ccwit->idx()) << "Index wrong in VertexFaceCCWIter"; } EXPECT_FALSE(vf_ccwit.is_valid()) << "Iterator invalid in VertexFaceCCWIter at end"; @@ -533,7 +533,7 @@ TEST_F(OpenMeshTrimeshCirculatorVertexFace, CWAndCCWCheck) { i = 0; for (;cvf_ccwit != cvf_ccwend; ++cvf_ccwit, ++i) { - EXPECT_EQ(indices[i], cvf_ccwit->idx()) << "Index wrong in ConstVertexFaceCCWIter"; + EXPECT_EQ(ccw_indices[i], cvf_ccwit->idx()) << "Index wrong in ConstVertexFaceCCWIter"; } EXPECT_FALSE(cvf_ccwit.is_valid()) << "Iterator invalid in ConstVertexFaceCCWIter at end"; @@ -545,7 +545,7 @@ TEST_F(OpenMeshTrimeshCirculatorVertexFace, CWAndCCWCheck) { i = 0; for (;vf_cwit != vf_cwend; ++vf_cwit, ++i) { - EXPECT_EQ(rev_indices[i], vf_cwit->idx()) << "Index wrong in VertexFaceCWIter"; + EXPECT_EQ(cw_indices[i], vf_cwit->idx()) << "Index wrong in VertexFaceCWIter"; } EXPECT_FALSE(vf_cwit.is_valid()) << "Iterator invalid in VertexFaceCWIter at end"; EXPECT_TRUE( vf_cwit == vf_cwend ) << "End iterator for VertexFaceCWIter not matching"; @@ -556,7 +556,7 @@ TEST_F(OpenMeshTrimeshCirculatorVertexFace, CWAndCCWCheck) { i = 0; for (;cvf_cwit != cvf_cwend; ++cvf_cwit, ++i) { - EXPECT_EQ(rev_indices[i], cvf_cwit->idx()) << "Index wrong in ConstVertexFaceCWIter"; + EXPECT_EQ(cw_indices[i], cvf_cwit->idx()) << "Index wrong in ConstVertexFaceCWIter"; } EXPECT_FALSE(cvf_cwit.is_valid()) << "Iterator invalid in ConstVertexFaceCWIter at end"; EXPECT_TRUE( cvf_cwit == cvf_cwend ) << "End iterator for ConstVertexFaceCWIter not matching"; @@ -570,22 +570,21 @@ TEST_F(OpenMeshTrimeshCirculatorVertexFace, CWAndCCWCheck) { */ Mesh::VertexFaceCWIter vf_cwIter = mesh_.vf_cwbegin(vh); // a) - EXPECT_TRUE( vf_cwIter == Mesh::VertexFaceCWIter(mesh_.vf_ccwbegin(vh)) ) << "ccw to cw conversion failed"; - EXPECT_TRUE( Mesh::VertexFaceCCWIter(vf_cwIter) == mesh_.vf_ccwbegin(vh) ) << "cw to ccw conversion failed"; + EXPECT_TRUE( *vf_cwIter == *++Mesh::VertexFaceCWIter(mesh_.vf_ccwend(vh))) << "ccw to cw conversion failed"; + EXPECT_TRUE( *++Mesh::VertexFaceCCWIter(vf_cwIter) == *mesh_.vf_ccwend(vh) ) << "cw to ccw conversion failed"; // b) EXPECT_EQ( vf_cwIter->idx(), Mesh::VertexFaceCCWIter(vf_cwIter)->idx()) << "iterators doesnt point on the same element"; // c) + auto vf_ccwIter = Mesh::VertexFaceCCWIter(vf_cwIter); + EXPECT_EQ(vf_cwIter->idx(),vf_ccwIter->idx())<< "iterators dont point on the same element"; ++vf_cwIter; - vf_ccwend = mesh_.vf_ccwend(vh); - --vf_ccwend; - EXPECT_EQ(vf_cwIter->idx(),vf_ccwend->idx()) << "iteratoes are not equal after inc/dec"; - // additional conversion check - vf_ccwend = Mesh::VertexFaceCCWIter(vf_cwIter); - EXPECT_EQ(vf_cwIter->idx(),vf_ccwend->idx())<< "iterators doesnt point on the same element"; + --vf_ccwIter; + EXPECT_EQ(vf_cwIter->idx(),vf_ccwIter->idx()) << "iteratoes are not equal after inc/dec"; // d) - vf_cwIter = Mesh::VertexFaceCWIter(mesh_.vf_ccwend(vh)); + auto vf_cwEnd = mesh_.vf_ccwend(vh); + vf_cwIter = Mesh::VertexFaceCWIter(vf_cwEnd); EXPECT_FALSE(vf_cwIter.is_valid()) << "end iterator is not invalid"; - EXPECT_TRUE(Mesh::VertexFaceCCWIter(mesh_.vf_cwend(vh)) == mesh_.vf_ccwend(vh)) << "end iterators are not equal"; + EXPECT_TRUE(*mesh_.vf_cwbegin(vh) == *++vf_cwIter) << "end iterators are not equal"; } diff --git a/src/Unittests/unittests_trimesh_circulator_vertex_ihalfedge.cc b/src/Unittests/unittests_trimesh_circulator_vertex_ihalfedge.cc index 85559b0b..9b2e5f5e 100644 --- a/src/Unittests/unittests_trimesh_circulator_vertex_ihalfedge.cc +++ b/src/Unittests/unittests_trimesh_circulator_vertex_ihalfedge.cc @@ -450,9 +450,9 @@ TEST_F(OpenMeshTrimeshCirculatorVertexIHalfEdge, CWAndCCWCheck) { 3 ==== 4 */ - int indices[4] = {14, 5, 2, 14}; - int rev_indices[4]; - std::reverse_copy(indices,indices+4,rev_indices); + int cw_indices[3] = {14, 2, 5}; + int ccw_indices[3]; + std::reverse_copy(cw_indices,cw_indices+3,ccw_indices); Mesh::VertexHandle vh = vhandle[2]; @@ -462,7 +462,7 @@ TEST_F(OpenMeshTrimeshCirculatorVertexIHalfEdge, CWAndCCWCheck) { size_t i = 0; for (;vih_ccwit != vih_ccwend; ++vih_ccwit, ++i) { - EXPECT_EQ(indices[i], vih_ccwit->idx()) << "Index wrong in VertexIHalfedgeCCWIter"; + EXPECT_EQ(ccw_indices[i], vih_ccwit->idx()) << "Index wrong in VertexIHalfedgeCCWIter"; } EXPECT_FALSE(vih_ccwit.is_valid()) << "Iterator invalid in VertexIHalfedgeCCWIter at end"; @@ -474,7 +474,7 @@ TEST_F(OpenMeshTrimeshCirculatorVertexIHalfEdge, CWAndCCWCheck) { i = 0; for (;cvih_ccwit != cvih_ccwend; ++cvih_ccwit, ++i) { - EXPECT_EQ(indices[i], cvih_ccwit->idx()) << "Index wrong in ConstVertexIHalfedgeCCWIter"; + EXPECT_EQ(ccw_indices[i], cvih_ccwit->idx()) << "Index wrong in ConstVertexIHalfedgeCCWIter"; } EXPECT_FALSE(cvih_ccwit.is_valid()) << "Iterator invalid in ConstVertexIHalfedgeCCWIter at end"; @@ -486,7 +486,7 @@ TEST_F(OpenMeshTrimeshCirculatorVertexIHalfEdge, CWAndCCWCheck) { i = 0; for (;vih_cwit != vih_cwend; ++vih_cwit, ++i) { - EXPECT_EQ(rev_indices[i], vih_cwit->idx()) << "Index wrong in VertexIHalfedgeCWIter"; + EXPECT_EQ(cw_indices[i], vih_cwit->idx()) << "Index wrong in VertexIHalfedgeCWIter"; } EXPECT_FALSE(vih_cwit.is_valid()) << "Iterator invalid in VertexIHalfedgeCWIter at end"; EXPECT_TRUE( vih_cwit == vih_cwend ) << "End iterator for VertexIHalfedgeCWIter not matching"; @@ -497,7 +497,7 @@ TEST_F(OpenMeshTrimeshCirculatorVertexIHalfEdge, CWAndCCWCheck) { i = 0; for (;cvih_cwit != cvih_cwend; ++cvih_cwit, ++i) { - EXPECT_EQ(rev_indices[i], cvih_cwit->idx()) << "Index wrong in ConstVertexIHalfedgeCWIter"; + EXPECT_EQ(cw_indices[i], cvih_cwit->idx()) << "Index wrong in ConstVertexIHalfedgeCWIter"; } EXPECT_FALSE(cvih_cwit.is_valid()) << "Iterator invalid in ConstVertexIHalfedgeCWIter at end"; EXPECT_TRUE( cvih_cwit == cvih_cwend ) << "End iterator for ConstVertexIHalfedgeCWIter not matching"; @@ -511,22 +511,21 @@ TEST_F(OpenMeshTrimeshCirculatorVertexIHalfEdge, CWAndCCWCheck) { */ Mesh::VertexIHalfedgeCWIter vih_cwIter = mesh_.vih_cwbegin(vh); // a) - EXPECT_TRUE( vih_cwIter == Mesh::VertexIHalfedgeCWIter(mesh_.vih_ccwbegin(vh)) ) << "ccw to cw conversion failed"; - EXPECT_TRUE( Mesh::VertexIHalfedgeCCWIter(vih_cwIter) == mesh_.vih_ccwbegin(vh) ) << "cw to ccw conversion failed"; + EXPECT_TRUE( *vih_cwIter == *++Mesh::VertexIHalfedgeCWIter(mesh_.vih_ccwend(vh))) << "ccw to cw conversion failed"; + EXPECT_TRUE( *++Mesh::VertexIHalfedgeCCWIter(vih_cwIter) == *mesh_.vih_ccwend(vh) ) << "cw to ccw conversion failed"; // b) EXPECT_EQ( vih_cwIter->idx(), Mesh::VertexIHalfedgeCCWIter(vih_cwIter)->idx()) << "iterators doesnt point on the same element"; // c) + auto vih_ccwIter = Mesh::VertexIHalfedgeCCWIter(vih_cwIter); + EXPECT_EQ(vih_cwIter->idx(),vih_ccwIter->idx())<< "iterators dont point on the same element"; ++vih_cwIter; - vih_ccwend = mesh_.vih_ccwend(vh); - --vih_ccwend; - EXPECT_EQ(vih_cwIter->idx(),vih_ccwend->idx()) << "iteratoes are not equal after inc/dec"; - // additional conversion check - vih_ccwend = Mesh::VertexIHalfedgeCCWIter(vih_cwIter); - EXPECT_EQ(vih_cwIter->idx(),vih_ccwend->idx())<< "iterators doesnt point on the same element"; + --vih_ccwIter; + EXPECT_EQ(vih_cwIter->idx(),vih_ccwIter->idx()) << "iteratoes are not equal after inc/dec"; // d) - vih_cwIter = Mesh::VertexIHalfedgeCWIter(mesh_.vih_ccwend(vh)); + auto vih_cwEnd = mesh_.vih_ccwend(vh); + vih_cwIter = Mesh::VertexIHalfedgeCWIter(vih_cwEnd); EXPECT_FALSE(vih_cwIter.is_valid()) << "end iterator is not invalid"; - EXPECT_TRUE(Mesh::VertexIHalfedgeCCWIter(mesh_.vih_cwend(vh)) == mesh_.vih_ccwend(vh)) << "end iterators are not equal"; + EXPECT_TRUE(*mesh_.vih_cwbegin(vh) == *++vih_cwIter) << "end iterators are not equal"; } diff --git a/src/Unittests/unittests_trimesh_circulator_vertex_ohalfedge.cc b/src/Unittests/unittests_trimesh_circulator_vertex_ohalfedge.cc index 49de4076..4ebfa5b9 100644 --- a/src/Unittests/unittests_trimesh_circulator_vertex_ohalfedge.cc +++ b/src/Unittests/unittests_trimesh_circulator_vertex_ohalfedge.cc @@ -450,9 +450,9 @@ TEST_F(OpenMeshTrimeshCirculatorVertexOHalfEdge, CWAndCCWCheck) { 3 ==== 4 */ - int indices[5] = {11, 2, 1, 6, 11}; - int rev_indices[5]; - std::reverse_copy(indices,indices+5,rev_indices); + int cw_indices[4] = {11, 6, 1, 2}; + int ccw_indices[4]; + std::reverse_copy(cw_indices,cw_indices+4,ccw_indices); Mesh::VertexHandle vh = vhandle[1]; @@ -462,7 +462,7 @@ TEST_F(OpenMeshTrimeshCirculatorVertexOHalfEdge, CWAndCCWCheck) { size_t i = 0; for (;voh_ccwit != voh_ccwend; ++voh_ccwit, ++i) { - EXPECT_EQ(indices[i], voh_ccwit->idx()) << "Index wrong in VertexOHalfedgeCCWIter"; + EXPECT_EQ(ccw_indices[i], voh_ccwit->idx()) << "Index wrong in VertexOHalfedgeCCWIter"; } EXPECT_FALSE(voh_ccwit.is_valid()) << "Iterator invalid in VertexOHalfedgeCCWIter at end"; @@ -474,7 +474,7 @@ TEST_F(OpenMeshTrimeshCirculatorVertexOHalfEdge, CWAndCCWCheck) { i = 0; for (;cvoh_ccwit != cvoh_ccwend; ++cvoh_ccwit, ++i) { - EXPECT_EQ(indices[i], cvoh_ccwit->idx()) << "Index wrong in ConstVertexOHalfedgeCCWIter"; + EXPECT_EQ(ccw_indices[i], cvoh_ccwit->idx()) << "Index wrong in ConstVertexOHalfedgeCCWIter"; } EXPECT_FALSE(cvoh_ccwit.is_valid()) << "Iterator invalid in ConstVertexOHalfedgeCCWIter at end"; @@ -486,7 +486,7 @@ TEST_F(OpenMeshTrimeshCirculatorVertexOHalfEdge, CWAndCCWCheck) { i = 0; for (;voh_cwit != voh_cwend; ++voh_cwit, ++i) { - EXPECT_EQ(rev_indices[i], voh_cwit->idx()) << "Index wrong in VertexOHalfedgeCWIter"; + EXPECT_EQ(cw_indices[i], voh_cwit->idx()) << "Index wrong in VertexOHalfedgeCWIter"; } EXPECT_FALSE(voh_cwit.is_valid()) << "Iterator invalid in VertexOHalfedgeCWIter at end"; EXPECT_TRUE( voh_cwit == voh_cwend ) << "End iterator for VertexOHalfedgeCWIter not matching"; @@ -497,7 +497,7 @@ TEST_F(OpenMeshTrimeshCirculatorVertexOHalfEdge, CWAndCCWCheck) { i = 0; for (;cvoh_cwit != cvoh_cwend; ++cvoh_cwit, ++i) { - EXPECT_EQ(rev_indices[i], cvoh_cwit->idx()) << "Index wrong in ConstVertexOHalfedgeCWIter"; + EXPECT_EQ(cw_indices[i], cvoh_cwit->idx()) << "Index wrong in ConstVertexOHalfedgeCWIter"; } EXPECT_FALSE(cvoh_cwit.is_valid()) << "Iterator invalid in ConstVertexOHalfedgeCWIter at end"; EXPECT_TRUE( cvoh_cwit == cvoh_cwend ) << "End iterator for ConstVertexOHalfedgeCWIter not matching"; @@ -511,22 +511,21 @@ TEST_F(OpenMeshTrimeshCirculatorVertexOHalfEdge, CWAndCCWCheck) { */ Mesh::VertexOHalfedgeCWIter voh_cwIter = mesh_.voh_cwbegin(vh); // a) - EXPECT_TRUE( voh_cwIter == Mesh::VertexOHalfedgeCWIter(mesh_.voh_ccwbegin(vh)) ) << "ccw to cw conversion failed"; - EXPECT_TRUE( Mesh::VertexOHalfedgeCCWIter(voh_cwIter) == mesh_.voh_ccwbegin(vh) ) << "cw to ccw conversion failed"; + EXPECT_TRUE( *voh_cwIter == *++Mesh::VertexOHalfedgeCWIter(mesh_.voh_ccwend(vh))) << "ccw to cw conversion failed"; + EXPECT_TRUE( *++Mesh::VertexOHalfedgeCCWIter(voh_cwIter) == *mesh_.voh_ccwend(vh) ) << "cw to ccw conversion failed"; // b) EXPECT_EQ( voh_cwIter->idx(), Mesh::VertexOHalfedgeCCWIter(voh_cwIter)->idx()) << "iterators doesnt point on the same element"; // c) + auto voh_ccwIter = Mesh::VertexOHalfedgeCCWIter(voh_cwIter); + EXPECT_EQ(voh_cwIter->idx(),voh_ccwIter->idx())<< "iterators dont point on the same element"; ++voh_cwIter; - voh_ccwend = mesh_.voh_ccwend(vh); - --voh_ccwend; - EXPECT_EQ(voh_cwIter->idx(),voh_ccwend->idx()) << "iteratoes are not equal after inc/dec"; - // additional conversion check - voh_ccwend = Mesh::VertexOHalfedgeCCWIter(voh_cwIter); - EXPECT_EQ(voh_cwIter->idx(),voh_ccwend->idx())<< "iterators doesnt point on the same element"; + --voh_ccwIter; + EXPECT_EQ(voh_cwIter->idx(),voh_ccwIter->idx()) << "iteratoes are not equal after inc/dec"; // d) - voh_cwIter = Mesh::VertexOHalfedgeCWIter(mesh_.voh_ccwend(vh)); + auto voh_cwEnd = mesh_.voh_ccwend(vh); + voh_cwIter = Mesh::VertexOHalfedgeCWIter(voh_cwEnd); EXPECT_FALSE(voh_cwIter.is_valid()) << "end iterator is not invalid"; - EXPECT_TRUE(Mesh::VertexOHalfedgeCCWIter(mesh_.voh_cwend(vh)) == mesh_.voh_ccwend(vh)) << "end iterators are not equal"; + EXPECT_TRUE(*mesh_.voh_cwbegin(vh) == *++voh_cwIter) << "end iterators are not equal"; } diff --git a/src/Unittests/unittests_trimesh_circulator_vertex_vertex.cc b/src/Unittests/unittests_trimesh_circulator_vertex_vertex.cc index 18e839ff..c1edd31f 100644 --- a/src/Unittests/unittests_trimesh_circulator_vertex_vertex.cc +++ b/src/Unittests/unittests_trimesh_circulator_vertex_vertex.cc @@ -339,9 +339,9 @@ TEST_F(OpenMeshTrimeshCirculatorVertexVertex, CWAndCCWCheck) { 3 ==== 4 */ - int indices[5] = {4, 2, 0, 3, 4}; - int rev_indices[5]; - std::reverse_copy(indices,indices+5,rev_indices); + int cw_indices[4] = {4, 3, 0, 2}; + int ccw_indices[4]; + std::reverse_copy(cw_indices,cw_indices+4,ccw_indices); Mesh::VertexHandle vh = vhandle[1]; @@ -351,7 +351,7 @@ TEST_F(OpenMeshTrimeshCirculatorVertexVertex, CWAndCCWCheck) { size_t i = 0; for (;vv_ccwit != vv_ccwend; ++vv_ccwit, ++i) { - EXPECT_EQ(indices[i], vv_ccwit->idx()) << "Index wrong in VertexVertexCCWIter"; + EXPECT_EQ(ccw_indices[i], vv_ccwit->idx()) << "Index wrong in VertexVertexCCWIter"; } EXPECT_FALSE(vv_ccwit.is_valid()) << "Iterator invalid in VertexVertexCCWIter at end"; @@ -363,7 +363,7 @@ TEST_F(OpenMeshTrimeshCirculatorVertexVertex, CWAndCCWCheck) { i = 0; for (;cvv_ccwit != cvv_ccwend; ++cvv_ccwit, ++i) { - EXPECT_EQ(indices[i], cvv_ccwit->idx()) << "Index wrong in ConstVertexVertexCCWIter"; + EXPECT_EQ(ccw_indices[i], cvv_ccwit->idx()) << "Index wrong in ConstVertexVertexCCWIter"; } EXPECT_FALSE(cvv_ccwit.is_valid()) << "Iterator invalid in ConstVertexVertexCCWIter at end"; @@ -375,7 +375,7 @@ TEST_F(OpenMeshTrimeshCirculatorVertexVertex, CWAndCCWCheck) { i = 0; for (;vv_cwit != vv_cwend; ++vv_cwit, ++i) { - EXPECT_EQ(rev_indices[i], vv_cwit->idx()) << "Index wrong in VertexVertexCWIter"; + EXPECT_EQ(cw_indices[i], vv_cwit->idx()) << "Index wrong in VertexVertexCWIter"; } EXPECT_FALSE(vv_cwit.is_valid()) << "Iterator invalid in VertexVertexCWIter at end"; EXPECT_TRUE( vv_cwit == vv_cwend ) << "End iterator for VertexVertexCWIter not matching"; @@ -386,7 +386,7 @@ TEST_F(OpenMeshTrimeshCirculatorVertexVertex, CWAndCCWCheck) { i = 0; for (;cvv_cwit != cvv_cwend; ++cvv_cwit, ++i) { - EXPECT_EQ(rev_indices[i], cvv_cwit->idx()) << "Index wrong in ConstVertexVertexCWIter"; + EXPECT_EQ(cw_indices[i], cvv_cwit->idx()) << "Index wrong in ConstVertexVertexCWIter"; } EXPECT_FALSE(cvv_cwit.is_valid()) << "Iterator invalid in ConstVertexVertexCWIter at end"; EXPECT_TRUE( cvv_cwit == cvv_cwend ) << "End iterator for ConstVertexVertexCWIter not matching"; @@ -400,22 +400,21 @@ TEST_F(OpenMeshTrimeshCirculatorVertexVertex, CWAndCCWCheck) { */ Mesh::VertexVertexCWIter vv_cwIter = mesh_.vv_cwbegin(vh); // a) - EXPECT_TRUE( vv_cwIter == Mesh::VertexVertexCWIter(mesh_.vv_ccwbegin(vh)) ) << "ccw to cw convvrsion failed"; - EXPECT_TRUE( Mesh::VertexVertexCCWIter(vv_cwIter) == mesh_.vv_ccwbegin(vh) ) << "cw to ccw convvrsion failed"; + EXPECT_TRUE( *vv_cwIter == *++Mesh::VertexVertexCWIter(mesh_.vv_ccwend(vh))) << "ccw to cw conversion failed"; + EXPECT_TRUE( *++Mesh::VertexVertexCCWIter(vv_cwIter) == *mesh_.vv_ccwend(vh) ) << "cw to ccw conversion failed"; // b) EXPECT_EQ( vv_cwIter->idx(), Mesh::VertexVertexCCWIter(vv_cwIter)->idx()) << "iterators doesnt point on the same element"; // c) + auto vv_ccwIter = Mesh::VertexVertexCCWIter(vv_cwIter); + EXPECT_EQ(vv_cwIter->idx(),vv_ccwIter->idx())<< "iterators dont point on the same element"; ++vv_cwIter; - vv_ccwend = mesh_.vv_ccwend(vh); - --vv_ccwend; - EXPECT_EQ(vv_cwIter->idx(),vv_ccwend->idx()) << "iteratoes are not equal after inc/dec"; - // additional conversion check - vv_ccwend = Mesh::VertexVertexCCWIter(vv_cwIter); - EXPECT_EQ(vv_cwIter->idx(),vv_ccwend->idx())<< "iterators doesnt point on the same element"; + --vv_ccwIter; + EXPECT_EQ(vv_cwIter->idx(),vv_ccwIter->idx()) << "iteratoes are not equal after inc/dec"; // d) - vv_cwIter = Mesh::VertexVertexCWIter(mesh_.vv_ccwend(vh)); + auto vv_cwEnd = mesh_.vv_ccwend(vh); + vv_cwIter = Mesh::VertexVertexCWIter(vv_cwEnd); EXPECT_FALSE(vv_cwIter.is_valid()) << "end iterator is not invalid"; - EXPECT_TRUE(Mesh::VertexVertexCCWIter(mesh_.vv_cwend(vh)) == mesh_.vv_ccwend(vh)) << "end iterators are not equal"; + EXPECT_TRUE(*mesh_.vv_cwbegin(vh) == *++vv_cwIter) << "end iterators are not equal"; } diff --git a/src/Unittests/unittests_trimesh_ranges.cc b/src/Unittests/unittests_trimesh_ranges.cc index d6c1582a..c57bcf75 100644 --- a/src/Unittests/unittests_trimesh_ranges.cc +++ b/src/Unittests/unittests_trimesh_ranges.cc @@ -106,7 +106,7 @@ void compare_ranges(RangeT1&& range1, RangeT2&& range2, int offset, bool reverse for (size_t i = 0; i < n; ++i) { size_t id1 = (i+offset)%n; - size_t id2 = reverse ? (n-i)%n : i; + size_t id2 = reverse ? (n-i-1)%n : i; EXPECT_EQ(vec1[id1].idx(), vec2[id2].idx()) << "Elements are not the same with offset = " << offset << " and reverse = " << std::to_string(reverse); } } @@ -222,9 +222,8 @@ TEST_F(OpenMeshTrimeshRange, VertexIncomingHalfedgesRangeBoundaryConsistency) EXPECT_TRUE(mesh_.vih_cwbegin(vh)->opp().is_boundary()); EXPECT_TRUE(mesh_.vih_cw_range(vh).begin()->opp().is_boundary()); - // TODO: this should be false, instead opp should be boundary - EXPECT_TRUE(mesh_.vih_ccwbegin(vh)->opp().is_boundary()); - EXPECT_TRUE(mesh_.vih_ccw_range(vh).begin()->opp().is_boundary()); + EXPECT_TRUE(mesh_.vih_ccwbegin(vh)->is_boundary()); + EXPECT_TRUE(mesh_.vih_ccw_range(vh).begin()->is_boundary()); } } @@ -290,9 +289,8 @@ TEST_F(OpenMeshTrimeshRange, VertexOutgoingHalfedgesRangeBoundaryConsistency) EXPECT_TRUE(mesh_.voh_cwbegin(vh)->is_boundary()); EXPECT_TRUE(mesh_.voh_cw_range(vh).begin()->is_boundary()); - // TODO: this should be false, instead opp should be boundary - EXPECT_TRUE(mesh_.voh_ccwbegin(vh)->is_boundary()); - EXPECT_TRUE(mesh_.voh_ccw_range(vh).begin()->is_boundary()); + EXPECT_TRUE(mesh_.voh_ccwbegin(vh)->opp().is_boundary()); + EXPECT_TRUE(mesh_.voh_ccw_range(vh).begin()->opp().is_boundary()); } } @@ -309,8 +307,12 @@ TEST_F(OpenMeshTrimeshRange, HalfedgeLoopRangeMeshVsSmartHandle) TEST_F(OpenMeshTrimeshRange, HalfedgeLoopRangeCWVsCCW) { + // Halfedge Loops are initialized from a halfedge and always start on that halfedge + // Thus, cw and ccw ranges start on the same element. We account for that by + // setting the offset to 1 for the comparison check. + // TODO: do we want to change that behavior? for (auto heh : mesh_.halfedges()) - compare_ranges(heh.loop_cw(), heh.loop_ccw(), 0, true); + compare_ranges(heh.loop_cw(), heh.loop_ccw(), 1, true); }