add minimal example and fix compilation

This commit is contained in:
Jane Tournois 2021-09-13 10:56:30 +02:00
parent b26818c023
commit ff0425db2e
3 changed files with 38 additions and 1 deletions

View File

@ -72,6 +72,7 @@ create_single_source_cgal_program( "mesh_slicer_example.cpp")
#create_single_source_cgal_program( "remove_degeneracies_example.cpp")
create_single_source_cgal_program("isotropic_remeshing_example.cpp")
create_single_source_cgal_program("isotropic_remeshing_of_patch_example.cpp")
create_single_source_cgal_program("tangential_relaxation_example.cpp")
create_single_source_cgal_program("surface_mesh_intersection.cpp")
create_single_source_cgal_program("corefinement_SM.cpp")
create_single_source_cgal_program("corefinement_consecutive_bool_op.cpp")

View File

@ -0,0 +1,36 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Polygon_mesh_processing/tangential_relaxation.h>
#include <CGAL/Polygon_mesh_processing/IO/polygon_mesh_io.h>
#include <fstream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Surface_mesh<K::Point_3> Mesh;
namespace PMP = CGAL::Polygon_mesh_processing;
int main(int argc, char* argv[])
{
const char* filename = (argc > 1) ? argv[1] : "data/elephant.off";
Mesh mesh;
if(!PMP::IO::read_polygon_mesh(filename, mesh) || !CGAL::is_triangle_mesh(mesh))
{
std::cerr << "Invalid input." << std::endl;
return 1;
}
double target_edge_length = (argc > 2) ? std::stod(std::string(argv[2])) : 0.04;
unsigned int nb_iter = 3;
std::cout << "Relax...";
PMP::tangential_relaxation(mesh);
std::cout << "done." << std::endl;
return 0;
}

View File

@ -272,7 +272,7 @@ void tangential_relaxation(TriangleMesh& tm, const NamedParameters& np)
template <class TriangleMesh>
void tangential_relaxation(TriangleMesh& tm)
{
triangle(tm, parameters::all_default());
tangential_relaxation(tm, parameters::all_default());
}
} } // CGAL::Polygon_mesh_processing