From 9c58f6c9009b1a31b06694b3d5fea3c3a0ae686c Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 25 Apr 2025 10:35:36 +0200 Subject: [PATCH] add c3t3.set_triangulation() that internally calls rescan_after_load_of_triangulation() it avoids calling it explicitly or documenting it, but fixes the issue of updating the internal metadata of C3t3 automatically --- .../examples/SMDS_3/tetrahedron_soup_to_c3t3_example.cpp | 3 +-- SMDS_3/include/CGAL/Mesh_complex_3_in_triangulation_3.h | 8 ++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/SMDS_3/examples/SMDS_3/tetrahedron_soup_to_c3t3_example.cpp b/SMDS_3/examples/SMDS_3/tetrahedron_soup_to_c3t3_example.cpp index a4ede84a1ee..aa62bd89398 100644 --- a/SMDS_3/examples/SMDS_3/tetrahedron_soup_to_c3t3_example.cpp +++ b/SMDS_3/examples/SMDS_3/tetrahedron_soup_to_c3t3_example.cpp @@ -69,8 +69,7 @@ int main(int , char* []) //build a C3T3 C3T3 c3t3; - c3t3.triangulation() = tr; - c3t3.rescan_after_load_of_triangulation(); + c3t3.set_triangulation(tr); std::cout << "Number of corners: " << c3t3.number_of_corners() << std::endl; std::cout << "Number of edges: " << c3t3.number_of_edges() << std::endl; diff --git a/SMDS_3/include/CGAL/Mesh_complex_3_in_triangulation_3.h b/SMDS_3/include/CGAL/Mesh_complex_3_in_triangulation_3.h index 6255bb26104..fffdb9686a9 100644 --- a/SMDS_3/include/CGAL/Mesh_complex_3_in_triangulation_3.h +++ b/SMDS_3/include/CGAL/Mesh_complex_3_in_triangulation_3.h @@ -351,6 +351,14 @@ public: far_vertices_.clear(); } + /** sets the internal triangulation to \p tr + */ + void set_triangulation(const Triangulation& tr) + { + tr_ = tr; + rescan_after_load_of_triangulation(); + } + /** adds cell \p cell to the 3D complex, with subdomain index \p index */ void add_to_complex(const Cell_handle& cell, const Subdomain_index& index)