From ff01ed7a5f78d2567462c1b7f6ece871a941b91a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 1 Mar 2019 14:20:29 +0100 Subject: [PATCH 01/10] better handling of border non-manifold vertices for the clipping --- .../Corefinement/Face_graph_output_builder.h | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index c9eed95cef6..fd3dbe0d874 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -1251,6 +1251,27 @@ public: FaceIdMap, Intersection_edge_map> Patches; + boost::unordered_set border_nm_vertices; // only used if used_to_clip_a_surface == true + if (used_to_clip_a_surface) + { + // special code to handle non-manifold vertices on the boundary + BOOST_FOREACH(halfedge_descriptor h, halfedges(tm1)) + { + if ( intersection_edges1.count(edge(h, tm1))==1 && is_border(h, tm1) ) + { + // check if the target of h is a non-manifold vertex + halfedge_descriptor nh = prev( opposite(h, tm1), tm1 ); + while (!is_border( opposite(nh, tm1), tm1 ) ) + { + nh = prev( opposite(nh, tm1), tm1 ); + } + nh = opposite(nh, tm1); + if (next(h, tm1) != nh) + border_nm_vertices.insert(target(h, tm1)); + } + } + } + //store the patch description in a container to avoid recomputing it several times Patches patches_of_tm1( tm1, tm1_patch_ids, fids1, intersection_edges1, nb_patches_tm1), patches_of_tm2( tm2, tm2_patch_ids, fids2, intersection_edges2, nb_patches_tm2); @@ -1600,6 +1621,77 @@ public: } } } + + // Code dedicated to the handling of non-manifold vertices + BOOST_FOREACH(vertex_descriptor vd, border_nm_vertices) + { + // first check if at least one incident patch will be kept + boost::unordered_set id_p_rm; + bool all_removed=true; + BOOST_FOREACH(halfedge_descriptor h, halfedges_around_target(vd, tm1)) + { + face_descriptor f = face(h, tm1); + if ( f != GT::null_face() ) + { + const std::size_t p_id = tm1_patch_ids[ get(fids1, f) ]; + if ( patches_to_remove.test(p_id) ) + id_p_rm.insert(p_id); + else + all_removed=false; + } + } + if (all_removed) + id_p_rm.erase(id_p_rm.begin()); + // remove the vertex from the interior vertices of patches to be removed + BOOST_FOREACH(std::size_t pid, id_p_rm) + patches_of_tm1[pid].interior_vertices.erase(vd); + + // we now need to update the next/prev relationship induced by the future removal of patches + if (!id_p_rm.empty()) + { + typedef std::pair Hedge_pair; + std::vector< Hedge_pair> hedges_to_link; + BOOST_FOREACH(halfedge_descriptor h, halfedges_around_target(vd, tm1)) + { + if ( is_border(h, tm1) && + !patches_to_remove.test( tm1_patch_ids[ get(fids1, face(opposite(h, tm1), tm1)) ] ) ) + { + halfedge_descriptor start = h; + + do{ + halfedge_descriptor nh = next(h, tm1); + CGAL_assertion( source(nh, tm1) == target(start, tm1) ); + if ( patches_to_remove.test( tm1_patch_ids[ get(fids1, face(opposite(nh, tm1), tm1)) ] ) ) + { + // we need to find a new next for h + do{ + nh = next( opposite( next(opposite(nh, tm1), tm1), tm1 ), tm1 ); + CGAL_assertion( source(nh, tm1) == target(start, tm1) ); + } + while ( !is_border(nh, tm1) || + !patches_to_remove.test( tm1_patch_ids[ get(fids1, face(opposite(nh, tm1), tm1)) ] ) ); + hedges_to_link.push_back( Hedge_pair(h, nh) ); + } + + // look for the next hedge to proceed + h = opposite( next( opposite(nh, tm1), tm1), tm1); + CGAL_assertion( target(h, tm1) == target(start, tm1) ); + while( !is_border(h, tm1) || + patches_to_remove.test( tm1_patch_ids[ get(fids1, face(opposite(h, tm1), tm1)) ] ) ) + { + h = opposite( next( h, tm1), tm1); + CGAL_assertion( target(h, tm1) == target(start, tm1) ); + } + } + while( h != start ); + break; + } + } + + BOOST_FOREACH ( const Hedge_pair& p, hedges_to_link) + set_next(p.first, p.second, tm1); + } + } } #define CGAL_COREF_FUNCTION_CALL_DEF(BO_type) \ From 0f078003c2106940f771580777bd09b80dc4a680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 1 Mar 2019 15:55:16 +0100 Subject: [PATCH 02/10] also handle non-manifold vertices at isolated nodes --- .../Corefinement/Face_graph_output_builder.h | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index fd3dbe0d874..93f5c082b6d 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -1255,20 +1255,22 @@ public: if (used_to_clip_a_surface) { // special code to handle non-manifold vertices on the boundary - BOOST_FOREACH(halfedge_descriptor h, halfedges(tm1)) + typedef std::pair V_and_id; + BOOST_FOREACH (const V_and_id& v_and_id, vertex_to_node_id1) { - if ( intersection_edges1.count(edge(h, tm1))==1 && is_border(h, tm1) ) + boost::optional op_h = is_border(v_and_id.first, tm1); + if (op_h == boost::none) continue; + halfedge_descriptor h = *op_h; + CGAL_assertion( target(h, tm1) == v_and_id.first); + // check if the target of h is a non-manifold vertex + halfedge_descriptor nh = prev( opposite(h, tm1), tm1 ); + while (!is_border( opposite(nh, tm1), tm1 ) ) { - // check if the target of h is a non-manifold vertex - halfedge_descriptor nh = prev( opposite(h, tm1), tm1 ); - while (!is_border( opposite(nh, tm1), tm1 ) ) - { - nh = prev( opposite(nh, tm1), tm1 ); - } - nh = opposite(nh, tm1); - if (next(h, tm1) != nh) - border_nm_vertices.insert(target(h, tm1)); + nh = prev( opposite(nh, tm1), tm1 ); } + nh = opposite(nh, tm1); + if (next(h, tm1) != nh) + border_nm_vertices.insert(target(h, tm1)); } } From a83dac38265bcf89e929b03d969230a775820e24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 1 Mar 2019 18:06:08 +0100 Subject: [PATCH 03/10] handle non-manifold vertices is patches to be removed because they are duplicated in interior_vertices --- .../Corefinement/Face_graph_output_builder.h | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index 93f5c082b6d..359da6361df 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -1254,23 +1254,29 @@ public: boost::unordered_set border_nm_vertices; // only used if used_to_clip_a_surface == true if (used_to_clip_a_surface) { - // special code to handle non-manifold vertices on the boundary - typedef std::pair V_and_id; - BOOST_FOREACH (const V_and_id& v_and_id, vertex_to_node_id1) + if (!is_tm1_closed) { - boost::optional op_h = is_border(v_and_id.first, tm1); - if (op_h == boost::none) continue; - halfedge_descriptor h = *op_h; - CGAL_assertion( target(h, tm1) == v_and_id.first); - // check if the target of h is a non-manifold vertex - halfedge_descriptor nh = prev( opposite(h, tm1), tm1 ); - while (!is_border( opposite(nh, tm1), tm1 ) ) + // \todo Note a loop over vertex_to_node_id1 would be sufficient + // if we merge the patch-id of patches to be removed (that way + // non-manifold vertices would not be duplicated in interior + // vertices of patche) + // special code to handle non-manifold vertices on the boundary + BOOST_FOREACH (vertex_descriptor vd, vertices(tm1)) { - nh = prev( opposite(nh, tm1), tm1 ); + boost::optional op_h = is_border(vd, tm1); + if (op_h == boost::none) continue; + halfedge_descriptor h = *op_h; + CGAL_assertion( target(h, tm1) == vd); + // check if the target of h is a non-manifold vertex + halfedge_descriptor nh = prev( opposite(h, tm1), tm1 ); + while (!is_border( opposite(nh, tm1), tm1 ) ) + { + nh = prev( opposite(nh, tm1), tm1 ); + } + nh = opposite(nh, tm1); + if (next(h, tm1) != nh) + border_nm_vertices.insert(target(h, tm1)); } - nh = opposite(nh, tm1); - if (next(h, tm1) != nh) - border_nm_vertices.insert(target(h, tm1)); } } From 9040b59cb8d8860b193da98f03cacbba802f1dec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 1 Mar 2019 18:06:54 +0100 Subject: [PATCH 04/10] workaround a case when the intersection polyline is not split the polyline goes from border to interior but the node is of degree 2 and the polyline is not split *************** * * * * * * -*---------*-*--- | * * | | * * | | ************* | | | | | | | |_________________| --- .../internal/Corefinement/Face_graph_output_builder.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index 359da6361df..0cc4826f72f 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -1103,8 +1103,9 @@ public: // triangle which is tangent at its 3 vertices // \todo improve this part which is not robust with a kernel // with inexact constructions. - Bounded_side position = inside_tm2(midpoint(get(vpm1, source(h, tm1)), - get(vpm1, target(h, tm1)) )); + Bounded_side position = inside_tm2(centroid(get(vpm1, source(h, tm1)), + get(vpm1, target(h, tm1)), + get(vpm1, target(next(h, tm1), tm1)) )); CGAL_assertion( position != ON_BOUNDARY); if ( position == in_tm2 ) is_patch_inside_tm2.set(patch_id); From 48bf1cbf05a71382bf4b33105107960319604fbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 2 Jul 2019 08:38:03 +0200 Subject: [PATCH 05/10] add tests --- .../Polygon_mesh_processing/test_pmp_clip.cpp | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp index d1c11f037dd..f1fa8acf529 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp @@ -6,6 +6,7 @@ #include #include +#include namespace PMP = CGAL::Polygon_mesh_processing; namespace params = PMP::parameters; @@ -283,6 +284,46 @@ void test() assert(is_valid_polygon_mesh(tm1)); CGAL::clear(tm1); CGAL::clear(tm2); + + // non-manifold border vertices + std::stringstream ss; + ss << "OFF\n 5 2 0\n 0 0 0\n2 0 0\n4 0 0\n4 1 0\n0 1 0\n3 0 1 4\n3 1 2 3\n"; + ss >> tm1; + PMP::clip(tm1, K::Plane_3(-1,0,0,2)); + assert(vertices(tm1).size()==3); + CGAL::clear(tm1); + + ss = std::stringstream(); + ss << "OFF\n 7 3 0\n 0 0 0\n2 0 0\n4 0 0\n4 1 0\n0 1 0\n3 1 0\n 1 1 0\n3 0 1 4\n3 1 2 3\n3 1 5 6\n"; + ss >> tm1; + PMP::clip(tm1, K::Plane_3(-1,0,0,2)); + assert(vertices(tm1).size()==6); + CGAL::clear(tm1); + + ss = std::stringstream(); + ss << "OFF\n 9 4 0\n 0 0 0\n2 0 0\n4 0 0\n4 1 0\n0 1 0\n3 1 0\n 1 1 0\n3 -1 0\n1 -1 0\n3 0 1 4\n3 1 2 3\n3 1 5 6\n3 1 8 7\n"; + ss >> tm1; + PMP::clip(tm1, K::Plane_3(-1,0,0,2)); + assert(vertices(tm1).size()==7); + CGAL::clear(tm1); + + ss = std::stringstream(); + ss << "OFF\n 9 4 0\n 0 0 0\n2 0 0\n4 0 0\n4 1 0\n0 1 0\n3 1 0\n 1 1 0\n3 -1 0\n1 -1 0\n3 0 1 4\n3 1 2 3\n3 1 5 6\n3 1 8 7\n"; + ss >> tm1; +std::ofstream("in.off") << tm1; + PMP::clip(tm1, K::Plane_3(0,1,0,0)); +std::ofstream("out.off") << tm1; + assert(vertices(tm1).size()==3); + CGAL::clear(tm1); + + ss = std::stringstream(); + ss << "OFF\n 9 4 0\n 0 0 0\n2 0 0\n4 0 0\n4 1 0\n0 1 0\n3 1 0\n 1 1 0\n3 -1 0\n1 -1 0\n3 0 1 4\n3 1 2 3\n3 1 5 6\n3 1 8 7\n"; + ss >> tm1; +std::ofstream("in.off") << tm1; + PMP::clip(tm1, K::Plane_3(0,-1,0,0)); +std::ofstream("out.off") << tm1; + assert(vertices(tm1).size()==7); + CGAL::clear(tm1); } int main() From 8d9abf367afa8c021fc08486e123428aec53a9ea Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 9 Jul 2019 14:00:41 +0200 Subject: [PATCH 06/10] Accept negative indicies in faces. --- Polyhedron_IO/include/CGAL/IO/OBJ_reader.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Polyhedron_IO/include/CGAL/IO/OBJ_reader.h b/Polyhedron_IO/include/CGAL/IO/OBJ_reader.h index 33c686dd471..2fa9404e4b0 100644 --- a/Polyhedron_IO/include/CGAL/IO/OBJ_reader.h +++ b/Polyhedron_IO/include/CGAL/IO/OBJ_reader.h @@ -48,7 +48,13 @@ read_OBJ( std::istream& input, faces.push_back( std::vector() ); while(iss >> i) { - faces.back().push_back(i-1); + if(i < 1) + { + faces.back().push_back(points.size()+i);//negative indices are relative references + } + else { + faces.back().push_back(i-1); + } iss.ignore(256, ' '); } } From f3697f1b2b320e4908e93c5caf3a9c3e2c499db5 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 9 Jul 2019 13:09:09 +0200 Subject: [PATCH 07/10] Move logging functions in the script to avoid having to ask for CGAL-I before it is set. --- .../autotest_cgal_with_ctest | 35 +++++++++++++++---- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/Scripts/developer_scripts/autotest_cgal_with_ctest b/Scripts/developer_scripts/autotest_cgal_with_ctest index cd954740e7d..51a130ad31b 100755 --- a/Scripts/developer_scripts/autotest_cgal_with_ctest +++ b/Scripts/developer_scripts/autotest_cgal_with_ctest @@ -35,6 +35,34 @@ export INSTALLATION_DIR="" export TESTSUITE_DIR="" USE_LATEST_UNZIPPED="" +# ---------------------------------------------------------------------------------------- +# Logging functions +# ---------------------------------------------------------------------------------------- +log() +{ + LOGFILE=${1} + shift + if [ -n "${CONSOLE_OUTPUT}" ]; then + printf "${*} ...\n" + fi + printf "\n-------------------------------------------------------\n" >> "${LOGFILE}" + printf " ${*} ...\n" >> "${LOGFILE}" + printf "\n-------------------------------------------------------\n" >> "${LOGFILE}" +} + +log_done() +{ + if [ -n "${CONSOLE_OUTPUT}" ]; then + printf \ + " done\n-------------------------------------------------------\n" + fi + printf "\n-------------------------------------------------------\n" >> "${1}" + printf " **DONE**\n" >> "${1}" + printf "\n-------------------------------------------------------\n" >> "${1}" +} + + + # ---------------------------------------------------------------------------------------- # Downloads the file "LATEST" whose contents indicates which release to test # ---------------------------------------------------------------------------------------- @@ -202,13 +230,6 @@ else exit 1 fi -if [ -n "${SCRIPTS_DIR}" ]; then - CGAL_DIR=`readlink "${CGAL_ROOT}/CGAL-git"` -else - CGAL_DIR=`readlink "${CGAL_ROOT}/CGAL-I"` -fi - -source "${CGAL_DIR}/${SCRIPTS_DIR}developer_scripts/log.sh" LOGS_DIR="${CGAL_ROOT}/AUTOTEST_LOGS" LOCK_FILE="${CGAL_ROOT}/autotest_cgal_with_cmake.lock" From f1e2bf702c0bec1dabf1b2789d00676ea38888f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 11 Jul 2019 09:38:23 +0200 Subject: [PATCH 08/10] improve code + make sure in tests that halfedges are correctly linked --- .../Corefinement/Face_graph_output_builder.h | 65 +++++++++++-------- .../Polygon_mesh_processing/test_pmp_clip.cpp | 21 +++--- 2 files changed, 49 insertions(+), 37 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index 0cc4826f72f..cc6f3305042 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -1656,47 +1656,58 @@ public: patches_of_tm1[pid].interior_vertices.erase(vd); // we now need to update the next/prev relationship induced by the future removal of patches - if (!id_p_rm.empty()) + // that will not be updated after patch removal + if (!all_removed && !id_p_rm.empty()) { typedef std::pair Hedge_pair; std::vector< Hedge_pair> hedges_to_link; - BOOST_FOREACH(halfedge_descriptor h, halfedges_around_target(vd, tm1)) + typename CGAL::Halfedge_around_target_iterator hit, end; + boost::tie(hit,end) = halfedges_around_target(vd, tm1); + halfedge_descriptor h_start=*hit; + for(; hit!=end; ++hit) { - if ( is_border(h, tm1) && - !patches_to_remove.test( tm1_patch_ids[ get(fids1, face(opposite(h, tm1), tm1)) ] ) ) + // look for a border halfedge incident to the non-manifold vertex that will not be + // removed. + if ( !is_border(*hit, tm1) || + patches_to_remove.test( tm1_patch_ids[ get(fids1, face(opposite(*hit, tm1), tm1)) ] ) ) { - halfedge_descriptor start = h; + continue; + } + // we have to fix only cases when the next halfedge is to be removed + halfedge_descriptor nh = next(*hit, tm1); + if ( !patches_to_remove.test( tm1_patch_ids[ get(fids1, face(opposite(nh, tm1), tm1)) ] ) ) + continue; - do{ - halfedge_descriptor nh = next(h, tm1); - CGAL_assertion( source(nh, tm1) == target(start, tm1) ); - if ( patches_to_remove.test( tm1_patch_ids[ get(fids1, face(opposite(nh, tm1), tm1)) ] ) ) + halfedge_descriptor h = *hit; + // we are now looking for a potential next candidate halfedge + do{ + ++hit; + if (hit == end) break; + //~ if ( *hit == h_start ){std::cout << " break\n"; break;} + if ( is_border(*hit, tm1) ) + { + if ( patches_to_remove.test( tm1_patch_ids[ get(fids1, face(opposite(*hit, tm1), tm1)) ] ) ) { - // we need to find a new next for h - do{ - nh = next( opposite( next(opposite(nh, tm1), tm1), tm1 ), tm1 ); - CGAL_assertion( source(nh, tm1) == target(start, tm1) ); + // we check if the next halfedge is a good next + nh = next(*hit, tm1); + if ( !patches_to_remove.test( tm1_patch_ids[ get(fids1, face(opposite(nh, tm1), tm1)) ] ) ) + { + hedges_to_link.push_back( Hedge_pair(h, nh) ); + break; } - while ( !is_border(nh, tm1) || - !patches_to_remove.test( tm1_patch_ids[ get(fids1, face(opposite(nh, tm1), tm1)) ] ) ); - hedges_to_link.push_back( Hedge_pair(h, nh) ); } - - // look for the next hedge to proceed - h = opposite( next( opposite(nh, tm1), tm1), tm1); - CGAL_assertion( target(h, tm1) == target(start, tm1) ); - while( !is_border(h, tm1) || - patches_to_remove.test( tm1_patch_ids[ get(fids1, face(opposite(h, tm1), tm1)) ] ) ) + else { - h = opposite( next( h, tm1), tm1); - CGAL_assertion( target(h, tm1) == target(start, tm1) ); + // we push-back the halfedge for the next round only if it was not the first + if (h != *cpp11::prev(hit)) + --hit; + break; } } - while( h != start ); - break; } + while(true); + if (hit == end) break; } - BOOST_FOREACH ( const Hedge_pair& p, hedges_to_link) set_next(p.first, p.second, tm1); } diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp index f1fa8acf529..f838466bd0d 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp @@ -294,34 +294,35 @@ void test() CGAL::clear(tm1); ss = std::stringstream(); - ss << "OFF\n 7 3 0\n 0 0 0\n2 0 0\n4 0 0\n4 1 0\n0 1 0\n3 1 0\n 1 1 0\n3 0 1 4\n3 1 2 3\n3 1 5 6\n"; + ss << "OFF\n 7 4 0\n 0 0 0\n2 0 0\n4 0 0\n4 1 0\n0 1 0\n3 1 0\n 1 1 0\n3 0 1 4\n3 1 2 3\n3 1 5 6\n3 1 3 5\n"; ss >> tm1; + CGAL::Euler::remove_face(halfedge(*CGAL::cpp11::prev(faces(tm1).end()),tm1),tm1); PMP::clip(tm1, K::Plane_3(-1,0,0,2)); assert(vertices(tm1).size()==6); CGAL::clear(tm1); ss = std::stringstream(); - ss << "OFF\n 9 4 0\n 0 0 0\n2 0 0\n4 0 0\n4 1 0\n0 1 0\n3 1 0\n 1 1 0\n3 -1 0\n1 -1 0\n3 0 1 4\n3 1 2 3\n3 1 5 6\n3 1 8 7\n"; + ss << "OFF\n 9 7 0\n 0 0 0\n2 0 0\n4 0 0\n4 1 0\n0 1 0\n3 1 0\n 1 1 0\n3 -1 0\n1 -1 0\n3 0 1 4\n3 1 2 3\n3 1 5 6\n3 1 8 7\n3 1 3 5\n3 1 6 4\n3 1 0 8\n"; ss >> tm1; + for (int i=0;i<3;++i) + CGAL::Euler::remove_face(halfedge(*CGAL::cpp11::prev(faces(tm1).end()),tm1),tm1); PMP::clip(tm1, K::Plane_3(-1,0,0,2)); assert(vertices(tm1).size()==7); CGAL::clear(tm1); ss = std::stringstream(); - ss << "OFF\n 9 4 0\n 0 0 0\n2 0 0\n4 0 0\n4 1 0\n0 1 0\n3 1 0\n 1 1 0\n3 -1 0\n1 -1 0\n3 0 1 4\n3 1 2 3\n3 1 5 6\n3 1 8 7\n"; + ss << "OFF\n 9 7 0\n 0 0 0\n2 0 0\n4 0 0\n4 1 0\n0 1 0\n3 1 0\n 1 1 0\n3 -1 0\n1 -1 0\n3 0 1 4\n3 1 2 3\n3 1 5 6\n3 1 8 7\n3 1 3 5\n3 1 6 4\n3 1 0 8\n"; ss >> tm1; -std::ofstream("in.off") << tm1; - PMP::clip(tm1, K::Plane_3(0,1,0,0)); -std::ofstream("out.off") << tm1; + for (int i=0;i<3;++i) + CGAL::Euler::remove_face(halfedge(*CGAL::cpp11::prev(faces(tm1).end()),tm1),tm1); PMP::clip(tm1, K::Plane_3(0,1,0,0)); assert(vertices(tm1).size()==3); CGAL::clear(tm1); ss = std::stringstream(); - ss << "OFF\n 9 4 0\n 0 0 0\n2 0 0\n4 0 0\n4 1 0\n0 1 0\n3 1 0\n 1 1 0\n3 -1 0\n1 -1 0\n3 0 1 4\n3 1 2 3\n3 1 5 6\n3 1 8 7\n"; + ss << "OFF\n 9 7 0\n 0 0 0\n2 0 0\n4 0 0\n4 1 0\n0 1 0\n3 1 0\n 1 1 0\n3 -1 0\n1 -1 0\n3 0 1 4\n3 1 2 3\n3 1 5 6\n3 1 8 7\n3 1 3 5\n3 1 6 4\n3 1 0 8\n"; ss >> tm1; -std::ofstream("in.off") << tm1; - PMP::clip(tm1, K::Plane_3(0,-1,0,0)); -std::ofstream("out.off") << tm1; + for (int i=0;i<3;++i) + CGAL::Euler::remove_face(halfedge(*CGAL::cpp11::prev(faces(tm1).end()),tm1),tm1); PMP::clip(tm1, K::Plane_3(0,-1,0,0)); assert(vertices(tm1).size()==7); CGAL::clear(tm1); } From 0ff0b41ac8abf8465d734ac9d300708ebfe43db3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 11 Jul 2019 12:24:05 +0200 Subject: [PATCH 09/10] remove unused code --- .../internal/Corefinement/Face_graph_output_builder.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index cc6f3305042..fbdda5cf665 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -1663,7 +1663,6 @@ public: std::vector< Hedge_pair> hedges_to_link; typename CGAL::Halfedge_around_target_iterator hit, end; boost::tie(hit,end) = halfedges_around_target(vd, tm1); - halfedge_descriptor h_start=*hit; for(; hit!=end; ++hit) { // look for a border halfedge incident to the non-manifold vertex that will not be @@ -1683,7 +1682,6 @@ public: do{ ++hit; if (hit == end) break; - //~ if ( *hit == h_start ){std::cout << " break\n"; break;} if ( is_border(*hit, tm1) ) { if ( patches_to_remove.test( tm1_patch_ids[ get(fids1, face(opposite(*hit, tm1), tm1)) ] ) ) From ae2b24207197dbc8cb6e69f5501236683790bb49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 12 Jul 2019 13:13:33 +0200 Subject: [PATCH 10/10] fix misleading indentation --- .../test/Polygon_mesh_processing/test_pmp_clip.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp index f838466bd0d..2ac68c4b346 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_clip.cpp @@ -314,7 +314,8 @@ void test() ss << "OFF\n 9 7 0\n 0 0 0\n2 0 0\n4 0 0\n4 1 0\n0 1 0\n3 1 0\n 1 1 0\n3 -1 0\n1 -1 0\n3 0 1 4\n3 1 2 3\n3 1 5 6\n3 1 8 7\n3 1 3 5\n3 1 6 4\n3 1 0 8\n"; ss >> tm1; for (int i=0;i<3;++i) - CGAL::Euler::remove_face(halfedge(*CGAL::cpp11::prev(faces(tm1).end()),tm1),tm1); PMP::clip(tm1, K::Plane_3(0,1,0,0)); + CGAL::Euler::remove_face(halfedge(*CGAL::cpp11::prev(faces(tm1).end()),tm1),tm1); + PMP::clip(tm1, K::Plane_3(0,1,0,0)); assert(vertices(tm1).size()==3); CGAL::clear(tm1); @@ -322,7 +323,8 @@ void test() ss << "OFF\n 9 7 0\n 0 0 0\n2 0 0\n4 0 0\n4 1 0\n0 1 0\n3 1 0\n 1 1 0\n3 -1 0\n1 -1 0\n3 0 1 4\n3 1 2 3\n3 1 5 6\n3 1 8 7\n3 1 3 5\n3 1 6 4\n3 1 0 8\n"; ss >> tm1; for (int i=0;i<3;++i) - CGAL::Euler::remove_face(halfedge(*CGAL::cpp11::prev(faces(tm1).end()),tm1),tm1); PMP::clip(tm1, K::Plane_3(0,-1,0,0)); + CGAL::Euler::remove_face(halfedge(*CGAL::cpp11::prev(faces(tm1).end()),tm1),tm1); + PMP::clip(tm1, K::Plane_3(0,-1,0,0)); assert(vertices(tm1).size()==7); CGAL::clear(tm1); }