From afba4312448d72a9c99687a595bf08583c1b3a08 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 5 Mar 2015 13:35:06 +0100 Subject: [PATCH] make stitching BGL, and complete test with Surface_mesh --- .../include/CGAL/stitch_polygon_mesh.h | 7 +-- .../test_polyhedron_stitching.cpp | 43 +++++++++++-------- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/stitch_polygon_mesh.h b/Polygon_mesh_processing/include/CGAL/stitch_polygon_mesh.h index 864c6b2566d..9b7fa2c6a75 100644 --- a/Polygon_mesh_processing/include/CGAL/stitch_polygon_mesh.h +++ b/Polygon_mesh_processing/include/CGAL/stitch_polygon_mesh.h @@ -74,7 +74,8 @@ detect_duplicated_boundary_edges { typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - pmesh.normalize_border(); +// pmesh.normalize_border();//only available in Polyhedron_3, and called to + // speed-up the operation typedef std::set Border_halfedge_set; Border_halfedge_set border_halfedge_set(less_hedge); @@ -162,7 +163,7 @@ struct Naive_border_stitching_modifier { //we remove h2->opposite()->vertex() vertices_to_delete.push_back( h2_src ); - update_target_vertex(h2->opposite(), v_to_keep, pmesh); + update_target_vertex(opposite(h2, pmesh), v_to_keep, pmesh); } set_halfedge(v_to_keep, h1, pmesh); @@ -184,7 +185,7 @@ struct Naive_border_stitching_modifier { //we remove h1->opposite()->vertex() vertices_to_delete.push_back( h1_src ); - update_target_vertex(h1->opposite(), v_to_keep, pmesh); + update_target_vertex(opposite(h1, pmesh), v_to_keep, pmesh); } set_halfedge(v_to_keep, opposite(h1,pmesh), pmesh); } diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_polyhedron_stitching.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_polyhedron_stitching.cpp index 2964366763c..df8e608d2ac 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_polyhedron_stitching.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_polyhedron_stitching.cpp @@ -31,24 +31,24 @@ void test_polyhedron(const char* fname) std::cout << "OK\n"; } -//void test_surface_mesh(const char* fname) -//{ -// typedef K::Point_3 Point; -// typedef CGAL::Surface_mesh Mesh; -// -// std::cout << "Testing Surface_mesh " << fname << "..." << std::flush; -// std::ifstream input(fname); -// Mesh m; -// if (!input || !(input >> m)){ -// std::cerr << "Error: can not read file."; -// return; -// } -// -// CGAL::Polygon_mesh_processing::stitch_borders(m); -// //todo : add a validity test -// -// std::cout << "OK\n"; -//} +void test_surface_mesh(const char* fname) +{ + typedef K::Point_3 Point; + typedef CGAL::Surface_mesh Mesh; + + std::cout << "Testing Surface_mesh " << fname << "..." << std::flush; + std::ifstream input(fname); + Mesh m; + if (!input || !(input >> m)){ + std::cerr << "Error: can not read file."; + return; + } + + CGAL::Polygon_mesh_processing::stitch_borders(m); + //todo : add a validity test + + std::cout << "OK\n"; +} int main() { @@ -58,5 +58,12 @@ int main() test_polyhedron("data_stitching/mid_border.off"); test_polyhedron("data_stitching/multiple_incidence.off"); test_polyhedron("data_stitching/incidence_3.off"); + + test_surface_mesh("data_stitching/full_border.off"); + test_surface_mesh("data_stitching/full_border_quads.off"); + test_surface_mesh("data_stitching/half_border.off"); + test_surface_mesh("data_stitching/mid_border.off"); + test_surface_mesh("data_stitching/multiple_incidence.off"); + test_surface_mesh("data_stitching/incidence_3.off"); }