Merge remote-tracking branch 'cgal/6.0.x-branch'

This commit is contained in:
Sébastien Loriot 2025-01-20 10:19:17 +01:00
commit b4a8c00e09
2 changed files with 16 additions and 13 deletions

View File

@ -18,6 +18,8 @@
#include <CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h> #include <CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h>
#include <CGAL/Tetrahedral_remeshing/internal/property_maps.h> #include <CGAL/Tetrahedral_remeshing/internal/property_maps.h>
#include <optional>
namespace CGAL namespace CGAL
{ {
namespace Tetrahedral_remeshing namespace Tetrahedral_remeshing
@ -70,16 +72,16 @@ std::size_t peel_slivers(C3T3& c3t3,
Cell_handle c = c_i.first; Cell_handle c = c_i.first;
const std::array<bool, 4>& f_on_surface = c_i.second; const std::array<bool, 4>& f_on_surface = c_i.second;
boost::optional<Surface_patch_index> patch; std::optional<Surface_patch_index> patch;
for (int i = 0; i < 4; ++i) for (int i = 0; i < 4; ++i)
{ {
if (f_on_surface[i]) if (f_on_surface[i])
{ {
Surface_patch_index spi = c3t3.surface_patch_index(c, i); Surface_patch_index spi = c3t3.surface_patch_index(c, i);
if (patch != boost::none && patch.get() != spi) if (patch.has_value() && patch.value() != spi)
{ {
//there are 2 different patches //there are 2 different patches
patch = boost::none; patch.reset();
break; break;
} }
else else
@ -88,7 +90,7 @@ std::size_t peel_slivers(C3T3& c3t3,
} }
} }
} }
if (patch == boost::none) if (!patch.has_value())
continue; continue;
for (int i = 0; i < 4; ++i) for (int i = 0; i < 4; ++i)
@ -96,7 +98,7 @@ std::size_t peel_slivers(C3T3& c3t3,
if (f_on_surface[i]) if (f_on_surface[i])
c3t3.remove_from_complex(c, i); c3t3.remove_from_complex(c, i);
else else
c3t3.add_to_complex(c, i, patch.get()); c3t3.add_to_complex(c, i, patch.value());
} }
c3t3.remove_from_complex(c); c3t3.remove_from_complex(c);

View File

@ -26,7 +26,7 @@
#include <CGAL/Triangulation_vertex_base_3.h> #include <CGAL/Triangulation_vertex_base_3.h>
#include <CGAL/Triangulation_simplex_3.h> #include <CGAL/Triangulation_simplex_3.h>
#include <boost/optional.hpp> #include <optional>
// If defined, type casting is done statically, // If defined, type casting is done statically,
// reducing type-safety overhead. // reducing type-safety overhead.
@ -789,8 +789,8 @@ public:
} }
} else { } else {
auto facet_opt = shared_facet(get_edge(), e_prev); auto facet_opt = shared_facet(get_edge(), e_prev);
if(static_cast<bool>(facet_opt)) { if(facet_opt.has_value()) {
_curr_simplex = *facet_opt; _curr_simplex = facet_opt.value();
} }
else { else {
_curr_simplex = shared_cell(get_edge(), e_prev); _curr_simplex = shared_cell(get_edge(), e_prev);
@ -1002,7 +1002,7 @@ private:
return f1 == f2 || triangulation().mirror_facet(f1) == f2; return f1 == f2 || triangulation().mirror_facet(f1) == f2;
} }
boost::optional<Vertex_handle> shared_vertex(const Edge& e1, const Edge& e2) const std::optional<Vertex_handle> shared_vertex(const Edge& e1, const Edge& e2) const
{ {
Vertex_handle v1a = e1.first->vertex(e1.second); Vertex_handle v1a = e1.first->vertex(e1.second);
Vertex_handle v1b = e1.first->vertex(e1.third); Vertex_handle v1b = e1.first->vertex(e1.third);
@ -1017,14 +1017,15 @@ private:
return {}; return {};
} }
boost::optional<Facet> shared_facet(const Edge& e1, const Edge& e2) const std::optional<Facet> shared_facet(const Edge& e1, const Edge& e2) const
{ {
Vertex_handle v2a = e2.first->vertex(e2.second); Vertex_handle v2a = e2.first->vertex(e2.second);
Vertex_handle v2b = e2.first->vertex(e2.third); Vertex_handle v2b = e2.first->vertex(e2.third);
auto sv_opt = shared_vertex(e1, e2); auto sv_opt = shared_vertex(e1, e2);
if(!sv_opt) return {}; if(!sv_opt.has_value())
Vertex_handle sv = *sv_opt; return {};
Vertex_handle sv = sv_opt.value();
Vertex_handle nsv2 = (sv == v2a) ? v2b : v2a; Vertex_handle nsv2 = (sv == v2a) ? v2b : v2a;
typename Tr::Facet_circulator circ typename Tr::Facet_circulator circ
@ -1091,7 +1092,7 @@ private:
} }
Cell_handle shared_cell(const Edge e1, const Edge e2) const { Cell_handle shared_cell(const Edge e1, const Edge e2) const {
auto facet = shared_facet(e1, e2.first->vertex(e2.second)); Facet facet = shared_facet(e1, e2.first->vertex(e2.second));
return shared_cell(facet, e2.first->vertex(e2.third)); return shared_cell(facet, e2.first->vertex(e2.third));
} }