Merge pull request #3499 from sloriot/PMP-stitching_nm_bug

Fix for stitching (4.12)
This commit is contained in:
Laurent Rineau 2018-12-19 15:44:45 +01:00
commit b53a562e89
2 changed files with 20 additions and 2 deletions

View File

@ -110,13 +110,15 @@ collect_duplicated_stitchable_boundary_edges
++set_it->second.first; // increase the multiplicity ++set_it->second.first; // increase the multiplicity
if(set_it->second.first == 2) 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)) && 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)) ) 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); manifold_halfedge_pairs.push_back(true);
} }
else
manifold_halfedge_pairs.push_back(false);
} }
else else
if ( set_it->second.first > 2 ) if ( set_it->second.first > 2 )

View File

@ -59,6 +59,20 @@ void test_surface_mesh(const char* fname)
std::cout << "OK\n"; std::cout << "OK\n";
} }
void bug_test()
{
typedef Epic K;
typedef K::Point_3 Point_3;
CGAL::Surface_mesh<Point_3> 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() int main()
{ {
test_polyhedron<Epec>("data_stitching/full_border.off"); test_polyhedron<Epec>("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_manifold.off");
test_surface_mesh("data_stitching/non_manifold2.off"); test_surface_mesh("data_stitching/non_manifold2.off");
bug_test();
return 0; return 0;
} }