From 44addb1f83bf5757b4efe6fe74cd867afd689975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 30 Nov 2018 09:56:33 +0100 Subject: [PATCH] two halfedges with the same target and source points are non-manifold --- .../Polygon_mesh_processing/stitch_borders.h | 6 ++++-- .../Polygon_mesh_processing/test_stitching.cpp | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h index 89a6af30e02..fc256aae135 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h @@ -110,13 +110,15 @@ collect_duplicated_stitchable_boundary_edges ++set_it->second.first; // increase the multiplicity if(set_it->second.first == 2) { + set_it->second.second = halfedge_pairs.size(); // set the id of the pair in the vector + halfedge_pairs.push_back( std::make_pair(set_it->first, he) ); if ( get(vpmap, source(he,pmesh))==get(vpmap, target(set_it->first,pmesh)) && get(vpmap, target(he,pmesh))==get(vpmap, source(set_it->first,pmesh)) ) { - set_it->second.second = halfedge_pairs.size(); // set the id of the pair in the vector - halfedge_pairs.push_back( std::make_pair(set_it->first, he) ); manifold_halfedge_pairs.push_back(true); } + else + manifold_halfedge_pairs.push_back(false); } else if ( set_it->second.first > 2 ) diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp index 14fc54b703e..2d34bf8b60f 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp @@ -59,6 +59,20 @@ void test_surface_mesh(const char* fname) std::cout << "OK\n"; } +void bug_test() +{ + typedef Epic K; + typedef K::Point_3 Point_3; + CGAL::Surface_mesh tm; + + CGAL::make_triangle(Point_3(0,0,0), Point_3(1,0,0), Point_3(0,1,0), tm); + CGAL::make_triangle(Point_3(0,0,0), Point_3(1,0,0), Point_3(0,1,0), tm); + CGAL::make_triangle(Point_3(0,0,0), Point_3(1,0,0), Point_3(0,1,0), tm); + CGAL::make_triangle(Point_3(0,0,0), Point_3(1,0,0), Point_3(0,1,0), tm); + + CGAL::Polygon_mesh_processing::stitch_borders(tm); +} + int main() { test_polyhedron("data_stitching/full_border.off"); @@ -88,6 +102,8 @@ int main() test_surface_mesh("data_stitching/non_manifold.off"); test_surface_mesh("data_stitching/non_manifold2.off"); + bug_test(); + return 0; }