Skip to content

Commit cb3e182

Browse files
committed
Merge remote-tracking branch 'cgal/5.6.x-branch' into HEAD
2 parents 8f499a4 + 06fa730 commit cb3e182

File tree

7 files changed

+359
-116
lines changed

7 files changed

+359
-116
lines changed

Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,10 @@ class Face_graph_output_builder
10911091
boost::dynamic_bitset<> coplanar_patches_of_tm2_for_union_and_intersection(nb_patches_tm2,false);
10921092
patch_status_not_set_tm1.set();
10931093
patch_status_not_set_tm2.set();
1094+
// extra containers used when entire connected components are identical (filled only if needed)
1095+
std::vector<std::size_t> coplanar_tm1_to_coplanar_tm2;
1096+
std::vector<vertex_descriptor> extreme_vertex_per_cc_1;
1097+
std::vector<vertex_descriptor> extreme_vertex_per_cc_2;
10941098

10951099
// first set coplanar status of patches using the coplanar faces collected during the
10961100
// extra intersection edges collected. This is important in the case of full connected components
@@ -1847,8 +1851,61 @@ class Face_graph_output_builder
18471851
{
18481852
if (coplanar_patches_of_tm1.test(patch_id))
18491853
{
1850-
if (is_tm1_inside_out == is_tm2_inside_out)
1854+
// Two "identical" coplanar patches that are entire connected components
1855+
//we have the correspondance between cpln patches thanks to faces in tm1_coplanar_faces and tm2_coplanar_faces
1856+
CGAL_assertion(tm1_coplanar_faces.size()==tm2_coplanar_faces.size());
1857+
if (coplanar_tm1_to_coplanar_tm2.empty()) // fill container only once
1858+
{
1859+
coplanar_tm1_to_coplanar_tm2.resize(nb_patches_tm1, NID);
1860+
for (std::size_t i=0; i<tm1_coplanar_faces.size(); ++i)
1861+
{
1862+
std::size_t pid1 = tm1_patch_ids[get(fids1, tm1_coplanar_faces[i])];
1863+
std::size_t pid2 = tm2_patch_ids[get(fids2, tm2_coplanar_faces[i])];
1864+
coplanar_tm1_to_coplanar_tm2[pid1]=pid2;
1865+
}
1866+
1867+
const vertex_descriptor null_v = boost::graph_traits<TriangleMesh>::null_vertex();
1868+
extreme_vertex_per_cc_1.assign(nb_patches_tm1, null_v);
1869+
for (face_descriptor fd : faces(tm1))
1870+
{
1871+
std::size_t patch_id = tm1_patch_ids[get(fids1, fd)];
1872+
if (!coplanar_patches_of_tm1.test(patch_id)) continue;
1873+
halfedge_descriptor hd=halfedge(fd, tm1);
1874+
for (halfedge_descriptor h : CGAL::halfedges_around_face(hd, tm1))
1875+
{
1876+
vertex_descriptor vd = target(h, tm1);
1877+
if (extreme_vertex_per_cc_1[patch_id]==null_v || get(vpm1,extreme_vertex_per_cc_1[patch_id])<get(vpm1,vd))
1878+
extreme_vertex_per_cc_1[patch_id]=vd;
1879+
}
1880+
}
1881+
1882+
extreme_vertex_per_cc_2.assign(nb_patches_tm2, null_v);
1883+
for (face_descriptor fd : faces(tm2))
1884+
{
1885+
std::size_t patch_id = tm2_patch_ids[get(fids2, fd)];
1886+
if (!coplanar_patches_of_tm2.test(patch_id)) continue;
1887+
halfedge_descriptor hd=halfedge(fd, tm2);
1888+
for (halfedge_descriptor h : CGAL::halfedges_around_face(hd, tm2))
1889+
{
1890+
vertex_descriptor vd = target(h, tm2);
1891+
if (extreme_vertex_per_cc_2[patch_id]==null_v || get(vpm2,extreme_vertex_per_cc_2[patch_id])<get(vpm2,vd))
1892+
extreme_vertex_per_cc_2[patch_id]=vd;
1893+
}
1894+
}
1895+
}
1896+
1897+
const std::size_t patch_id2=coplanar_tm1_to_coplanar_tm2[patch_id];
1898+
CGAL_assertion(patch_id2!=NID);
1899+
1900+
bool is_oo_tm1 = ::CGAL::Polygon_mesh_processing::internal::is_outward_oriented(extreme_vertex_per_cc_1[patch_id], tm1, parameters::vertex_point_map(vpm1)),
1901+
is_oo_tm2 = ::CGAL::Polygon_mesh_processing::internal::is_outward_oriented(extreme_vertex_per_cc_2[patch_id2], tm2, parameters::vertex_point_map(vpm2));
1902+
1903+
if (is_oo_tm1==is_oo_tm2)
1904+
{
18511905
coplanar_patches_of_tm1_for_union_and_intersection.set(patch_id);
1906+
coplanar_patches_of_tm2_for_union_and_intersection.set(patch_id2);
1907+
patch_status_not_set_tm2.reset( patch_id2 );
1908+
}
18521909
}
18531910
else
18541911
{

Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -879,14 +879,14 @@ namespace internal {
879879
std::array<halfedge_descriptor, 2> r1 = internal::is_badly_shaped(
880880
face(he, mesh_),
881881
mesh_, vpmap_, vcmap_, ecmap_, gt_,
882-
cap_threshold, // bound on the angle: above 160 deg => cap
883882
4, // bound on shortest/longest edge above 4 => needle
883+
cap_threshold, // bound on the angle: above 160 deg => cap
884884
0,// collapse length threshold : not needed here
885885
0); // flip triangle height threshold
886886

887887
std::array<halfedge_descriptor, 2> r2 = internal::is_badly_shaped(
888888
face(opposite(he, mesh_), mesh_),
889-
mesh_, vpmap_, vcmap_, ecmap_, gt_, cap_threshold, 4, 0, 0);
889+
mesh_, vpmap_, vcmap_, ecmap_, gt_, 4, cap_threshold, 0, 0);
890890

891891
const bool badly_shaped = (r1[0] != boost::graph_traits<PolygonMesh>::null_halfedge()//needle
892892
|| r1[1] != boost::graph_traits<PolygonMesh>::null_halfedge()//cap

0 commit comments

Comments
 (0)