Skip to content

Commit 3e5b9fc

Browse files
committed
Merge remote-tracking branch 'cgal/6.1.x-branch' into 'cgal/6.2.x-branch'
2 parents 78fd0ba + 540297b commit 3e5b9fc

2 files changed

Lines changed: 23 additions & 16 deletions

File tree

Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/collapse_short_edges.h

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,21 +1206,28 @@ auto can_be_collapsed(const typename C3T3::Edge& e,
12061206
bool on_boundary;
12071207
};
12081208

1209-
const bool boundary = c3t3.is_in_complex(e)
1210-
|| is_boundary(c3t3, e, cell_selector);
1209+
const bool in_cx = c3t3.is_in_complex(e);
1210+
if(in_cx && protect_boundaries)
1211+
return Collapsible{false, true /*boundary*/};
12111212

1212-
if (protect_boundaries)
1213-
{
1214-
if (boundary)
1215-
return Collapsible{false, boundary};
1213+
const bool boundary = is_boundary(c3t3, e, cell_selector);
1214+
if(boundary && protect_boundaries)
1215+
return Collapsible{false, boundary};
12161216

1217-
return Collapsible{ is_internal(e, c3t3, cell_selector), boundary};
1218-
}
1219-
else
1217+
if(!is_selected(e, c3t3.triangulation(), cell_selector))
1218+
return Collapsible{false, boundary};
1219+
1220+
if(!boundary && !in_cx)
12201221
{
1221-
return Collapsible{ is_selected(e, c3t3.triangulation(), cell_selector),
1222-
boundary };
1222+
auto patch_v0 = surface_patch_index(e.first->vertex(e.second), c3t3);
1223+
auto patch_v1 = surface_patch_index(e.first->vertex(e.third), c3t3);
1224+
1225+
if(patch_v0 != std::nullopt && patch_v1 != std::nullopt && patch_v0 != patch_v1)
1226+
return Collapsible{false, boundary};
12231227
}
1228+
1229+
// if(!is_internal(e, c3t3, cell_selector))
1230+
return Collapsible {true, boundary};
12241231
}
12251232

12261233
template<typename C3T3,

Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -806,10 +806,10 @@ bool is_boundary_vertex(const typename C3t3::Vertex_handle& v,
806806
}
807807

808808
template<typename C3t3>
809-
typename C3t3::Surface_patch_index surface_patch_index(const typename C3t3::Vertex_handle v,
810-
const C3t3& c3t3)
809+
std::optional<typename C3t3::Surface_patch_index>
810+
surface_patch_index(const typename C3t3::Vertex_handle v,
811+
const C3t3& c3t3)
811812
{
812-
typedef typename C3t3::Surface_patch_index Surface_patch_index;
813813
typedef typename C3t3::Facet Facet;
814814
std::vector<Facet> facets;
815815
c3t3.triangulation().incident_facets(v, std::back_inserter(facets));
@@ -819,7 +819,7 @@ typename C3t3::Surface_patch_index surface_patch_index(const typename C3t3::Vert
819819
if (c3t3.is_in_complex(f))
820820
return c3t3.surface_patch_index(f);
821821
}
822-
return Surface_patch_index();
822+
return std::nullopt;
823823
}
824824

825825
template<typename C3t3>
@@ -833,7 +833,7 @@ void set_index(typename C3t3::Vertex_handle v, const C3t3& c3t3)
833833
case 2:
834834
CGAL_expensive_assertion(surface_patch_index(v, c3t3)
835835
!= typename C3t3::Surface_patch_index());
836-
v->set_index(surface_patch_index(v, c3t3));
836+
v->set_index(surface_patch_index(v, c3t3).value());
837837
break;
838838
case 1:
839839
v->set_index(typename C3t3::Curve_index(1));

0 commit comments

Comments
 (0)