Cleaned off the examples

The idea is to keep meaningful examples
-- A basic example using Surface_mesh with as few parameters as possible
-- A seam mesh using Polyhedron_3 with the default parameterizer (MVC)
-- A seam mesh using Surface_mesh with the LSCM parameterizer
-- An example with a fixed border parameterizer and using different border
   parameterizer
This commit is contained in:
Mael Rouxel-Labbé
2017-06-22 16:14:55 +02:00
parent 013e32d314
commit 8ffe7a5df2
7 changed files with 54 additions and 178 deletions
@@ -0,0 +1,47 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/boost/graph/Seam_mesh.h>
#include <CGAL/IO/Surface_mesh_parameterization/File_off.h>
#include <CGAL/parameterize.h>
#include <CGAL/Polygon_mesh_processing/measure.h>
#include <iostream>
#include <fstream>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_2 Point_2;
typedef Kernel::Point_3 Point_3;
typedef CGAL::Surface_mesh<Kernel::Point_3> SurfaceMesh;
typedef boost::graph_traits<SurfaceMesh>::vertex_descriptor vertex_descriptor;
typedef boost::graph_traits<SurfaceMesh>::halfedge_descriptor halfedge_descriptor;
typedef boost::graph_traits<SurfaceMesh>::face_descriptor face_descriptor;
int main(int argc, char * argv[])
{
std::ifstream in((argc>1) ? argv[1] : "data/three_peaks.off");
if(!in) {
std::cerr << "Problem loading the input data" << std::endl;
return 1;
}
SurfaceMesh sm;
in >> sm;
// An edge on the border
halfedge_descriptor hd = CGAL::Polygon_mesh_processing::longest_border(sm).first;
// The UV property map that holds the parameterized values
typedef SurfaceMesh::Property_map<vertex_descriptor, Point_2> UV_pmap;
UV_pmap uv_map = sm.add_property_map<vertex_descriptor, Point_2>("h:uv").first;
CGAL::parameterize(sm, hd, uv_map);
std::ofstream out("result.off");
CGAL::Parameterization::output_uvmap_to_off(sm, hd, uv_map, out);
return 0;
}