diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt index aaef51ea9df..28763fe4084 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt @@ -63,8 +63,8 @@ create_single_source_cgal_program("soup_autorefinement.cpp") find_package(Eigen3 3.2.0 QUIET) #(requires 3.2.0 or greater) include(CGAL_Eigen3_support) if(TARGET CGAL::Eigen3_support) - create_single_source_cgal_program("acvd_example.cpp") - target_link_libraries(acvd_example PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program("acvd_remeshing_example.cpp") + target_link_libraries(acvd_remeshing_example PUBLIC CGAL::Eigen3_support) create_single_source_cgal_program("hole_filling_example.cpp") target_link_libraries(hole_filling_example PRIVATE CGAL::Eigen3_support) create_single_source_cgal_program("hole_filling_example_SM.cpp") diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/acvd_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/acvd_remeshing_example.cpp similarity index 100% rename from Polygon_mesh_processing/examples/Polygon_mesh_processing/acvd_example.cpp rename to Polygon_mesh_processing/examples/Polygon_mesh_processing/acvd_remeshing_example.cpp diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/approximated_centroidal_Voronoi_diagram_remeshing.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/approximated_centroidal_Voronoi_diagram_remeshing.h index e25560159f6..67d9995b088 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/approximated_centroidal_Voronoi_diagram_remeshing.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/approximated_centroidal_Voronoi_diagram_remeshing.h @@ -128,7 +128,7 @@ typename GT::Vector_3 compute_displacement(const Eigen::Matrix Matrix3d; - int MaxNumberOfUsedSingularValues = 3; + int max_nb_of_singular_values_used = 3; Matrix3d A; A(0, 0) = quadric(0, 0); A(0, 1) = A(1, 0) = quadric(0, 1); @@ -175,7 +175,7 @@ typename GT::Vector_3 compute_displacement(const Eigen::Matrix 1e-3) - && (MaxNumberOfUsedSingularValues > 0)) + && (max_nb_of_singular_values_used > 0)) { // If this is true, then w[i] != 0, so this division is ok. double Inv = 1.0 / w[IndexMax]; @@ -193,7 +193,7 @@ typename GT::Vector_3 compute_displacement(const Eigen::Matrix::value + ? get_default_random() + : CGAL::Random(choose_parameter(get_parameter(np, internal_np::random_seed),0)); + // randomly initialize clusters //TODO: std::lower_bound with vertex_weight_pmap for better sampling for (int ci = 0; ci < nb_clusters; ++ci) @@ -596,7 +599,7 @@ std::pair< int vi; Vertex_descriptor vd; do { - vi = CGAL::get_default_random().get_int(0, num_vertices(pmesh)); + vi = rnd.get_int(0, num_vertices(pmesh)); vd = *(vertices(pmesh).begin() + vi); // TODO: bad with Polyhedron } while (get(vertex_cluster_pmap, vd) != -1); @@ -635,8 +638,8 @@ std::pair< clusters[ cluster_id ].add_vertex( get(vpm, v), v_weight, v_qem); } - for (int ci=0; ci points; std::vector> polygons; - TriangleMesh simplified_mesh; - - for (int i = 0; i < nb_clusters; ++i) { // if (clusters[i].weight_sum > 0) @@ -1181,9 +1181,8 @@ dump_mesh_with_cluster_colors(pmesh, vertex_cluster_pmap, "/tmp/cluster_"+std::t if (clusters[c].nb_vertices==1) continue; - std::cout << "putting " << v << " from " << c << " to " << clusters.size() << "(" << clusters[c].nb_vertices << ")" << "\n"; put(vertex_cluster_pmap, v, clusters.size()); - if (get(vertex_cluster_pmap, v) != clusters.size()) throw std::runtime_error("BOOM"); + CGAL_assertion(get(vertex_cluster_pmap, v) == clusters.size()); clusters.emplace_back(); } @@ -1217,9 +1216,9 @@ dump_mesh_with_cluster_colors(pmesh, vertex_cluster_pmap, "/tmp/cluster_"+std::t * * @param tmesh triangle mesh to be remeshed * @param nb_vertices lower bound on the number of target vertices in the output mesh. -* In case the mesh is not closed or if the number of points is too low -* and no manifold mesh could be produced with that budget of points, extra points -* are added to get a manifold output. +* The requested number of vertices in the output will be respected except if the input mesh is not closed +* (extra vertices will be used on the boundary), or if the number of points is too low +* and no manifold mesh can be produced with that budget of points (extra points are added to get a manifold output). * @param np optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below. * `GT` stands for the type of the object provided to the named parameter `geom_traits()`. * @@ -1265,12 +1264,12 @@ dump_mesh_with_cluster_colors(pmesh, vertex_cluster_pmap, "/tmp/cluster_"+std::t * If not, the mesh will first be subdivided until the aforementioned criterium is met.} * \cgalParamType{`GT::FT`} * \cgalParamDefault{0.1} -* \cgalParamExtra{A value between 0.1 and 0.01 is recommended, the smaller the better the approximation will be, but it .} +* \cgalParamExtra{A value between 0.1 and 0.01 is recommended, the smaller the better the approximation will be, but it will increase the runtime.} * \cgalParamNEnd * * \cgalParamNBegin{vertex_point_map} * \cgalParamDescription{a property map associating points to the vertices of `tmesh`.} -* \cgalParamType{a class model of `ReadablePropertyMap` with +* \cgalParamType{a class model of `ReadWritePropertyMap` with * `boost::graph_traits::%vertex_descriptor` * as key type and `GT::Point_3` as value type.} * \cgalParamDefault{`boost::get(CGAL::vertex_point, tmesh)`.} @@ -1278,9 +1277,15 @@ dump_mesh_with_cluster_colors(pmesh, vertex_cluster_pmap, "/tmp/cluster_"+std::t * `CGAL::vertex_point_t` must be available in `TriangleMesh`.} * \cgalParamNEnd * +* \cgalParamNBegin{random_seed} +* \cgalParamDescription{a value to seed the random number generator} +* \cgalParamType{unsigned int} +* \cgalParamDefault{a value generated with `std::time()`} +* \cgalParamNEnd +* * \cgalParamNBegin{geom_traits} * \cgalParamDescription{an instance of a geometric traits class.} -* \cgalParamType{a class model of `Kernel`} +* \cgalParamType{a class model of `Kernel`, with `GT::FT` being either `float` or `double`.} * \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`.} * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} * \cgalParamNEnd