From adcfc0099691690f5dd4d55e3eeff2a200bf59e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 10 Jul 2017 10:35:31 +0200 Subject: [PATCH] do not block the fixing when there is a non-manifold situation Note that is might pose pb in case the status of the patch is changed in another case --- .../Polygon_mesh_processing/corefinement.h | 7 +++-- .../Output_builder_for_autorefinement.h | 30 +++++++++---------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h index 3202ef4c94c..8c186346a2b 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h @@ -737,17 +737,18 @@ corefine_and_compute_difference( TriangleMesh& tm1, /** * \ingroup PMP_corefinement_grp - * Remove self-intersections in `tm` by \link autoref_def_subsec autorefining \endlink `tm`, + * Removes self-intersections in `tm` by \link autoref_def_subsec autorefining \endlink `tm`, * removing extra patches, and stitching autointersection edges. * Self-intersection edges will be marked as constrained. If an edge that was marked as * constrained is split, its sub-edges will be marked as constrained as well. + * \return `true` if all self-intersections were fixed and `false` otherwise. * * @tparam TriangleMesh a model of `MutableFaceGraph`, `HalfedgeListGraph` and `FaceListGraph` * @tparam NamedParameters a sequence of \ref namedparameters * * @param tm input triangulated surface mesh * @param np optional sequence of \ref namedparameters among the ones listed below - + * * \cgalNamedParamsBegin * \cgalParamBegin{vertex_point_map} * the property map with the points associated to the vertices of `tm`. @@ -806,7 +807,7 @@ corefine_and_compute_difference( TriangleMesh& tm1, functor(CGAL::Emptyset_iterator(), true); - return !ob.impossible_operation(); + return ob.all_self_intersection_fixed(); } // overload with default named parameters diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Output_builder_for_autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Output_builder_for_autorefinement.h index 54c408c1ff8..fdf8cfe62e2 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Output_builder_for_autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Output_builder_for_autorefinement.h @@ -113,7 +113,7 @@ class Output_builder_for_autorefinement // constant const Node_id NID; // boolean indicating if there is an ambiguous or non-manifold situation - bool m_impossible_operation; + bool all_fixed; // for mapping an edge per polyline per triangle mesh An_edge_per_polyline_map an_edge_per_polyline; // To collect all intersection edges @@ -167,10 +167,10 @@ public: , is_tm_closed( is_closed(tm)) , is_tm_inside_out( is_tm_closed && !PMP::is_outward_oriented(tm) ) , NID(-1) - , m_impossible_operation(false) + , all_fixed(true) {} - bool impossible_operation() const { return m_impossible_operation; } + bool all_self_intersection_fixed() const { return all_fixed; } // functions called by the intersection visitor void start_new_polyline(Node_id i, Node_id j) @@ -375,23 +375,23 @@ public: if ( is_border(h1,tm) == is_border(h2,tm) ) { //Nothing allowed - m_impossible_operation = true; - return; + all_fixed = false; + continue; } } else { //Ambiguous, we can do nothing - m_impossible_operation = true; - return; + all_fixed = false; + continue; } } else if ( is_border_edge(h2,tm) ) { //Ambiguous, we do nothing - m_impossible_operation = true; - return; + all_fixed = false; + continue; } else { @@ -617,8 +617,8 @@ public: if ( is_dangling_edge(ids.first, ids.second, h1, tm, is_node_of_degree_one) || is_dangling_edge(ids.first, ids.second, h2, tm, is_node_of_degree_one) ) { - m_impossible_operation = true; - return; + all_fixed = false; + continue; } patches_to_keep.reset(patch_id_p2); patches_to_keep.reset(patch_id_q1); @@ -632,8 +632,8 @@ public: if ( is_dangling_edge(ids.first, ids.second, h1, tm, is_node_of_degree_one) || is_dangling_edge(ids.first, ids.second, h2, tm, is_node_of_degree_one) ) { - m_impossible_operation = true; - return; + all_fixed = false; + continue; } patches_to_keep.reset(patch_id_q2); patches_to_keep.reset(patch_id_p1); @@ -648,8 +648,8 @@ public: nodes); if (!p1_is_between_q1q2){ //case (e4) - m_impossible_operation = true; - return; + all_fixed = false; + continue; } else{ //case (f4)