diff --git a/Constrained_triangulation_3/doc/Constrained_triangulation_3/Constrained_triangulation_3.txt b/Constrained_triangulation_3/doc/Constrained_triangulation_3/Constrained_triangulation_3.txt index 24f3ac1251f..45ffc1b1dc6 100644 --- a/Constrained_triangulation_3/doc/Constrained_triangulation_3/Constrained_triangulation_3.txt +++ b/Constrained_triangulation_3/doc/Constrained_triangulation_3/Constrained_triangulation_3.txt @@ -171,7 +171,7 @@ The following example illustrates how to use the helper function Delaunay triangulation from a given PLC. The triangulation is saved in the MEDIT file format, using the -\link PkgCDT3IOFunctions CGAL::IO::write_MEDIT() \endlink function. +\link PkgCDT3IOFunctions `CGAL::IO::write_MEDIT()` \endlink function. \cgalExample{Constrained_triangulation_3/conforming_constrained_Delaunay_triangulation_3.cpp } @@ -191,8 +191,11 @@ If the user already knows the set of polygon identifiers to associate with each provided and preserved throughout the construction of the conforming constrained Delaunay triangulation. -The following example demonstrates how to detect planar surface patches, remesh them as coarsely -as possible, and use this segmentation during the tetrahedralization process. +The following example demonstrates how to detect planar surface patches and remesh them as coarsely +as possible using +\link CGAL::Polygon_mesh_processing::remesh_planar_patches(const TriangleMeshIn&,PolygonMeshOut&,const NamedParametersIn&,const NamedParametersOut&) `CGAL::Polygon_mesh_processing::remesh_planar_patches()` \endlink +from the \ref PkgPolygonMeshProcessing package. +The resulting patches and segmentation are then used to build a conforming constrained Delaunay triangulation. When the named parameter `plc_facet_id` is specified, each constrained facet in the 3D triangulation is assigned to the corresponding input PLC facet, as identified by the provided property map. @@ -218,7 +221,8 @@ From left to right: Input PLC; \subsection CT_3_example_ccdt_region_growing_fimap Build a Conforming Constrained Delaunay Triangulation with Detected Polygon Identifiers If the user does not know the set of polygon identifiers to associate with each PLC facet, this information can be -automatically detected using the \link CGAL::Polygon_mesh_processing::region_growing_of_planes_on_faces(const PolygonMesh& mesh,RegionMap region_map,const NamedParameters& np) `CGAL::Polygon_mesh_processing::region_growing_of_planes_on_faces()`\endlink +automatically detected using the +\link CGAL::Polygon_mesh_processing::region_growing_of_planes_on_faces(const PolygonMesh& mesh,RegionMap region_map,const NamedParameters& np) `CGAL::Polygon_mesh_processing::region_growing_of_planes_on_faces()`\endlink function from the \ref PkgPolygonMeshProcessing package. The following example demonstrates how to detect planar surface patches and build a conforming @@ -238,7 +242,7 @@ preconditions are met. \subsubsection CT_3_example_ccdt_autorefinement Autorefinement of the Input Mesh -The following examples shows how autorefinement can be used to preprocess the input mesh, +The following example shows how autorefinement can be used to preprocess the input mesh, when it is self-intersecting. \cgalExample{Constrained_triangulation_3/ccdt_3_after_autorefinement.cpp } @@ -249,16 +253,21 @@ when it is self-intersecting. The following example demonstrates how to construct a conforming constrained Delaunay triangulation from an input mesh that is not triangulated and may contain self-intersections. -The function `CGAL::Polygon_mesh_processing::does_self_intersect()` can be used to detect self-intersections, +The function +\link CGAL::Polygon_mesh_processing::does_self_intersect(const FaceRange&, const TriangleMesh&, const NamedParameters&) `CGAL::Polygon_mesh_processing::does_self_intersect()` \endlink +can be used to detect self-intersections, but it requires the input mesh to be triangulated. Therefore, the input mesh must first be triangulated -using `CGAL::Polygon_mesh_processing::triangulate_faces()` before performing the self-intersection check. +using +\link CGAL::Polygon_mesh_processing::triangulate_faces(FaceRange,PolygonMesh&,const NamedParameters&) `CGAL::Polygon_mesh_processing::triangulate_faces()`\endlink +before performing the self-intersection check. If self-intersections are found, the triangulated mesh is converted into a triangle soup, which can then be -processed with `CGAL::Polygon_mesh_processing::autorefine_triangle_soup()` to resolve the self-intersections. +processed with +\link CGAL::Polygon_mesh_processing::autorefine_triangle_soup(PointRange&,TriangleRange&,const NamedParameters&) `CGAL::Polygon_mesh_processing::autorefine_triangle_soup()`\endlink +to resolve the self-intersections. \cgalExample{Constrained_triangulation_3/ccdt_3_preprocessing.cpp } - \subsection CT_3_example_remesh Remeshing a Conforming Constrained Delaunay Triangulation After constructing the triangulation, you can improve its quality or adapt it to a specific sizing diff --git a/Constrained_triangulation_3/examples/Constrained_triangulation_3/ccdt_3_after_autorefinement.cpp b/Constrained_triangulation_3/examples/Constrained_triangulation_3/ccdt_3_after_autorefinement.cpp index 4d926f25bef..710643ddb11 100644 --- a/Constrained_triangulation_3/examples/Constrained_triangulation_3/ccdt_3_after_autorefinement.cpp +++ b/Constrained_triangulation_3/examples/Constrained_triangulation_3/ccdt_3_after_autorefinement.cpp @@ -36,7 +36,7 @@ int main(int argc, char* argv[]) std::cout << "Mesh self-intersects, performing autorefine...\n"; // use a polygon soup as container as the output will most likely be non-manifold - std::vector points; + std::vector points; std::vector> polygons; PMP::polygon_mesh_to_polygon_soup(mesh, points, polygons); PMP::autorefine_triangle_soup(points, polygons); diff --git a/Constrained_triangulation_3/examples/Constrained_triangulation_3/ccdt_3_fimap_region_growing.cpp b/Constrained_triangulation_3/examples/Constrained_triangulation_3/ccdt_3_fimap_region_growing.cpp index 0cc03950a9c..e4c1219b14d 100644 --- a/Constrained_triangulation_3/examples/Constrained_triangulation_3/ccdt_3_fimap_region_growing.cpp +++ b/Constrained_triangulation_3/examples/Constrained_triangulation_3/ccdt_3_fimap_region_growing.cpp @@ -34,9 +34,13 @@ int main(int argc, char* argv[]) std::cout << "Merging facets into coplanar patches..." << std::endl; auto number_of_patches = CGAL::Polygon_mesh_processing::region_growing_of_planes_on_faces( - mesh, face_patch_map, - CGAL::parameters::maximum_distance(bbox_max_span * 1.e-6).maximum_angle(5.)); - for(auto f: faces(mesh)) { + mesh, + face_patch_map, + 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) == static_cast(-1)) { put(face_patch_map, f, number_of_patches++); @@ -47,11 +51,12 @@ int main(int argc, char* argv[]) filename = argc > 2 ? argv[2] : "mesh.ply"; CGAL::IO::write_polygon_mesh(filename, mesh, - CGAL::parameters::stream_precision(17) - .use_binary_mode(false) - .face_patch_map(face_patch_map)); + CGAL::parameters::stream_precision(17) + .use_binary_mode(false) + .face_patch_map(face_patch_map)); std::cout << "-- Wrote segmented mesh to \"" << filename << "\"\n"; + std::cout << "Creating a conforming constrained Delaunay triangulation...\n"; auto ccdt = CGAL::make_conforming_constrained_Delaunay_triangulation_3(mesh, CGAL::parameters::plc_facet_id(face_patch_map)); @@ -60,6 +65,7 @@ int main(int argc, char* argv[]) << "Number of constrained facets in the CDT: " << ccdt.number_of_constrained_facets() << '\n'; + // Write the CDT to a file, with the PLC face ids filename = argc > 3 ? argv[3] : "out.mesh"; std::ofstream out(filename); out.precision(17); @@ -68,4 +74,3 @@ int main(int argc, char* argv[]) return EXIT_SUCCESS; } - diff --git a/Constrained_triangulation_3/examples/Constrained_triangulation_3/conforming_constrained_Delaunay_triangulation_3_fimap.cpp b/Constrained_triangulation_3/examples/Constrained_triangulation_3/conforming_constrained_Delaunay_triangulation_3_fimap.cpp index 89d995b33ec..3ba7ad63a25 100644 --- a/Constrained_triangulation_3/examples/Constrained_triangulation_3/conforming_constrained_Delaunay_triangulation_3_fimap.cpp +++ b/Constrained_triangulation_3/examples/Constrained_triangulation_3/conforming_constrained_Delaunay_triangulation_3_fimap.cpp @@ -12,14 +12,13 @@ using K = CGAL::Exact_predicates_inexact_constructions_kernel; using Mesh = CGAL::Surface_mesh; using face_descriptor = boost::graph_traits::face_descriptor; -namespace PMP = CGAL::Polygon_mesh_processing; int main(int argc, char* argv[]) { std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/cross.off"); Mesh input; - if(!PMP::IO::read_polygon_mesh(filename, input)) { + if(!CGAL::Polygon_mesh_processing::IO::read_polygon_mesh(filename, input)) { std::cerr << "Invalid input." << std::endl; return 1; } @@ -29,16 +28,20 @@ int main(int argc, char* argv[]) Mesh mesh; auto plc_facet_map = get(CGAL::face_patch_id_t(), mesh); - PMP::remesh_planar_patches(input, mesh, + + // Remesh planar patches and segment the mesh into planar patches + CGAL::Polygon_mesh_processing::remesh_planar_patches(input, mesh, CGAL::parameters::default_values(), CGAL::parameters::face_patch_map(plc_facet_map) - .do_not_triangulate_faces(true)); + .do_not_triangulate_faces(true)); + 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"; + // Create a conforming constrained Delaunay triangulation from the mesh auto ccdt = CGAL::make_conforming_constrained_Delaunay_triangulation_3(mesh, CGAL::parameters::plc_facet_id(plc_facet_map)); diff --git a/Constrained_triangulation_3/examples/Constrained_triangulation_3/remesh_constrained_Delaunay_triangulation_3.cpp b/Constrained_triangulation_3/examples/Constrained_triangulation_3/remesh_constrained_Delaunay_triangulation_3.cpp index 5519e387a8c..d13172de94d 100644 --- a/Constrained_triangulation_3/examples/Constrained_triangulation_3/remesh_constrained_Delaunay_triangulation_3.cpp +++ b/Constrained_triangulation_3/examples/Constrained_triangulation_3/remesh_constrained_Delaunay_triangulation_3.cpp @@ -44,7 +44,8 @@ int main(int argc, char* argv[]) std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/mpi.off"); CGAL::Surface_mesh mesh; - if(!CGAL::IO::read_polygon_mesh(filename, mesh)) { + if(!CGAL::IO::read_polygon_mesh(filename, mesh)) + { std::cerr << "Error: cannot read file " << filename << std::endl; return EXIT_FAILURE; } @@ -61,13 +62,14 @@ int main(int argc, char* argv[]) namespace np = CGAL::parameters; namespace Tet_remesh = CGAL::Tetrahedral_remeshing; Tr tr = Tet_remesh::get_remeshing_triangulation(std::move(ccdt), - np::edge_is_constrained_map(constraints_pmap)); + np::edge_is_constrained_map(constraints_pmap)); //! [move ccdt to tr] std::cout << "Number of vertices in tr: " << tr.number_of_vertices() << std::endl; - CGAL::tetrahedral_isotropic_remeshing(tr, 1., - np::number_of_iterations(3) - .edge_is_constrained_map(constraints_pmap)); + CGAL::tetrahedral_isotropic_remeshing(tr, + 1., // target edge length + np::number_of_iterations(3) + .edge_is_constrained_map(constraints_pmap)); std::cout << "Number of vertices in tr: " << tr.number_of_vertices() << std::endl;