diff --git a/Constrained_triangulation_3/include/CGAL/Constrained_Delaunay_triangulation_cell_base_3.h b/Constrained_triangulation_3/include/CGAL/Constrained_Delaunay_triangulation_cell_base_3.h
index 78a8a967c0d..4d88637ab5b 100644
--- a/Constrained_triangulation_3/include/CGAL/Constrained_Delaunay_triangulation_cell_base_3.h
+++ b/Constrained_triangulation_3/include/CGAL/Constrained_Delaunay_triangulation_cell_base_3.h
@@ -95,8 +95,11 @@ public:
void reset_cache_validity() const { sliver_cache_validity_ = false; }
static std::string io_signature() {
- return Get_io_signature()() + "+(" + Get_io_signature()()
- + ")[4]";
+ static_assert(
+ std::is_same_v<
+ decltype(std::declval().face_constraint_index(0)), int>);
+
+ return Get_io_signature()() + "+(" + Get_io_signature()() + ")[4]";
}
friend std::ostream&
@@ -106,9 +109,9 @@ public:
os << static_cast(c);
for( unsigned li = 0; li < 4; ++li ) {
if(IO::is_ascii(os)) {
- os << " " << c.cdt_3_data().face_id[li];
+ os << " " << c.cdt_3_data().face_constraint_index(li);
} else {
- CGAL::write(os, c.cdt_3_data().face_id[li]);
+ CGAL::write(os, c.cdt_3_data().face_constraint_index(li));
}
}
return os;
diff --git a/Constrained_triangulation_3/include/CGAL/Constrained_Delaunay_triangulation_cell_data_3.h b/Constrained_triangulation_3/include/CGAL/Constrained_Delaunay_triangulation_cell_data_3.h
index b029587d545..cfc3e20f91e 100644
--- a/Constrained_triangulation_3/include/CGAL/Constrained_Delaunay_triangulation_cell_data_3.h
+++ b/Constrained_triangulation_3/include/CGAL/Constrained_Delaunay_triangulation_cell_data_3.h
@@ -29,18 +29,6 @@
#include
namespace CGAL {
-#ifdef DOXYGEN_RUNNING
-/*!
- * @brief Internal per-cell data for \cgal 3D constrained Delaunay triangulations
- *
- * This class is an internal detail of the implementation of \cgal 3D constrained Delaunay triangulations.
- *
- * Any model of the `ConstrainedDelaunayTriangulationCellBase_3` concept must include one object of this type
- * as a non-static data member.
- */
-struct Constrained_Delaunay_triangulation_cell_data_3 {};
-#else // DOXYGEN_RUNNING
-
enum class CDT_3_cell_marker {
CLEAR = 0,
IN_REGION = 1,
@@ -49,7 +37,19 @@ enum class CDT_3_cell_marker {
nb_of_markers
};
-struct Constrained_Delaunay_triangulation_cell_data_3 {
+/*!
+ * @brief Internal per-cell data for \cgal 3D constrained Delaunay triangulations
+ *
+ * This class is an internal detail of the implementation of \cgal 3D constrained Delaunay triangulations.
+ *
+ * Any model of the `ConstrainedDelaunayTriangulationCellBase_3` concept must include one object of this type
+ * as a non-static data member.
+ */
+class Constrained_Delaunay_triangulation_cell_data_3 {
+ /// @cond SKIP_IN_MANUAL
+ template friend class Constrained_Delaunay_triangulation_3_impl;
+ /// @endcond
+
std::array face_id = { -1, -1, -1, -1 };
std::array facet_2d = {nullptr, nullptr, nullptr, nullptr};
std::bitset(CDT_3_cell_marker::nb_of_markers)> markers;
@@ -60,8 +60,6 @@ struct Constrained_Delaunay_triangulation_cell_data_3 {
void clear_mark(CDT_3_cell_marker m) { markers.reset(static_cast(m)); }
void clear_marks() { markers.reset(); }
- bool is_facet_constrained(int i) const { return face_id[unsigned(i)] >= 0; }
-
template
void set_facet_constraint(int i, CDT_3_face_index face_id,
Facet_handle facet_2d)
@@ -70,19 +68,24 @@ struct Constrained_Delaunay_triangulation_cell_data_3 {
this->facet_2d[unsigned(i)] = static_cast(facet_2d == Facet_handle{} ? nullptr : std::addressof(*facet_2d));
}
- CDT_3_face_index face_constraint_index(int i) const {
- return face_id[unsigned(i)];
- }
-
template
auto face_2 (const CDT_2& cdt, int i) const {
using Face = typename CDT_2::Face;
auto ptr = static_cast(facet_2d[unsigned(i)]);
return cdt.tds().faces().iterator_to(*ptr);
}
+public:
+ /// @brief Returns if the i-th facet of the cell is constrained.
+ bool is_facet_constrained(int i) const { return face_id[unsigned(i)] >= 0; }
+
+ /// @brief Returns the index of the constraint that constrains the
+ /// i-th facet of the cell.
+ /// @pre `is_facet_constrained(i)`
+ CDT_3_face_index face_constraint_index(int i) const {
+ return face_id[unsigned(i)];
+ }
};
-#endif // DOXYGEN_RUNNING
} // namespace CGAL
#endif // CGAL_CONSTRAINED_DELAUNAY_TRIANGULATION_CELL_DATA_3_H
diff --git a/Constrained_triangulation_3/include/CGAL/Constrained_triangulation_3/internal/config.h b/Constrained_triangulation_3/include/CGAL/Constrained_triangulation_3/internal/config.h
index a566ed1bab7..a7c1a3a0acc 100644
--- a/Constrained_triangulation_3/include/CGAL/Constrained_triangulation_3/internal/config.h
+++ b/Constrained_triangulation_3/include/CGAL/Constrained_triangulation_3/internal/config.h
@@ -25,6 +25,8 @@
#include
+#include
+
#if CGAL_CAN_USE_CXX20_FORMAT
# define CGAL_CDT_3_CAN_USE_CXX20_FORMAT 1
# include
@@ -32,8 +34,6 @@
namespace CGAL {
-using CDT_3_face_index = int; // must be signed
-
#if CGAL_CDT_3_CAN_USE_CXX20_FORMAT
constexpr bool cdt_3_can_use_cxx20_format() {
diff --git a/Constrained_triangulation_3/include/CGAL/Constrained_triangulation_3_types.h b/Constrained_triangulation_3/include/CGAL/Constrained_triangulation_3_types.h
new file mode 100644
index 00000000000..94d4a4f6bc8
--- /dev/null
+++ b/Constrained_triangulation_3/include/CGAL/Constrained_triangulation_3_types.h
@@ -0,0 +1,42 @@
+// Copyright (c) 2024 GeometryFactory Sarl (France).
+// All rights reserved.
+//
+// This file is part of CGAL (www.cgal.org).
+// You can redistribute it and/or modify it under the terms of the GNU
+// General Public License as published by the Free Software Foundation,
+// either version 3 of the License, or (at your option) any later version.
+//
+// Licensees holding a valid commercial license may use this file in
+// accordance with the commercial license agreement provided with the software.
+//
+// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// $URL$
+// $Id$
+// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
+//
+// Author(s) : Laurent Rineau
+
+#ifndef CGAL_CT_3_TYPES_H
+#define CGAL_CT_3_TYPES_H
+
+#include
+
+#include
+
+namespace CGAL {
+
+/**
+ * @addtogroup PkgCT_3Classes
+ * @typedef CDT_3_face_index
+ * Integral type to store the index of constraints.
+ * @see `Constrained_Delaunay_triangulation_cell_data_3`
+ * @see `Constrained_Delaunay_triangulation_vertex_base_3`
+ *
+ */
+using CDT_3_face_index = int; // must be signed
+
+} // namespace CGAL
+
+#endif // CGAL_CT_3_TYPES_H