// Copyright (c) 2015 GeometryFactory // // This file is part of CGAL (www.cgal.org); // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : Laurent Rineau and Sebastien Loriot #ifndef CGAL_IO_OFF_H #define CGAL_IO_OFF_H #include #include #include #include #include #include #include #include namespace CGAL { //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// /// Read /*! * \ingroup IOstreamFunctions * * reads the content of `in` into `points` and `polygons`, in the COFF format. * * \see \ref IOStreamOFF */ template bool read_OFF(std::istream& in, std::vector< Point_3 >& points, std::vector< Polygon_3 >& polygons, std::vector& fcolors, std::vector& vcolors, bool /* verbose */ = false) { CGAL::File_scanner_OFF scanner(in); points.resize(scanner.size_of_vertices()); polygons.resize(scanner.size_of_facets()); if(scanner.has_colors()) vcolors.resize(scanner.size_of_vertices()); for(std::size_t i=0; i> ci) { has_fcolors = true; fcolors.resize(scanner.size_of_facets()); std::istringstream iss2(col); fcolors[i] = scanner.get_color_from_line(iss2); } } else if(has_fcolors) { unsigned char r=0, g=0, b=0; scanner.scan_color(r,g,b); fcolors[i] = Color_rgb(r,g,b); } } return in.good(); } /*! * \ingroup IOstreamFunctions * * reads the content of `in` into `points` and `polygons`, in the OFF format. * * \see \ref IOStreamOFF */ template bool read_OFF(std::istream& in, std::vector< Point_3 >& points, std::vector< Polygon_3 >& polygons, bool /* verbose */ = false) { CGAL::File_scanner_OFF scanner(in); points.resize(scanner.size_of_vertices()); polygons.resize(scanner.size_of_facets()); for(std::size_t i=0; i bool write_OFF(std::ostream& out, std::vector< Point_3 >& points, std::vector< Polygon_3 >& polygons) { CGAL::File_writer_OFF writer; writer.write_header(out, points.size(), 0, polygons.size()); for(std::size_t i = 0, end = points.size(); i