// 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 #include #include namespace CGAL { template bool read_OFF( std::istream& in, std::vector< Point_3 >& points, std::vector< Polygon_3 >& polygons, bool /* verbose */ = false) { return OFF_internal::read_OFF(in, points, polygons); } 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) { return OFF_internal::read_OFF(in, points, polygons, fcolors, vcolors); } template 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 < end; ++i) { const Point_3& p = points[i]; writer.write_vertex( p.x(), p.y(), p.z() ); } writer.write_facet_header(); for(std::size_t i = 0, end = polygons.size(); i < end; ++i) { Polygon_3& polygon = polygons[i]; const std::size_t size = polygon.size(); writer.write_facet_begin(size); for(std::size_t j = 0; j < size; ++j) { writer.write_facet_vertex_index(polygon[j]); } writer.write_facet_end(); } writer.write_footer(); return (bool) out; } } // namespace CGAL #endif // CGAL_IO_OFF_H