From 90c3791221d45650faa7f80c80fe0162ab5535dd Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 29 Apr 2025 09:14:31 +0200 Subject: [PATCH 1/4] add class `Simplicial_mesh_triangulation_3` to ease the use of C3t3 --- SMDS_3/doc/SMDS_3/examples.txt | 1 + SMDS_3/examples/SMDS_3/CMakeLists.txt | 1 + ..._example.cpp => c3t3_complete_example.cpp} | 0 .../CGAL/Simplicial_mesh_triangulation_3.h | 51 +++++++++++++++++++ 4 files changed, 53 insertions(+) rename SMDS_3/examples/SMDS_3/{c3t3_example.cpp => c3t3_complete_example.cpp} (100%) create mode 100644 SMDS_3/include/CGAL/Simplicial_mesh_triangulation_3.h diff --git a/SMDS_3/doc/SMDS_3/examples.txt b/SMDS_3/doc/SMDS_3/examples.txt index fe33a6e5c64..df44fa577ec 100644 --- a/SMDS_3/doc/SMDS_3/examples.txt +++ b/SMDS_3/doc/SMDS_3/examples.txt @@ -1,4 +1,5 @@ /*! \example SMDS_3/c3t3_example.cpp +\example SMDS_3/c3t3_complete_example.cpp \example SMDS_3/tetrahedron_soup_to_c3t3_example.cpp */ diff --git a/SMDS_3/examples/SMDS_3/CMakeLists.txt b/SMDS_3/examples/SMDS_3/CMakeLists.txt index 77d7ba6b6a8..d3485b91965 100644 --- a/SMDS_3/examples/SMDS_3/CMakeLists.txt +++ b/SMDS_3/examples/SMDS_3/CMakeLists.txt @@ -9,4 +9,5 @@ project(SMDS_3_Examples) find_package(CGAL REQUIRED) create_single_source_cgal_program("c3t3_example.cpp") +create_single_source_cgal_program("c3t3_complete_example.cpp") create_single_source_cgal_program("tetrahedron_soup_to_c3t3_example.cpp") diff --git a/SMDS_3/examples/SMDS_3/c3t3_example.cpp b/SMDS_3/examples/SMDS_3/c3t3_complete_example.cpp similarity index 100% rename from SMDS_3/examples/SMDS_3/c3t3_example.cpp rename to SMDS_3/examples/SMDS_3/c3t3_complete_example.cpp diff --git a/SMDS_3/include/CGAL/Simplicial_mesh_triangulation_3.h b/SMDS_3/include/CGAL/Simplicial_mesh_triangulation_3.h new file mode 100644 index 00000000000..b1c033d0990 --- /dev/null +++ b/SMDS_3/include/CGAL/Simplicial_mesh_triangulation_3.h @@ -0,0 +1,51 @@ +// Copyright (c) 2006-2007 INRIA Sophia-Antipolis (France). +// Copyright (c) 2008,2011 GeometryFactory Sarl (France) +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// Author(s) : Laurent Rineau, Stephane Tayeb, Andreas Fabri, Jane Tournois + +#ifndef CGAL_SIMPLICIAL_MESH_TRIANGULATION_3_H +#define CGAL_SIMPLICIAL_MESH_TRIANGULATION_3_H + +#include + +#include +#include +#include +#include + +namespace CGAL +{ + /** + *\ingroup PkgSMDS3Classes + * `Simplicial_mesh_triangulation_3` + * @todo + */ + template + class Simplicial_mesh_triangulation_3 + : public CGAL::Triangulation_3, + CGAL::Simplicial_mesh_cell_base_3, + CGAL::Sequential_tag> + > + {}; +}; + +#endif // CGAL_SIMPLICIAL_MESH_TRIANGULATION_3_H + + From 0b50a227bebfe58fa70c979502bd327b31502d00 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 29 Apr 2025 09:19:02 +0200 Subject: [PATCH 2/4] add new example --- SMDS_3/examples/SMDS_3/c3t3_example.cpp | 39 +++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 SMDS_3/examples/SMDS_3/c3t3_example.cpp diff --git a/SMDS_3/examples/SMDS_3/c3t3_example.cpp b/SMDS_3/examples/SMDS_3/c3t3_example.cpp new file mode 100644 index 00000000000..6a881fe5301 --- /dev/null +++ b/SMDS_3/examples/SMDS_3/c3t3_example.cpp @@ -0,0 +1,39 @@ +#include + +#include +#include + +#include +#include + +using K = CGAL::Exact_predicates_inexact_constructions_kernel; + +using Triangulation = CGAL::Simplicial_mesh_triangulation_3; +using C3t3 = CGAL::Mesh_complex_3_in_triangulation_3; + +int main(int argc, char* argv[]) +{ + std::cout.precision(17); + std::cerr.precision(17); + + std::string filename = (argc > 1) ? std::string(argv[1]) + : CGAL::data_file_path("meshes/elephant.mesh"); + + Triangulation tr; + + std::ifstream is(filename, std::ios_base::in); + if(!CGAL::IO::read_MEDIT(is, tr)) + { + std::cerr << "Failed to read" << std::endl; + return EXIT_FAILURE; + } + + C3t3 c3t3; + c3t3.triangulation() = tr; + + std::ofstream os("out.mesh"); + CGAL::IO::write_MEDIT(os, tr, CGAL::parameters::all_vertices(true)); + os.close(); + + return EXIT_SUCCESS; +} From 96c1b137542b57aa19281a21caf37f8d83a578dc Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 2 May 2025 14:36:28 +0200 Subject: [PATCH 3/4] use template alias Co-authored-by: Laurent Rineau --- SMDS_3/include/CGAL/Simplicial_mesh_triangulation_3.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SMDS_3/include/CGAL/Simplicial_mesh_triangulation_3.h b/SMDS_3/include/CGAL/Simplicial_mesh_triangulation_3.h index b1c033d0990..648d05654a3 100644 --- a/SMDS_3/include/CGAL/Simplicial_mesh_triangulation_3.h +++ b/SMDS_3/include/CGAL/Simplicial_mesh_triangulation_3.h @@ -32,8 +32,8 @@ namespace CGAL typename SurfacePatchIndex = int, typename CurveIndex = int, typename CornerIndex = int> - class Simplicial_mesh_triangulation_3 - : public CGAL::Triangulation_3 Date: Mon, 5 May 2025 11:36:36 +0200 Subject: [PATCH 4/4] fix previous commit --- SMDS_3/include/CGAL/Simplicial_mesh_triangulation_3.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SMDS_3/include/CGAL/Simplicial_mesh_triangulation_3.h b/SMDS_3/include/CGAL/Simplicial_mesh_triangulation_3.h index 648d05654a3..918d70cb37f 100644 --- a/SMDS_3/include/CGAL/Simplicial_mesh_triangulation_3.h +++ b/SMDS_3/include/CGAL/Simplicial_mesh_triangulation_3.h @@ -33,7 +33,7 @@ namespace CGAL typename CurveIndex = int, typename CornerIndex = int> using Simplicial_mesh_triangulation_3 = - public CGAL::Triangulation_3, CGAL::Simplicial_mesh_cell_base_3, - CGAL::Sequential_tag> - > - {}; + CGAL::Sequential_tag + > + >; }; #endif // CGAL_SIMPLICIAL_MESH_TRIANGULATION_3_H