Merge branch 'Triangulation_3-CDT_3-lrineau' of https://github.com/lrineau/cgal into Triangulation_3-CDT_3-lrineau

This commit is contained in:
Jane Tournois 2025-06-16 16:21:13 +02:00
commit 0860e790c4
4 changed files with 27 additions and 11 deletions

View File

@ -23,7 +23,7 @@ results in a _conforming_ triangulation.
This package implements an algorithm for constructing conforming triangulations of 3D polygonal
constraints. Specifically, it requires that these piecewise linear constraints are provided as a
_Piecewise Linear Complex_ (PLC). The resulting triangulations are of type `Triangulation_3`,
_piecewise linear complex_ (PLC). The resulting triangulations are of type `Triangulation_3`,
as described in the chapter \ref PkgTriangulation3.
The article by Cohen-Steiner et al. \cgalCite{cgal:cohen2002conforming} discusses the problem of
@ -38,7 +38,7 @@ This section introduces the key concepts necessary to understand and use this pa
\subsection CT_3_PLC Piecewise Linear Complex
A _Piecewise Linear Complex_ (PLC) is the three-dimensional generalization of a
A _piecewise linear complex_ (PLC) is the three-dimensional generalization of a
planar straight-line graph. It consists of a finite set of vertices, edges, and polygons (faces)
that satisfy the following properties:
@ -56,7 +56,7 @@ Polygons in a PLC may be non-convex, may have holes, and may have arbitrarily ma
<img src="plc.png" style="max-width:60%;"/>
</center>
\cgalFigureCaptionBegin{CT_3_plc_fig}
A Piecewise Linear Complex, composed of planar faces connected by edges and vertices.
A piecewise linear complex, composed of planar faces connected by edges and vertices.
\cgalFigureCaptionEnd

View File

@ -1,10 +1,11 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/IO/polygon_mesh_io.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/draw_constrained_triangulation_3.h>
#include <CGAL/make_conforming_constrained_Delaunay_triangulation_3.h>
#include <CGAL/IO/write_MEDIT.h>
#include <cassert>
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
int main(int argc, char* argv[])
@ -22,16 +23,27 @@ int main(int argc, char* argv[])
auto ccdt = CGAL::make_conforming_constrained_Delaunay_triangulation_3(mesh);
//! [use of ccdt.triangulation()]
std::cout << "Number of vertices in the CDT: "
<< ccdt.triangulation().number_of_vertices() << '\n'
<< "Number of constrained facets in the CDT: "
<< ccdt.triangulation().number_of_vertices() << '\n';
//! [use of ccdt.triangulation()]
std::cout << "Number of constrained facets in the CDT: "
<< ccdt.number_of_constrained_facets() << '\n';
std::ofstream ofs(argc > 2 ? argv[2] : "out.mesh");
ofs.precision(17);
CGAL::IO::write_MEDIT(ofs, ccdt);
CGAL::draw(ccdt);
//! [move ccdt to tr]
auto tr = std::move(ccdt).triangulation();
// Now `tr` is a valid `CGAL::Triangulation_3` object that can be used for further processing.
// and the triangulation of `ccdt` is empty.
std::cout << "Number of vertices in the triangulation `tr`: "
<< tr.number_of_vertices() << '\n';
std::cout << "Number of vertices in `ccdt`: "
<< ccdt.triangulation().number_of_vertices() << '\n';
assert(ccdt.triangulation().number_of_vertices() == 0);
//! [move ccdt to tr]
return EXIT_SUCCESS;
}

View File

@ -58,12 +58,10 @@ int main(int argc, char* argv[])
Constraints_set constraints;
Constraints_pmap constraints_pmap(constraints);
//! [move ccdt to tr]
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));
//! [move ccdt to tr]
std::cout << "Number of vertices in tr: " << tr.number_of_vertices() << std::endl;
CGAL::tetrahedral_isotropic_remeshing(tr,

View File

@ -855,7 +855,11 @@ public:
* \brief returns a const reference to the underlying triangulation.
*
* This allows the use of all non-modifying functions of the base triangulation.
* See the other overload for a way to move the triangulation out of this object and then modify it.
* See the other overload for a way to move the triangulation out of this object and then modify
* it.
*
* Example usage:
* \snippet[trimleft] conforming_constrained_Delaunay_triangulation_3.cpp use of ccdt.triangulation()
*/
const Triangulation& triangulation() const& {
return cdt_impl;
@ -865,8 +869,10 @@ public:
* \brief moves and returns the underlying triangulation, then clears the object.
*
* This function allows the underlying triangulation to be moved out of this object.
*
* Example usage:
* \snippet{trimleft} remesh_constrained_Delaunay_triangulation_3.cpp move ccdt to tr
* \snippet[trimleft] conforming_constrained_Delaunay_triangulation_3.cpp move ccdt to tr
*
* After calling this function, `ccdt` will be empty and `tr` will be move-constructed from the underlying triangulation, avoiding any copy.
*
* \note This function is available only when the object is an rvalue.