20 #include <CGAL/Point_set_3/IO.h>
21 #include <CGAL/IO/write_ply_points.h>
22 #if 0 //ELO-note: doesn't compile, extra dependency needed
23 #include <CGAL/IO/write_las_points.h>
43 const std::string &filename,
50 std::ofstream out(filename);
53 throw std::invalid_argument(
54 "write_mesh() error: can not open output file " + filename);
64 success = CGAL::write_xyz_point_set(out, g);
71 success = CGAL::write_off_point_set(out, g);
76 using VertexNormalMap =
79 using VertexColorMap =
93 auto pm =
get(boost::vertex_point, g);
96 CGAL::set_ascii_mode(out);
99 if(has_normal && has_color)
102 success = CGAL::write_ply_points_with_properties(
105 CGAL::make_ply_point_writer(pm),
106 CGAL::make_ply_normal_writer(v_nm),
107 std::make_tuple(v_cm,
108 CGAL::PLY_property< unsigned char >(
"red"),
109 CGAL::PLY_property< unsigned char >(
"green"),
110 CGAL::PLY_property< unsigned char >(
"blue")));
115 success = CGAL::write_ply_points_with_properties(
118 CGAL::make_ply_point_writer(pm),
119 CGAL::make_ply_normal_writer(v_nm));
124 success = CGAL::write_ply_points_with_properties(
127 CGAL::make_ply_point_writer(pm),
128 std::make_tuple(v_cm,
129 CGAL::PLY_property< unsigned char >(
"red"),
130 CGAL::PLY_property< unsigned char >(
"green"),
131 CGAL::PLY_property< unsigned char >(
"blue")));
136 success = CGAL::write_ply_points_with_properties(
139 CGAL::make_ply_point_writer(pm));
142 #if 0 //ELO-note: doesn't compile, extra dependency needed
146 success = CGAL::write_las_points(out, points);
152 throw std::invalid_argument(
153 "write_mesh() error: failed to write mesh to file " + filename);