From 27f10ee7c9b00235a033edca338498e87900ae05 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 8 Apr 2019 12:15:05 +0200 Subject: [PATCH] Commited by error. Partially revert "This branch now targets 4.13.2." This reverts commit b392643a98e5f2ae8615c6fe70b23ed277a6e48e, partially. --- .../Mesh_3/remesh_polyhedral_surface.cpp | 110 +++--------------- 1 file changed, 16 insertions(+), 94 deletions(-) diff --git a/Mesh_3/examples/Mesh_3/remesh_polyhedral_surface.cpp b/Mesh_3/examples/Mesh_3/remesh_polyhedral_surface.cpp index 2ee50fe8f9b..7d87aedbb94 100644 --- a/Mesh_3/examples/Mesh_3/remesh_polyhedral_surface.cpp +++ b/Mesh_3/examples/Mesh_3/remesh_polyhedral_surface.cpp @@ -1,70 +1,23 @@ #include -#include #include #include #include #include #include -#include -#include -#include -#include -#include -#include -#include - -// BGL bug-fix -namespace CGAL{ -namespace Polygon_mesh_processing{ -template -bool is_degenerate_triangle_face(typename boost::graph_traits::face_descriptor f, - const TriangleMesh& tm, - const NamedParameters& np) -{ - CGAL_precondition(CGAL::is_triangle(halfedge(f, tm), tm)); - - using boost::get_param; - using boost::choose_param; - - typedef typename GetVertexPointMap::const_type VertexPointMap; - VertexPointMap vpmap = choose_param(get_param(np, internal_np::vertex_point), - get_const_property_map(vertex_point, tm)); - - typedef typename GetGeomTraits::type Traits; - Traits traits = choose_param(get_param(np, internal_np::geom_traits), Traits()); - - typename boost::graph_traits::halfedge_descriptor h = halfedge(f, tm); - - return traits.collinear_3_object()(get(vpmap, source(h, tm)), - get(vpmap, target(h, tm)), - get(vpmap, target(next(h, tm), tm))); -} - -template -bool is_degenerate_triangle_face(typename boost::graph_traits::face_descriptor f, - const TriangleMesh& tm) -{ - return CGAL::Polygon_mesh_processing::is_degenerate_triangle_face(f, tm, parameters::all_default()); -} -} - -} - -#include - -typedef CGAL::Exact_predicates_inexact_constructions_kernel K; -// Polyhedron type -typedef CGAL::Surface_mesh Polyhedron; // Domain -typedef CGAL::Polyhedral_mesh_domain_3 Mesh_domain; +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Polyhedral_mesh_domain_with_features_3 Mesh_domain; +// Polyhedron type +typedef CGAL::Mesh_polyhedron_3::type Polyhedron; // Triangulation -typedef CGAL::Mesh_triangulation_3::type Tr; -typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; +typedef CGAL::Mesh_triangulation_3::type Tr; +typedef CGAL::Mesh_complex_3_in_triangulation_3< + Tr,Mesh_domain::Corner_index,Mesh_domain::Curve_index> C3t3; // Criteria typedef CGAL::Mesh_criteria_3 Mesh_criteria; @@ -72,42 +25,18 @@ typedef CGAL::Mesh_criteria_3 Mesh_criteria; // To avoid verbose function and named parameters call using namespace CGAL::parameters; -int main(int, char** argv) +int main() { - // Load OBJ - std::vector points; - std::vector > faces; - - std::ifstream in(argv[1]); - if(!in || !CGAL::read_OBJ(in,points,faces)) - { - return 1; - } - + // Load a polyhedron Polyhedron poly; - namespace PMP = CGAL::Polygon_mesh_processing; - PMP::orient_polygon_soup(points,faces); - PMP::polygon_soup_to_polygon_mesh(points, faces, poly); - if (!CGAL::is_triangle_mesh(poly)) - { - std::cerr << "Input geometry is not triangulated." << std::endl; - return EXIT_FAILURE; - } + std::ifstream input("data/lion-head.off"); + input >> poly; if (!CGAL::is_triangle_mesh(poly)){ std::cerr << "Input geometry is not triangulated." << std::endl; return EXIT_FAILURE; } - // remove degenerate faces - std::vector faces_to_remove; - for (Polyhedron::Face_index f : poly.faces()) - if( PMP::is_degenerate_triangle_face(f, poly)) - faces_to_remove.push_back(f); - for (Polyhedron::Face_index f : faces_to_remove) - CGAL::Euler::remove_face(halfedge(f,poly), poly); - faces_to_remove.clear(); - // Create a vector with only one element: the pointer to the polyhedron. std::vector poly_ptrs_vector(1, &poly); @@ -117,28 +46,21 @@ int main(int, char** argv) Mesh_domain domain(poly_ptrs_vector.begin(), poly_ptrs_vector.end()); // Get sharp features - // domain.detect_features(); //includes detection of borders + domain.detect_features(); //includes detection of borders // Mesh criteria - Mesh_criteria criteria(edge_size = 1, + Mesh_criteria criteria(edge_size = 0.025, facet_angle = 25, - facet_size = 0.2, - facet_distance = 0.02); - CGAL::Real_timer timer; - timer.start(); + facet_size = 0.1, + facet_distance = 0.001); + // Mesh generation C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, no_perturb(), no_exude()); - timer.stop(); - std::cerr << "Remeshing: " << timer.time() << '\n'; - timer.reset(); - timer.start(); // Output the facets of the c3t3 to an OFF file. The facets will not be // oriented. std::ofstream off_file("out.off"); c3t3.output_boundary_to_off(off_file); - timer.stop(); - std::cerr << "Export surface: " << timer.time() << '\n'; return off_file.fail() ? EXIT_FAILURE : EXIT_SUCCESS; }