From 12eb3ff18cb70e95abf3ea85d85ef3c655ce402b Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 14 May 2025 15:00:44 +0100 Subject: [PATCH 1/5] PMP: Make stitch_borders deterministic --- .../include/CGAL/Polygon_mesh_processing/stitch_borders.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h index 343007a83b2..53a5217ca66 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h @@ -106,9 +106,9 @@ struct Default_halfedges_keeper { typedef typename boost::graph_traits::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; } }; From 9f0761fde4a9127e69b2db46c2e90ae3519070cd Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 14 May 2025 15:13:58 +0100 Subject: [PATCH 2/5] Make the debug out put work for Surface_mesh --- .../CGAL/Polygon_mesh_processing/stitch_borders.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h index 53a5217ca66..b31b62ae5da 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h @@ -1025,9 +1025,9 @@ std::size_t zip_boundary_cycle(typename boost::graph_traits::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, @@ -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 dummy_cycle_maintainer(pmesh); res += stitch_boundary_cycles(new_representatives, pmesh, dummy_cycle_maintainer, np); From 03734f4f18060fcc5e74cee1deaac5e3d709586f Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 14 May 2025 15:38:22 +0100 Subject: [PATCH 3/5] Add noop for operator<< for handles of a Polyhedron (and let's improve) --- .../CGAL/boost/graph/graph_traits_HalfedgeDS.h | 4 ++++ STL_Extension/include/CGAL/In_place_list.h | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/HalfedgeDS/include/CGAL/boost/graph/graph_traits_HalfedgeDS.h b/HalfedgeDS/include/CGAL/boost/graph/graph_traits_HalfedgeDS.h index 542d5a447f7..7413032092f 100644 --- a/HalfedgeDS/include/CGAL/boost/graph/graph_traits_HalfedgeDS.h +++ b/HalfedgeDS/include/CGAL/boost/graph/graph_traits_HalfedgeDS.h @@ -111,6 +111,10 @@ struct HDS_edge { i.halfedge():i.halfedge()->opposite()); } + friend std::ostream& operator<<(std::ostream& os, const HDS_edge& e) + { + return os; + } private: Halfedge_handle halfedge_; }; diff --git a/STL_Extension/include/CGAL/In_place_list.h b/STL_Extension/include/CGAL/In_place_list.h index 135fbe1d3c5..7db7f658fe5 100644 --- a/STL_Extension/include/CGAL/In_place_list.h +++ b/STL_Extension/include/CGAL/In_place_list.h @@ -111,6 +111,11 @@ namespace internal { --*this; return tmp; } + + friend std::ostream& operator<<(std::ostream& os, const Self& i) + { + return os; + } }; } @@ -171,6 +176,11 @@ namespace internal { { return In_place_list_iterator(const_cast(node)); } + + friend std::ostream& operator<<(std::ostream& os, const Self& i) + { + return os; + } }; @@ -189,6 +199,7 @@ template return reinterpret_cast(ptr)/ sizeof(T); } + } From 10fe2f56598914a74b174be58f590603949bef89 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 14 May 2025 15:52:18 +0100 Subject: [PATCH 4/5] output an address --- HalfedgeDS/include/CGAL/boost/graph/graph_traits_HalfedgeDS.h | 1 + STL_Extension/include/CGAL/In_place_list.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/HalfedgeDS/include/CGAL/boost/graph/graph_traits_HalfedgeDS.h b/HalfedgeDS/include/CGAL/boost/graph/graph_traits_HalfedgeDS.h index 7413032092f..2d44f8a0b72 100644 --- a/HalfedgeDS/include/CGAL/boost/graph/graph_traits_HalfedgeDS.h +++ b/HalfedgeDS/include/CGAL/boost/graph/graph_traits_HalfedgeDS.h @@ -113,6 +113,7 @@ struct HDS_edge { friend std::ostream& operator<<(std::ostream& os, const HDS_edge& e) { + os << e.halfedge_; return os; } private: diff --git a/STL_Extension/include/CGAL/In_place_list.h b/STL_Extension/include/CGAL/In_place_list.h index 7db7f658fe5..f454cde2e5f 100644 --- a/STL_Extension/include/CGAL/In_place_list.h +++ b/STL_Extension/include/CGAL/In_place_list.h @@ -114,6 +114,7 @@ namespace internal { friend std::ostream& operator<<(std::ostream& os, const Self& i) { + os << &*(i); return os; } }; @@ -179,6 +180,7 @@ namespace internal { friend std::ostream& operator<<(std::ostream& os, const Self& i) { + os << &*(i); return os; } }; From 556d33836f75a45294ae8ac92412d965713463fc Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 15 May 2025 07:43:26 +0200 Subject: [PATCH 5/5] Apply suggestions from code review Co-authored-by: Laurent Rineau --- STL_Extension/include/CGAL/In_place_list.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/STL_Extension/include/CGAL/In_place_list.h b/STL_Extension/include/CGAL/In_place_list.h index f454cde2e5f..4da76da6895 100644 --- a/STL_Extension/include/CGAL/In_place_list.h +++ b/STL_Extension/include/CGAL/In_place_list.h @@ -114,8 +114,7 @@ namespace internal { friend std::ostream& operator<<(std::ostream& os, const Self& i) { - os << &*(i); - return os; + return os << i.operator->(); } }; } @@ -180,8 +179,7 @@ namespace internal { friend std::ostream& operator<<(std::ostream& os, const Self& i) { - os << &*(i); - return os; + return os << i.operator->(); } };