mirror of https://github.com/CGAL/cgal
Merge pull request #8890 from afabri/PMP-stitch_deterministic-GF
PMP: Make stitch_borders() deterministic
This commit is contained in:
commit
6444b9a0d0
|
|
@ -111,6 +111,11 @@ struct HDS_edge {
|
||||||
i.halfedge():i.halfedge()->opposite());
|
i.halfedge():i.halfedge()->opposite());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
friend std::ostream& operator<<(std::ostream& os, const HDS_edge& e)
|
||||||
|
{
|
||||||
|
os << e.halfedge_;
|
||||||
|
return os;
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
Halfedge_handle halfedge_;
|
Halfedge_handle halfedge_;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -106,9 +106,9 @@ struct Default_halfedges_keeper
|
||||||
{
|
{
|
||||||
typedef typename boost::graph_traits<Mesh>::halfedge_descriptor halfedge_descriptor;
|
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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1025,9 +1025,9 @@ std::size_t zip_boundary_cycle(typename boost::graph_traits<PolygonMesh>::halfed
|
||||||
if(!hedges_to_stitch.empty())
|
if(!hedges_to_stitch.empty())
|
||||||
{
|
{
|
||||||
#ifdef CGAL_PMP_STITCHING_DEBUG_PP
|
#ifdef CGAL_PMP_STITCHING_DEBUG_PP
|
||||||
std::cout << hedges_to_stitch.size() " halfedge pairs to stitch on border containing:\n"
|
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)) << ")"
|
<< edge(bh, pmesh) << "\n\t" << source(bh, pmesh) << "\t(" << get(vpm, source(bh, pmesh)) << ")"
|
||||||
<< "\n\t" << target(h, pmesh) << "\t(" << get(vpm, target(h, pmesh)) << ")" << std::endl;
|
<< "\n\t" << target(bh, pmesh) << "\t(" << get(vpm, target(bh, pmesh)) << ")" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::size_t local_stitches = internal::stitch_halfedge_range(hedges_to_stitch, cycle_halfedges,
|
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);
|
std::back_inserter(to_stitch), np);
|
||||||
res += stitch_halfedge_range(to_stitch, to_consider, pmesh, vpm, cycle_maintainer);
|
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
|
#ifdef CGAL_PMP_STITCHING_DEBUG
|
||||||
std::cout << "------- Stitched " << res << " halfedge pairs after cycles & general" << std::endl;
|
std::cout << "------- Stitched " << res << " halfedge pairs after cycles & general" << std::endl;
|
||||||
std::cout << "------- Stitch cycles (#2)... (" << new_representatives.size() << " cycle(s))" << std::endl;
|
std::cout << "------- Stitch cycles (#2)... (" << new_representatives.size() << " cycle(s))" << std::endl;
|
||||||
#endif
|
#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
|
// 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);
|
internal::Dummy_cycle_rep_maintainer<PolygonMesh> dummy_cycle_maintainer(pmesh);
|
||||||
res += stitch_boundary_cycles(new_representatives, pmesh, dummy_cycle_maintainer, np);
|
res += stitch_boundary_cycles(new_representatives, pmesh, dummy_cycle_maintainer, np);
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,11 @@ namespace internal {
|
||||||
--*this;
|
--*this;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
friend std::ostream& operator<<(std::ostream& os, const Self& i)
|
||||||
|
{
|
||||||
|
return os << i.operator->();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -171,6 +176,11 @@ namespace internal {
|
||||||
{
|
{
|
||||||
return In_place_list_iterator<T,Alloc>(const_cast<T*>(node));
|
return In_place_list_iterator<T,Alloc>(const_cast<T*>(node));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
friend std::ostream& operator<<(std::ostream& os, const Self& i)
|
||||||
|
{
|
||||||
|
return os << i.operator->();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -189,6 +199,7 @@ template <class T, class Alloc>
|
||||||
return reinterpret_cast<std::size_t>(ptr)/ sizeof(T);
|
return reinterpret_cast<std::size_t>(ptr)/ sizeof(T);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue