From 199ece2b103462bb0661870ed896430eb1c68c4b Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Sun, 10 Mar 2024 19:14:19 +0100 Subject: [PATCH] new options/criteria to choose which facets to merge --- .../test/Triangulation_3/cdt_3_from_off.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Triangulation_3/test/Triangulation_3/cdt_3_from_off.cpp b/Triangulation_3/test/Triangulation_3/cdt_3_from_off.cpp index e96373f585e..f71a87b5763 100644 --- a/Triangulation_3/test/Triangulation_3/cdt_3_from_off.cpp +++ b/Triangulation_3/test/Triangulation_3/cdt_3_from_off.cpp @@ -73,6 +73,8 @@ struct CDT_options double ratio = 0.1; double vertex_vertex_epsilon = 1e-14; double segment_vertex_epsilon = 1e-14; + double coplanar_polygon_max_angle = 1; + double coplanar_polygon_max_distance = 1e-6; std::string failure_assertion_expression{}; std::string input_filename = CGAL::data_file_path("meshes/mpi.off"); std::string output_filename{"dump.off"}; @@ -96,6 +98,8 @@ Usage: cdt_3_from_off [options] input.off output.off --ratio : ratio of faces to remove (default: 0.1), if --failure-expression is used --vertex-vertex-epsilon : epsilon for vertex-vertex min distance (default: 1e-6) --segment-vertex-epsilon : epsilon for segment-vertex min distance (default: 0) + --coplanar-polygon-max-angle : max angle for coplanar polygons (default: 1) + --coplanar-polygon-max-distance : max distance for coplanar polygons (default: 1e-6) --dump-patches-after-merge : dump patches after merging facets in PLY --dump-patches-borders-prefix : dump patches borders @@ -159,6 +163,12 @@ int main(int argc, char* argv[]) } else if(arg == "--segment-vertex-epsilon") { assert(i + 1 < argc); options.segment_vertex_epsilon = std::stod(argv[++i]); + } else if(arg == "--coplanar-polygon-max-angle") { + assert(i + 1 < argc); + options.coplanar_polygon_max_angle = std::stod(argv[++i]); + } else if(arg == "--coplanar-polygon-max-distance") { + assert(i + 1 < argc); + options.coplanar_polygon_max_distance = std::stod(argv[++i]); } else if(arg == "--quiet") { options.quiet = true; } else if(arg == "--debug-missing-regions") { @@ -399,7 +409,9 @@ int go(Mesh mesh, CDT_options options) { } else { namespace np = CGAL::parameters; nb_patches = CGAL::Polygon_mesh_processing::region_growing_of_planes_on_faces( - mesh, patch_id_map, np::maximum_distance(1e-8 * bbox_max_width).maximum_angle(1)); + mesh, patch_id_map, + np::maximum_distance(options.coplanar_polygon_max_distance * bbox_max_width) + .maximum_angle(options.coplanar_polygon_max_angle)); } for(auto f: faces(mesh)) { if(get(patch_id_map, f) < 0) {