From 32cbaf914b16f31a1bf2e325714601e5f1253a13 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 29 Apr 2016 17:14:02 +0200 Subject: [PATCH] edges incident to boundary cannot always be flipped --- .../Isotropic_remeshing/remesh_impl.h | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h index 684cc59a7d4..5ba602721ec 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h @@ -683,10 +683,10 @@ namespace internal { BOOST_FOREACH(edge_descriptor e, edges(mesh_)) { //only the patch edges are allowed to be flipped - halfedge_descriptor he = halfedge(e, mesh_); - if (!is_on_patch(he)) + if (!is_flip_allowed(e)) continue; + halfedge_descriptor he = halfedge(e, mesh_); vertex_descriptor va = source(he, mesh_); vertex_descriptor vb = target(he, mesh_); vertex_descriptor vc = target(next(he, mesh_), mesh_); @@ -1116,6 +1116,24 @@ private: return true;//we already checked we're not pinching a hole in the patch } + bool is_flip_allowed(const edge_descriptor& e) const + { + return is_flip_allowed(halfedge(e, mesh_)) + && is_flip_allowed(opposite(halfedge(e, mesh_), mesh_)); + } + + bool is_flip_allowed(const halfedge_descriptor& h) const + { + if (!is_on_patch(h)) + return false; + if (!is_on_patch_border(target(h, mesh_))) + return true; + if ( is_on_patch_border(next(h, mesh_)) + && is_on_patch_border(prev(opposite(h, mesh_), mesh_))) + return false; + return true; + } + bool collapse_does_not_invert_face(const halfedge_descriptor& h) const { vertex_descriptor vs = source(h, mesh_);