#include #include #include #include #include #include #include typedef CGAL::Simple_cartesian Kernel; typedef Kernel::Point_2 Point_2; typedef Kernel::Point_3 Point_3; typedef CGAL::Surface_mesh SurfaceMesh; typedef boost::graph_traits::vertex_descriptor vertex_descriptor; typedef boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef boost::graph_traits::face_descriptor face_descriptor; namespace SMP = CGAL::Surface_mesh_parameterization; int main(int argc, char** argv) { const std::string filename = (argc>1) ? argv[1] : CGAL::data_file_path("meshes/nefertiti.off"); SurfaceMesh sm; if(!CGAL::IO::read_polygon_mesh(filename, sm)) { std::cerr << "Invalid input file." << std::endl; return EXIT_FAILURE; } // a halfedge on the border halfedge_descriptor bhd = CGAL::Polygon_mesh_processing::longest_border(sm).first; // The UV property map that holds the parameterized values typedef SurfaceMesh::Property_map UV_pmap; UV_pmap uv_map = sm.add_property_map("h:uv").first; SMP::parameterize(sm, bhd, uv_map); std::ofstream out("result.off"); SMP::IO::output_uvmap_to_off(sm, bhd, uv_map, out); return EXIT_SUCCESS; }