From e955df4e2826402183319a557025bf510e111a90 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 28 May 2025 10:21:38 +0200 Subject: [PATCH] fix the example --- .../ccdt_3_fpmap_region_growing.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Constrained_triangulation_3/examples/Constrained_triangulation_3/ccdt_3_fpmap_region_growing.cpp b/Constrained_triangulation_3/examples/Constrained_triangulation_3/ccdt_3_fpmap_region_growing.cpp index caee9835d43..93d2d526073 100644 --- a/Constrained_triangulation_3/examples/Constrained_triangulation_3/ccdt_3_fpmap_region_growing.cpp +++ b/Constrained_triangulation_3/examples/Constrained_triangulation_3/ccdt_3_fpmap_region_growing.cpp @@ -26,7 +26,7 @@ int main(int argc, char* argv[]) std::cout << "Read " << mesh.number_of_vertices() << " vertices and " << mesh.number_of_faces() << " facets\n"; - auto [face_patch_map, _] =mesh.add_property_map("f:patch_id", -1); + auto [face_patch_map, _] =mesh.add_property_map("f:patch_id"); const auto bbox = CGAL::Polygon_mesh_processing::bbox(mesh); const double bbox_max_span = (std::max)({bbox.x_span(), bbox.y_span(), bbox.z_span()}); @@ -38,7 +38,7 @@ int main(int argc, char* argv[]) CGAL::parameters::maximum_distance(bbox_max_span * 1.e-6).maximum_angle(5.)); for(auto f: faces(mesh)) { // if region growing did not assign a patch id, assign one - if(get(face_patch_map, f) < 0) { + if(get(face_patch_map, f) == static_cast(-1)) { put(face_patch_map, f, number_of_patches++); } } @@ -46,8 +46,11 @@ int main(int argc, char* argv[]) std::cout << "Number of patches: " << number_of_patches << std::endl; filename = argc > 2 ? argv[2] : "mesh.ply"; - CGAL::IO::write_polygon_mesh(filename, mesh, CGAL::parameters::stream_precision(17)); - std::cout << "Wrote segmented mesh to " << filename << "\n"; + CGAL::IO::write_polygon_mesh(filename, mesh, + CGAL::parameters::stream_precision(17) + .use_binary_mode(false) + .face_patch_map(face_patch_map)); + std::cout << "-- Wrote segmented mesh to \"" << filename << "\"\n"; auto ccdt = CGAL::make_conforming_constrained_Delaunay_triangulation_3(mesh, CGAL::parameters::face_patch_map(face_patch_map)); @@ -61,7 +64,7 @@ int main(int argc, char* argv[]) std::ofstream out(filename); out.precision(17); CGAL::IO::write_MEDIT(out, ccdt); - std::cout << "Wrote CDT to " << filename << "\n"; + std::cout << "-- Wrote CDT to \"" << filename << "\"\n"; return EXIT_SUCCESS; }