Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mesh 3 - avoid tuples in internal code #8242

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
53 changes: 31 additions & 22 deletions Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ class Refine_facets_3_base
typedef typename GT::Ray_3 Ray_3;
typedef typename GT::Line_3 Line_3;

typedef typename MeshDomain::Intersection Intersection;

public:
Refine_facets_3_base(Tr& tr, Complex3InTriangulation3& c3t3,
const MeshDomain& oracle,
Expand Down Expand Up @@ -356,6 +358,19 @@ class Refine_facets_3_base
return sstr.str();
}

int dimension(const Intersection& intersection) const
{
return std::get<2>(intersection);
}
const typename MeshDomain::Index& index(const Intersection& intersection) const
lrineau marked this conversation as resolved.
Show resolved Hide resolved
{
return std::get<1>(intersection);
}
const typename MeshDomain::Point_3& point(const Intersection& intersection) const
{
return std::get<0>(intersection);
}

protected:

// Functor for scan_triangulation_impl function
Expand Down Expand Up @@ -395,9 +410,13 @@ class Refine_facets_3_base
typedef typename MeshDomain::Surface_patch_index Surface_patch_index;
typedef typename MeshDomain::Index Index;

typedef typename std::optional<
std::tuple<Surface_patch_index, Index, Bare_point> >
Facet_properties;
struct Facet_prop
{
Surface_patch_index surface_patch_index;
Index index;
Bare_point point;
};
typedef typename std::optional<Facet_prop> Facet_properties;


/// Returns canonical facet of facet
Expand Down Expand Up @@ -1342,9 +1361,7 @@ conflicts_zone_impl(const Weighted_point& point
this->compute_facet_properties(facet, properties, /*force_exact=*/true);
if ( properties )
{
const Surface_patch_index& surface_index = std::get<0>(*properties);
const Index& surface_center_index = std::get<1>(*properties);
const Bare_point& surface_center = std::get<2>(*properties);
const auto& [surface_index, surface_center_index, surface_center] = *properties;

// Facet is on surface: set facet properties
this->set_facet_surface_center(facet, surface_center, surface_center_index);
Expand Down Expand Up @@ -1404,9 +1421,7 @@ conflicts_zone_impl(const Weighted_point& point
this->compute_facet_properties(facet, properties, /*force_exact=*/true);
if ( properties )
{
const Surface_patch_index& surface_index = std::get<0>(*properties);
const Index& surface_center_index = std::get<1>(*properties);
const Bare_point& surface_center = std::get<2>(*properties);
const auto& [surface_index, surface_center_index, surface_center] = *properties;

// Facet is on surface: set facet properties
this->set_facet_surface_center(facet, surface_center, surface_center_index);
Expand Down Expand Up @@ -1572,9 +1587,7 @@ treat_new_facet(Facet& facet)
compute_facet_properties(facet, properties);
if ( properties )
{
const Surface_patch_index& surface_index = std::get<0>(*properties);
const Index& surface_center_index = std::get<1>(*properties);
const Bare_point& surface_center = std::get<2>(*properties);
const auto& [surface_index, surface_center_index, surface_center] = *properties;

// Facet is on surface: set facet properties
set_facet_surface_center(facet, surface_center, surface_center_index);
Expand Down Expand Up @@ -1672,14 +1685,12 @@ compute_facet_properties(const Facet& facet,
// test "intersect == Intersection()" (aka empty intersection), but
// the later does not work.
Surface_patch surface =
(std::get<2>(intersect) == 0) ? Surface_patch() :
(dimension(intersect) == 0) ? Surface_patch() :
Surface_patch(
r_oracle_.surface_patch_index(std::get<1>(intersect)));
r_oracle_.surface_patch_index(index(intersect)));
if(surface)
#endif // CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
fp = Facet_properties(std::make_tuple(*surface,
std::get<1>(intersect),
std::get<0>(intersect)));
fp = Facet_prop{*surface, index(intersect), point(intersect)};
}
}
// If the dual is a ray
Expand Down Expand Up @@ -1710,15 +1721,13 @@ compute_facet_properties(const Facet& facet,
Intersection intersect = construct_intersection(ray);
#ifdef CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
Surface_patch surface =
(std::get<2>(intersect) == 0) ? Surface_patch() :
(dimension(intersect) == 0) ? Surface_patch() :
Surface_patch(
r_oracle_.surface_patch_index(std::get<1>(intersect)));
r_oracle_.surface_patch_index(index(intersect)));
if(surface)
#endif // CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
{
fp = Facet_properties(std::make_tuple(*surface,
std::get<1>(intersect),
std::get<0>(intersect)));
fp = Facet_prop{*surface, index(intersect), point(intersect)};
}
}
}
Expand Down