replace tuple with struct to improve readability

This commit is contained in:
Jane Tournois 2024-05-30 16:27:01 +02:00 committed by Jane Tournois
parent c0f53c4a3e
commit fe6e71724b
1 changed files with 21 additions and 18 deletions

View File

@ -412,9 +412,13 @@ protected:
typedef typename MeshDomain::Surface_patch_index Surface_patch_index; typedef typename MeshDomain::Surface_patch_index Surface_patch_index;
typedef typename MeshDomain::Index Index; typedef typename MeshDomain::Index Index;
typedef typename std::optional< struct Facet_prop
std::tuple<Surface_patch_index, Index, Bare_point> > {
Facet_properties; Surface_patch_index surface_patch_index;
Index index;
Bare_point point;
};
typedef typename std::optional<Facet_prop> Facet_properties;
/// Returns canonical facet of facet /// Returns canonical facet of facet
@ -1359,9 +1363,10 @@ conflicts_zone_impl(const Weighted_point& point
this->compute_facet_properties(facet, properties, /*force_exact=*/true); this->compute_facet_properties(facet, properties, /*force_exact=*/true);
if ( properties ) if ( properties )
{ {
const Surface_patch_index& surface_index = std::get<0>(*properties); const Facet_prop& prop = *properties;
const Index& surface_center_index = std::get<1>(*properties); const Surface_patch_index& surface_index = prop.surface_patch_index;
const Bare_point& surface_center = std::get<2>(*properties); const Index& surface_center_index = prop.index;
const Bare_point& surface_center = prop.point;
// Facet is on surface: set facet properties // Facet is on surface: set facet properties
this->set_facet_surface_center(facet, surface_center, surface_center_index); this->set_facet_surface_center(facet, surface_center, surface_center_index);
@ -1421,9 +1426,10 @@ conflicts_zone_impl(const Weighted_point& point
this->compute_facet_properties(facet, properties, /*force_exact=*/true); this->compute_facet_properties(facet, properties, /*force_exact=*/true);
if ( properties ) if ( properties )
{ {
const Surface_patch_index& surface_index = std::get<0>(*properties); const Facet_prop& prop = *properties;
const Index& surface_center_index = std::get<1>(*properties); const Surface_patch_index& surface_index = prop.surface_patch_index;
const Bare_point& surface_center = std::get<2>(*properties); const Index& surface_center_index = prop.index;
const Bare_point& surface_center = prop.point;
// Facet is on surface: set facet properties // Facet is on surface: set facet properties
this->set_facet_surface_center(facet, surface_center, surface_center_index); this->set_facet_surface_center(facet, surface_center, surface_center_index);
@ -1589,9 +1595,10 @@ treat_new_facet(Facet& facet)
compute_facet_properties(facet, properties); compute_facet_properties(facet, properties);
if ( properties ) if ( properties )
{ {
const Surface_patch_index& surface_index = std::get<0>(*properties); const Facet_prop& prop = *properties;
const Index& surface_center_index = std::get<1>(*properties); const Surface_patch_index& surface_index = prop.surface_patch_index;
const Bare_point& surface_center = std::get<2>(*properties); const Index& surface_center_index = prop.index;
const Bare_point& surface_center = prop.point;
// Facet is on surface: set facet properties // Facet is on surface: set facet properties
set_facet_surface_center(facet, surface_center, surface_center_index); set_facet_surface_center(facet, surface_center, surface_center_index);
@ -1694,9 +1701,7 @@ compute_facet_properties(const Facet& facet,
r_oracle_.surface_patch_index(index(intersect))); r_oracle_.surface_patch_index(index(intersect)));
if(surface) if(surface)
#endif // CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3 #endif // CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
fp = Facet_properties(std::make_tuple(*surface, fp = Facet_prop{*surface, index(intersect), point(intersect)};
index(intersect),
point(intersect)));
} }
} }
// If the dual is a ray // If the dual is a ray
@ -1733,9 +1738,7 @@ compute_facet_properties(const Facet& facet,
if(surface) if(surface)
#endif // CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3 #endif // CGAL_MESH_3_NO_LONGER_CALLS_DO_INTERSECT_3
{ {
fp = Facet_properties(std::make_tuple(*surface, fp = Facet_prop{*surface, index(intersect), point(intersect)};
index(intersect),
point(intersect)));
} }
} }
} }