#include #include #include #include #include #include typedef CGAL::Simple_cartesian Kernel; typedef Kernel::Point_3 Point; typedef std::vector Face; int main(int argc, char** argv) { const std::string ply_file = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/colored_tetra.ply"); std::vector points; std::vector polygons; bool ok = CGAL::IO::read_PLY(ply_file, points, polygons); assert(ok); std::cout << points.size() << " points and " << polygons.size() << " polygons" << std::endl; if(argc == 0) assert(points.size() == 4 && polygons.size() == 4); points.clear(); polygons.clear(); std::string ply_string(ply_file); ok = CGAL::IO::read_PLY(ply_string, points, polygons); assert(ok); points.clear(); polygons.clear(); std::ifstream is(ply_file); ok = CGAL::IO::read_PLY(is, points, polygons); assert(ok); is.close(); points.clear(); polygons.clear(); is.open(ply_file, std::ios::binary); ok = CGAL::IO::read_PLY(is, points, polygons); assert(ok); is.close(); ok = CGAL::IO::write_PLY("tmp.ply", points, polygons); assert(ok); ok = CGAL::IO::write_polygon_soup("tmp.ply", points, polygons); assert(ok); std::ofstream os("tmp.ply"); CGAL::IO::set_binary_mode(os); ok = CGAL::IO::write_PLY(os, points, polygons); assert(ok); os.close(); std::vector pts_backup = points; std::vector pls_backup = polygons; points.clear(); polygons.clear(); ok = CGAL::IO::read_polygon_soup("tmp.ply", points, polygons); assert(ok); assert(points.size() == pts_backup.size()); for(std::size_t i=0; i