let iterators return smart handles
This commit is contained in:
@@ -162,34 +162,30 @@ TEST_F(OpenMeshSmartHandles, SimpleNavigation)
|
||||
{
|
||||
for (auto vh : mesh_.vertices())
|
||||
{
|
||||
auto svh = OpenMesh::make_smart(vh, mesh_);
|
||||
EXPECT_EQ(mesh_.halfedge_handle(vh), svh.halfedge()) << "outgoing halfedge of vertex does not match";
|
||||
EXPECT_EQ(mesh_.halfedge_handle(vh), vh.halfedge()) << "outgoing halfedge of vertex does not match";
|
||||
}
|
||||
|
||||
for (auto heh : mesh_.halfedges())
|
||||
{
|
||||
auto sheh = OpenMesh::make_smart(heh, mesh_);
|
||||
EXPECT_EQ(mesh_.next_halfedge_handle(heh), sheh.next()) << "next halfedge of halfedge does not match";
|
||||
EXPECT_EQ(mesh_.prev_halfedge_handle(heh), sheh.prev()) << "prevt halfedge of halfedge does not match";
|
||||
EXPECT_EQ(mesh_.opposite_halfedge_handle(heh), sheh.opp()) << "opposite halfedge of halfedge does not match";
|
||||
EXPECT_EQ(mesh_.to_vertex_handle(heh), sheh.to()) << "to vertex handle of halfedge does not match";
|
||||
EXPECT_EQ(mesh_.from_vertex_handle(heh), sheh.from()) << "from vertex handle of halfedge does not match";
|
||||
EXPECT_EQ(mesh_.face_handle(heh), sheh.face()) << "face handle of halfedge does not match";
|
||||
EXPECT_EQ(mesh_.next_halfedge_handle(heh), heh.next()) << "next halfedge of halfedge does not match";
|
||||
EXPECT_EQ(mesh_.prev_halfedge_handle(heh), heh.prev()) << "prevt halfedge of halfedge does not match";
|
||||
EXPECT_EQ(mesh_.opposite_halfedge_handle(heh), heh.opp()) << "opposite halfedge of halfedge does not match";
|
||||
EXPECT_EQ(mesh_.to_vertex_handle(heh), heh.to()) << "to vertex handle of halfedge does not match";
|
||||
EXPECT_EQ(mesh_.from_vertex_handle(heh), heh.from()) << "from vertex handle of halfedge does not match";
|
||||
EXPECT_EQ(mesh_.face_handle(heh), heh.face()) << "face handle of halfedge does not match";
|
||||
}
|
||||
|
||||
for (auto eh : mesh_.edges())
|
||||
{
|
||||
auto seh = OpenMesh::make_smart(eh, mesh_);
|
||||
EXPECT_EQ(mesh_.halfedge_handle(eh, 0), seh.h0()) << "halfedge 0 of edge does not match";
|
||||
EXPECT_EQ(mesh_.halfedge_handle(eh, 1), seh.h1()) << "halfedge 1 of edge does not match";
|
||||
EXPECT_EQ(mesh_.from_vertex_handle(mesh_.halfedge_handle(eh, 0)), seh.v0()) << "first vertex of edge does not match";
|
||||
EXPECT_EQ(mesh_.to_vertex_handle (mesh_.halfedge_handle(eh, 0)), seh.v1()) << "second vertex of edge does not match";
|
||||
EXPECT_EQ(mesh_.halfedge_handle(eh, 0), eh.h0()) << "halfedge 0 of edge does not match";
|
||||
EXPECT_EQ(mesh_.halfedge_handle(eh, 1), eh.h1()) << "halfedge 1 of edge does not match";
|
||||
EXPECT_EQ(mesh_.from_vertex_handle(mesh_.halfedge_handle(eh, 0)), eh.v0()) << "first vertex of edge does not match";
|
||||
EXPECT_EQ(mesh_.to_vertex_handle (mesh_.halfedge_handle(eh, 0)), eh.v1()) << "second vertex of edge does not match";
|
||||
}
|
||||
|
||||
for (auto fh : mesh_.faces())
|
||||
{
|
||||
auto sfh = OpenMesh::make_smart(fh, mesh_);
|
||||
EXPECT_EQ(mesh_.halfedge_handle(fh), sfh.halfedge()) << "halfedge of face does not match";
|
||||
EXPECT_EQ(mesh_.halfedge_handle(fh), fh.halfedge()) << "halfedge of face does not match";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,13 +196,12 @@ TEST_F(OpenMeshSmartHandles, SimpleRanges)
|
||||
{
|
||||
for (auto vh : mesh_.vertices())
|
||||
{
|
||||
auto svh = OpenMesh::make_smart(vh, mesh_);
|
||||
{
|
||||
std::vector<OpenMesh::VertexHandle> handles0;
|
||||
std::vector<OpenMesh::VertexHandle> handles1;
|
||||
for (auto h : mesh_.vv_range(vh))
|
||||
handles0.push_back(h);
|
||||
for (auto h : svh.vertices())
|
||||
for (auto h : vh.vertices())
|
||||
handles1.push_back(h);
|
||||
EXPECT_EQ(handles0, handles1) << "vertex range of vertex does not match";
|
||||
}
|
||||
@@ -215,7 +210,7 @@ TEST_F(OpenMeshSmartHandles, SimpleRanges)
|
||||
std::vector<OpenMesh::HalfedgeHandle> handles1;
|
||||
for (auto h : mesh_.voh_range(vh))
|
||||
handles0.push_back(h);
|
||||
for (auto h : svh.outgoing_halfedges())
|
||||
for (auto h : vh.outgoing_halfedges())
|
||||
handles1.push_back(h);
|
||||
EXPECT_EQ(handles0, handles1) << "outgoing halfedge range of vertex does not match";
|
||||
}
|
||||
@@ -224,7 +219,7 @@ TEST_F(OpenMeshSmartHandles, SimpleRanges)
|
||||
std::vector<OpenMesh::HalfedgeHandle> handles1;
|
||||
for (auto h : mesh_.vih_range(vh))
|
||||
handles0.push_back(h);
|
||||
for (auto h : svh.incoming_halfedges())
|
||||
for (auto h : vh.incoming_halfedges())
|
||||
handles1.push_back(h);
|
||||
EXPECT_EQ(handles0, handles1) << "incoming halfedge range of vertex does not match";
|
||||
}
|
||||
@@ -233,7 +228,7 @@ TEST_F(OpenMeshSmartHandles, SimpleRanges)
|
||||
std::vector<OpenMesh::EdgeHandle> handles1;
|
||||
for (auto h : mesh_.ve_range(vh))
|
||||
handles0.push_back(h);
|
||||
for (auto h : svh.edges())
|
||||
for (auto h : vh.edges())
|
||||
handles1.push_back(h);
|
||||
EXPECT_EQ(handles0, handles1) << "edge range of vertex does not match";
|
||||
}
|
||||
@@ -242,7 +237,7 @@ TEST_F(OpenMeshSmartHandles, SimpleRanges)
|
||||
std::vector<OpenMesh::FaceHandle> handles1;
|
||||
for (auto h : mesh_.vf_range(vh))
|
||||
handles0.push_back(h);
|
||||
for (auto h : svh.faces())
|
||||
for (auto h : vh.faces())
|
||||
handles1.push_back(h);
|
||||
EXPECT_EQ(handles0, handles1) << "face range of vertex does not match";
|
||||
}
|
||||
@@ -250,13 +245,12 @@ TEST_F(OpenMeshSmartHandles, SimpleRanges)
|
||||
|
||||
for (auto fh : mesh_.faces())
|
||||
{
|
||||
auto sfh = OpenMesh::make_smart(fh, mesh_);
|
||||
{
|
||||
std::vector<OpenMesh::VertexHandle> handles0;
|
||||
std::vector<OpenMesh::VertexHandle> handles1;
|
||||
for (auto h : mesh_.fv_range(fh))
|
||||
handles0.push_back(h);
|
||||
for (auto h : sfh.vertices())
|
||||
for (auto h : fh.vertices())
|
||||
handles1.push_back(h);
|
||||
EXPECT_EQ(handles0, handles1) << "vertex range of face does not match";
|
||||
}
|
||||
@@ -265,7 +259,7 @@ TEST_F(OpenMeshSmartHandles, SimpleRanges)
|
||||
std::vector<OpenMesh::HalfedgeHandle> handles1;
|
||||
for (auto h : mesh_.fh_range(fh))
|
||||
handles0.push_back(h);
|
||||
for (auto h : sfh.halfedges())
|
||||
for (auto h : fh.halfedges())
|
||||
handles1.push_back(h);
|
||||
EXPECT_EQ(handles0, handles1) << "halfedge range of face does not match";
|
||||
}
|
||||
@@ -274,7 +268,7 @@ TEST_F(OpenMeshSmartHandles, SimpleRanges)
|
||||
std::vector<OpenMesh::EdgeHandle> handles1;
|
||||
for (auto h : mesh_.fe_range(fh))
|
||||
handles0.push_back(h);
|
||||
for (auto h : sfh.edges())
|
||||
for (auto h : fh.edges())
|
||||
handles1.push_back(h);
|
||||
EXPECT_EQ(handles0, handles1) << "edge range of face does not match";
|
||||
}
|
||||
@@ -283,7 +277,7 @@ TEST_F(OpenMeshSmartHandles, SimpleRanges)
|
||||
std::vector<OpenMesh::FaceHandle> handles1;
|
||||
for (auto h : mesh_.ff_range(fh))
|
||||
handles0.push_back(h);
|
||||
for (auto h : sfh.faces())
|
||||
for (auto h : fh.faces())
|
||||
handles1.push_back(h);
|
||||
EXPECT_EQ(handles0, handles1) << "face range of face does not match";
|
||||
}
|
||||
@@ -297,18 +291,17 @@ TEST_F(OpenMeshSmartHandles, ComplicatedNavigtaion)
|
||||
{
|
||||
for (auto vh : mesh_.vertices())
|
||||
{
|
||||
auto svh = OpenMesh::make_smart(vh, mesh_);
|
||||
EXPECT_EQ(mesh_.next_halfedge_handle(
|
||||
mesh_.opposite_halfedge_handle(
|
||||
mesh_.halfedge_handle(vh))),
|
||||
svh.out().opp().next());
|
||||
vh.out().opp().next());
|
||||
EXPECT_EQ(mesh_.prev_halfedge_handle(
|
||||
mesh_.prev_halfedge_handle(
|
||||
mesh_.opposite_halfedge_handle(
|
||||
mesh_.next_halfedge_handle(
|
||||
mesh_.next_halfedge_handle(
|
||||
mesh_.halfedge_handle(vh)))))),
|
||||
svh.out().next().next().opp().prev().prev());
|
||||
vh.out().next().next().opp().prev().prev());
|
||||
EXPECT_EQ(mesh_.face_handle(
|
||||
mesh_.opposite_halfedge_handle(
|
||||
mesh_.halfedge_handle(
|
||||
@@ -316,7 +309,7 @@ TEST_F(OpenMeshSmartHandles, ComplicatedNavigtaion)
|
||||
mesh_.opposite_halfedge_handle(
|
||||
mesh_.next_halfedge_handle(
|
||||
mesh_.halfedge_handle(vh))))))),
|
||||
svh.out().next().opp().face().halfedge().opp().face());
|
||||
vh.out().next().opp().face().halfedge().opp().face());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,8 +345,7 @@ TEST_F(OpenMeshSmartHandles, Performance)
|
||||
{
|
||||
for (auto vh : mesh_.vertices())
|
||||
{
|
||||
auto svh = OpenMesh::make_smart(vh, mesh_);
|
||||
auto heh = svh.out().next().next().opp().prev().prev();
|
||||
auto heh = vh.out().next().next().opp().prev().prev();
|
||||
if (i == 0)
|
||||
halfedges1.push_back(heh);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user