From 5dad6f0c71f1466983300c9cbaaefc8530f41501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 29 Oct 2018 15:04:06 +0100 Subject: [PATCH] take into account clipper orientation to clip open meshes --- .../include/CGAL/Polygon_mesh_processing/clip.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/clip.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/clip.h index d33dde326a2..b1ae69fd22c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/clip.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/clip.h @@ -29,6 +29,7 @@ #include #include #include +#include #include @@ -77,6 +78,10 @@ clip_open_impl( TriangleMesh& tm, Clipper_tree clipper_tree(clipper_triangles.begin(), clipper_triangles.end()); // predicate functor Side_of_triangle_mesh side_of(clipper_tree); + const bool clipper_outward_oriented = + CGAL::Polygon_mesh_processing::is_outward_oriented(clipper, np_c); + const CGAL::Bounded_side REGION_TO_REMOVE = clipper_outward_oriented + ? ON_UNBOUNDED_SIDE:ON_BOUNDED_SIDE; // Second corefine the meshes typedef CGAL::dynamic_edge_property_t Ecm_tag; @@ -131,7 +136,7 @@ clip_open_impl( TriangleMesh& tm, break; } if (no_marked_edge){ - if ( side_of( get(vpm1, target(h, tm) ) ) == ON_UNBOUNDED_SIDE ) + if ( side_of( get(vpm1, target(h, tm) ) ) == REGION_TO_REMOVE ) ccs_to_remove.push_back(cc_id); cc_not_handled.reset(cc_id); break; @@ -143,7 +148,7 @@ clip_open_impl( TriangleMesh& tm, if (cc_not_handled.any()) { - // A patch without no vertex incident to a non-constrained edges + // A patch with no vertex incident to a non-constrained edges // is a coplanar patch: drop it or keep it! if (!boost::choose_param(boost::get_param(np_tm, internal_np::use_compact_clipper), true)) {