Add test-case for overloads of triangulate_faces

This commit is contained in:
Philipp Möller 2015-12-11 16:00:31 +01:00
parent 0f12d0189e
commit e54cfb6492
2 changed files with 42 additions and 0 deletions

View File

@ -78,6 +78,7 @@ if (EIGEN3_FOUND)
create_single_source_cgal_program("test_pmp_bgl_named_params.cpp")
create_single_source_cgal_program("remeshing_test.cpp" )
create_single_source_cgal_program("measures_test.cpp")
create_single_source_cgal_program("triangulate_faces_test.cpp")
if(NOT (${EIGEN3_VERSION} VERSION_LESS 3.2.0))
create_single_source_cgal_program("fairing_test.cpp")

View File

@ -0,0 +1,41 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
#include <CGAL/Polygon_mesh_processing/triangulate_faces.h>
#include <boost/foreach.hpp>
#include <fstream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::Point_3 Point;
typedef CGAL::Surface_mesh<Point> Surface_mesh;
int main()
{
Surface_mesh mesh;
std::ifstream input("data/elephant.off");
if (!input || !(input >> mesh) || mesh.is_empty())
{
std::cerr << "Not a valid off file." << std::endl;
return 1;
}
CGAL::Polygon_mesh_processing::triangulate_faces(mesh);
CGAL::Polygon_mesh_processing::triangulate_faces(mesh,
CGAL::Polygon_mesh_processing::parameters::all_default());
CGAL::Polygon_mesh_processing::triangulate_faces(faces(mesh), mesh);
CGAL::Polygon_mesh_processing::triangulate_faces(faces(mesh), mesh,
CGAL::Polygon_mesh_processing::parameters::all_default());
BOOST_FOREACH(boost::graph_traits<Surface_mesh>::face_descriptor fit, faces(mesh))
if (next(next(halfedge(fit, mesh), mesh), mesh)
!= prev(halfedge(fit, mesh), mesh)) {
CGAL::Polygon_mesh_processing::triangulate_face(fit, mesh);
CGAL::Polygon_mesh_processing::triangulate_face(fit, mesh,
CGAL::Polygon_mesh_processing::parameters::all_default());
}
}