diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_is_polygon_soup_a_polygon_mesh.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_is_polygon_soup_a_polygon_mesh.cpp index edfc4802110..49a5d17b807 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_is_polygon_soup_a_polygon_mesh.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_is_polygon_soup_a_polygon_mesh.cpp @@ -1,7 +1,12 @@ -#include #include #include +#include +#include +#include + +#include +#include #include #include #include @@ -34,28 +39,45 @@ void test_polygon_soup(std::string fname, bool expected) exit(EXIT_FAILURE); } - bool is_mesh = CGAL::Polygon_mesh_processing::is_polygon_soup_a_polygon_mesh(polygons); std::cout << "is_polygon_soup_a_polygon_mesh(" << fname << ") == " << std::boolalpha << is_mesh << ";" << std::endl; assert(is_mesh == expected); - if(is_mesh) { + if(is_mesh) + { Polyhedron p; - CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(points, polygons, p); - assert(p.is_valid()); + + // just to test the named paramers + typedef std::pair Point_with_Boolean; + std::vector points_with_pairs; + for(const typename K::Point_3& pt : points) + points_with_pairs.emplace_back(pt, false); + + typedef typename CGAL::GetVertexPointMap::type VPM; + VPM vpm = get_property_map(CGAL::vertex_point, p); + + CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh( + points_with_pairs, polygons, p, + CGAL::parameters::point_map(CGAL::First_of_pair_property_map()), + CGAL::parameters::vertex_point_map(vpm)); + + std::cout << num_vertices(p) << " nv and " << num_faces(p) << " nf" << std::endl; + assert(!CGAL::is_empty(p) && CGAL::is_valid_polygon_mesh(p)); } - if(!expected) { + if(!expected) + { CGAL::Polygon_mesh_processing::orient_polygon_soup(points, polygons); bool is_mesh = CGAL::Polygon_mesh_processing::is_polygon_soup_a_polygon_mesh(polygons); std::cout << "After orientation: is_polygon_soup_a_polygon_mesh(" << fname << ") == " << std::boolalpha << is_mesh << ";" << std::endl; if(is_mesh) { - Polyhedron p; - CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(points, polygons, p); - assert(p.is_valid()); + Polyhedron p; + CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(points, polygons, p); + std::cout << num_vertices(p) << " nv and " << num_faces(p) << " nf" << std::endl; + assert(!CGAL::is_empty(p) && CGAL::is_valid_polygon_mesh(p)); } }