Commit 49cc1f0d authored by Isaak Lim's avatar Isaak Lim

got rid of calls to current_halfedge_handle() in corresponding unittest

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@918 fdac6126-5c0c-442c-9429-916003d36597
parent 2eeb756b
......@@ -87,11 +87,16 @@ TEST_F(OpenMeshTrimeshCirculatorCurrentHalfedgeHandleReplacement, dereference) {
3 ==== 4 */
// Starting vertex is 1->4
// output from fh_it.current_halfedge_handle()
size_t current_halfedge_handles[12] = {
4,0,2,10,6,8,1,12,7,14,3,11
};
size_t i(0);
for (Mesh::FaceIter f_it = mesh_.faces_begin(); f_it != mesh_.faces_end(); ++f_it) {
for (Mesh::FaceHalfedgeIter fh_it = mesh_.fh_iter(*f_it); fh_it.is_valid(); ++fh_it) {
EXPECT_EQ(fh_it.current_halfedge_handle(), *fh_it ) << "halfedge handles don't match";
for (Mesh::FaceHalfedgeIter fh_it = mesh_.fh_iter(*f_it); fh_it.is_valid(); ++fh_it, ++i) {
EXPECT_EQ(current_halfedge_handles[i], fh_it->idx() ) << "halfedge handles don't match";
}
}
}
......@@ -151,12 +156,32 @@ TEST_F(OpenMeshTrimeshCirculatorCurrentHalfedgeHandleReplacement, vv_iter) {
3 ==== 4 */
// Starting vertex is 1->4
// output from vv_it.current_halfedge_handle()
size_t current_halfedge_handles[16] = {
5,
0,
12,
11,
6,
1,
2,
15,
3,
4,
13,
7,
8,
9,
10,
14
};
std::vector<Mesh::EdgeHandle> eh0;
std::vector<Mesh::EdgeHandle> eh1;
size_t i(0);
for (Mesh::VertexIter v_it = mesh_.vertices_begin(); v_it != mesh_.vertices_end(); ++v_it) {
for (Mesh::VertexVertexIter vv_it = mesh_.vv_iter(*v_it); vv_it.is_valid(); ++vv_it)
eh0.push_back(mesh_.edge_handle(vv_it.current_halfedge_handle()));
for (Mesh::VertexVertexIter vv_it = mesh_.vv_iter(*v_it); vv_it.is_valid(); ++vv_it, ++i)
eh0.push_back(mesh_.edge_handle(Mesh::HalfedgeHandle(current_halfedge_handles[i])));
}
for (Mesh::VertexIter v_it = mesh_.vertices_begin(); v_it != mesh_.vertices_end(); ++v_it) {
for (Mesh::VertexOHalfedgeIter voh_it = mesh_.voh_iter(*v_it); voh_it.is_valid(); ++voh_it)
......@@ -224,13 +249,19 @@ TEST_F(OpenMeshTrimeshCirculatorCurrentHalfedgeHandleReplacement, fe_iter) {
3 ==== 4 */
// Starting vertex is 1->4
// output from fe_it.current_halfedge_handle()
size_t current_halfedge_handles[12] = {
4,0,2,10,6,8,1,12,7,14,3,11
};
size_t i(0);
std::vector<Mesh::HalfedgeHandle> heh0;
std::vector<Mesh::HalfedgeHandle> heh1;
for (Mesh::FaceIter f_it = mesh_.faces_begin(); f_it != mesh_.faces_end(); ++f_it) {
for (Mesh::FaceEdgeIter fe_it = mesh_.fe_iter(*f_it); fe_it.is_valid(); ++fe_it) {
heh0.push_back(fe_it.current_halfedge_handle());
for (Mesh::FaceEdgeIter fe_it = mesh_.fe_iter(*f_it); fe_it.is_valid(); ++fe_it, ++i) {
heh0.push_back(Mesh::HalfedgeHandle(current_halfedge_handles[i]));
}
}
for (Mesh::FaceIter f_it = mesh_.faces_begin(); f_it != mesh_.faces_end(); ++f_it) {
......@@ -244,73 +275,5 @@ TEST_F(OpenMeshTrimeshCirculatorCurrentHalfedgeHandleReplacement, fe_iter) {
EXPECT_EQ(heh0[i], heh1[i]) << "halfedge handles do not match";
}
/*
* duplicate find_halfedge behaviour
*/
TEST_F(OpenMeshTrimeshCirculatorCurrentHalfedgeHandleReplacement, find_halfedge) {
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<Mesh::VertexHandle> 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 */
// Starting vertex is 1->4
Mesh::HalfedgeHandle hh = mesh_.find_halfedge(vhandle[0], vhandle[1]);
Mesh::HalfedgeHandle hh1;
for (Mesh::VertexOHalfedgeIter voh_it = mesh_.voh_iter(vhandle[0]); voh_it.is_valid(); ++voh_it) {
if (mesh_.to_vertex_handle(*voh_it) == vhandle[1]) {
hh1 = *voh_it;
break;
}
}
EXPECT_EQ(hh, hh1 ) << "halfedge handles don't match";
}
#endif // UNITTESTS_TRIMESH_CIRCULATOR_CURRENT_HANDLE_REPLACEMENT_HH
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment