make stitching BGL, and complete test with Surface_mesh

This commit is contained in:
Jane Tournois 2015-03-05 13:35:06 +01:00
parent e173ca8a1f
commit afba431244
2 changed files with 29 additions and 21 deletions

View File

@ -74,7 +74,8 @@ detect_duplicated_boundary_edges
{
typedef typename boost::graph_traits<PM>::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<halfedge_descriptor, LessHedge> 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);
}

View File

@ -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<Point> 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<Point> 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");
}