Skip to content

PMP: Make stitch_borders() deterministic #8890

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

Merged
merged 5 commits into from
Jun 4, 2025
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ struct Default_halfedges_keeper
{
typedef typename boost::graph_traits<Mesh>::halfedge_descriptor halfedge_descriptor;

halfedge_descriptor operator()(const halfedge_descriptor h1, const halfedge_descriptor h2) const
halfedge_descriptor operator()(const halfedge_descriptor h1, const halfedge_descriptor) const
{
return (h1 < h2) ? h1 : h2; // Arbitrary preference
return h1;
}
};

Expand Down Expand Up @@ -1025,9 +1025,9 @@ std::size_t zip_boundary_cycle(typename boost::graph_traits<PolygonMesh>::halfed
if(!hedges_to_stitch.empty())
{
#ifdef CGAL_PMP_STITCHING_DEBUG_PP
std::cout << hedges_to_stitch.size() " halfedge pairs to stitch on border containing:\n"
<< edge(h, pmesh) << "\n\t" << source(h, pmesh) << "\t(" << get(vpm, source(h, pmesh)) << ")"
<< "\n\t" << target(h, pmesh) << "\t(" << get(vpm, target(h, pmesh)) << ")" << std::endl;
std::cout << hedges_to_stitch.size() << " halfedge pairs to stitch on border containing:\n"
<< edge(bh, pmesh) << "\n\t" << source(bh, pmesh) << "\t(" << get(vpm, source(bh, pmesh)) << ")"
<< "\n\t" << target(bh, pmesh) << "\t(" << get(vpm, target(bh, pmesh)) << ")" << std::endl;
#endif

std::size_t local_stitches = internal::stitch_halfedge_range(hedges_to_stitch, cycle_halfedges,
Expand Down Expand Up @@ -1369,13 +1369,13 @@ std::size_t stitch_borders(const BorderHalfedgeRange& boundary_cycle_representat
std::back_inserter(to_stitch), np);
res += stitch_halfedge_range(to_stitch, to_consider, pmesh, vpm, cycle_maintainer);

const auto& new_representatives = cycle_maintainer.cycle_representatives();

#ifdef CGAL_PMP_STITCHING_DEBUG
std::cout << "------- Stitched " << res << " halfedge pairs after cycles & general" << std::endl;
std::cout << "------- Stitch cycles (#2)... (" << new_representatives.size() << " cycle(s))" << std::endl;
#endif

const auto& new_representatives = cycle_maintainer.cycle_representatives();

// Don't care about keeping track of the sub-cycles as this is the last pass
internal::Dummy_cycle_rep_maintainer<PolygonMesh> dummy_cycle_maintainer(pmesh);
res += stitch_boundary_cycles(new_representatives, pmesh, dummy_cycle_maintainer, np);
Expand Down