I/O Functions for the Object File Format (OFF) .

template<typename Graph , typename NamedParameters >
bool CGAL::IO::read_OFF (std::istream &is, Graph &g, const NamedParameters &np)
reads the graph `g`

from data in the input stream, using the Object File Format (OFF) . More...
template<typename Graph , typename NamedParameters >
bool CGAL::IO::read_OFF (const std::string &fname, Graph &g, const NamedParameters &np)
reads the graph `g`

from the file `fname`

, using the Object File Format (OFF) . More...
template<typename Graph , typename NamedParameters >
bool CGAL::IO::write_OFF (std::ostream &os, const Graph &g, const NamedParameters &np)
writes the graph `g`

in the output stream, using the Object File Format (OFF) . More...
template<typename Graph , typename NamedParameters >
bool CGAL::IO::write_OFF (const std::string &fname, const Graph &g, const NamedParameters &np)
writes the graph `g`

in the file `fname`

, using the Object File Format (OFF) . More...

◆ read_OFF() [1/2]
template<typename Graph , typename NamedParameters >

bool CGAL::IO::read_OFF
(
std::istream &
is ,
Graph &
g ,
const NamedParameters &
np
)

`#include <CGAL/boost/graph/IO/OFF.h>`

reads the graph `g`

from data in the input stream, using the Object File Format (OFF) .

The data is expected to represent a 2-manifold (possibly with borders).

This function reads the point property as well as vertex normals (NOFF), vertex and face colors (COFF), and texture vertex coordinates (TOFF). Those properties are stored in property maps that are passed through named parameters (see below), when passed.

Ignores comment lines which start with a hash, and lines with whitespace.

Attention The graph `g`

is not cleared, and the data from the stream are appended.
Template Parameters
Parameters
is the input stream
g the graph to be built from the input data
np optional Named Parameters described below

Optional Named Parameters
vertex_point_map
a property map associating points to the vertices of `g`

Type: a class model of WritablePropertyMap

with `boost::graph_traits<Graph>::vertex_descriptor`

as key type and `Point_3`

as value type
Default: `boost::get(CGAL::vertex_point, g)`

Extra: If this parameter is omitted, an internal property map for CGAL::vertex_point_t

must be available in `Graph`

.

vertex_normal_map
a property map associating normals to the vertices of `g`

Type: a class model of WritablePropertyMap

with `boost::graph_traits<Graph>::vertex_descriptor`

as key type and `Vector_3`

as value type
Default: vertex normals that may exist in the input will be ignored

vertex_color_map
a property map associating colors to the vertices of `g`

Type: a class model of WritablePropertyMap

with `boost::graph_traits<Graph>::vertex_descriptor`

as key type and CGAL::IO::Color

as value type
Default: vertex colors that may exist in the input will be ignored

vertex_texture_map
a property map associating textures to the vertices of `g`

Type: a class model of WritablePropertyMap

with `boost::graph_traits<Graph>::vertex_descriptor`

as key type and `Point_2`

as value type
Default: vertex textures that may exist in the input will be ignored

face_color_map
a property map associating colors to the faces of `g`

Type: a class model of WritablePropertyMap

with `boost::graph_traits<Graph>::face_descriptor`

as key type and CGAL::IO::Color

as value type
Default: face colors that may exist in the input will be ignored

verbose
whether extra information is printed when an incident occurs during reading
Type: Boolean
Default: `false`

Returns `true`

if reading was successful and the resulting mesh is valid, `false`

otherwise.
See also Overloads of this function for specific models of the concept FaceGraph

.
◆ read_OFF() [2/2]
template<typename Graph , typename NamedParameters >

bool CGAL::IO::read_OFF
(
const std::string &
fname ,
Graph &
g ,
const NamedParameters &
np
)

`#include <CGAL/boost/graph/IO/OFF.h>`

reads the graph `g`

from the file `fname`

, using the Object File Format (OFF) .

The data is expected to represent a 2-manifold (possibly with borders).

This function reads the point property as well as vertex normals (NOFF), vertex and face colors (COFF), and texture vertex coordinates (TOFF). Those properties are stored in property maps that are passed through named parameters (see below), when passed.

Ignores comment lines which start with a hash, and lines with whitespace.

Attention The graph `g`

is not cleared, and the data from the file are appended.
Template Parameters
Parameters
fname the name of the input file
g the graph to be built from the input data
np optional Named Parameters described below

Optional Named Parameters
vertex_point_map
a property map associating points to the vertices of `g`

Type: a class model of WritablePropertyMap

with `boost::graph_traits<Graph>::vertex_descriptor`

as key type and `Point_3`

as value type
Default: `boost::get(CGAL::vertex_point, g)`

Extra: If this parameter is omitted, an internal property map for CGAL::vertex_point_t

must be available in `Graph`

.

vertex_normal_map
a property map associating normals to the vertices of `g`

Type: a class model of WritablePropertyMap

with `boost::graph_traits<Graph>::vertex_descriptor`

as key type and `Vector_3`

as value type
Default: vertex normals that may exist in the input will be ignored

vertex_color_map
a property map associating colors to the vertices of `g`

Type: a class model of WritablePropertyMap

with `boost::graph_traits<Graph>::vertex_descriptor`

as key type and CGAL::IO::Color

as value type
Default: vertex colors that may exist in the input will be ignored

vertex_texture_map
a property map associating textures to the vertices of `g`

Type: a class model of WritablePropertyMap

with `boost::graph_traits<Graph>::vertex_descriptor`

as key type and `Point_2`

as value type
Default: vertex textures that may exist in the input will be ignored

face_color_map
a property map associating colors to the faces of `g`

Type: a class model of WritablePropertyMap

with `boost::graph_traits<Graph>::face_descriptor`

as key type and CGAL::IO::Color

as value type
Default: face colors that may exist in the input will be ignored

verbose
whether extra information is printed when an incident occurs during reading
Type: Boolean
Default: `false`

Returns `true`

if reading was successful and the resulting mesh is valid, `false`

otherwise.
See also Overloads of this function for specific models of the concept FaceGraph

.
◆ write_OFF() [1/2]
template<typename Graph , typename NamedParameters >

bool CGAL::IO::write_OFF
(
std::ostream &
os ,
const Graph &
g ,
const NamedParameters &
np
)

`#include <CGAL/boost/graph/IO/OFF.h>`

writes the graph `g`

in the output stream, using the Object File Format (OFF) .

Template Parameters
Parameters
os the output stream
g the graph to be written
np optional Named Parameters described below

Optional Named Parameters
vertex_point_map
a property map associating points to the vertices of `g`

Type: a class model of ReadablePropertyMap

with `boost::graph_traits<Graph>::vertex_descriptor`

as key type and `Point_3`

as value type
Default: `boost::get(CGAL::vertex_point, g)`

Extra: If this parameter is omitted, an internal property map for CGAL::vertex_point_t

must be available in `Graph`

.

vertex_normal_map
a property map associating normals to the vertices of `g`

Type: a class model of ReadablePropertyMap

with `boost::graph_traits<Graph>::vertex_descriptor`

as key type and `Vector_3`

as value type
Default: no vertex normals in the output

vertex_color_map
a property map associating colors to the vertices of `g`

Type: a class model of ReadablePropertyMap

with `boost::graph_traits<Graph>::vertex_descriptor`

as key type and CGAL::IO::Color

as value type
Default: no vertex colors in the output

vertex_texture_map
a property map associating textures to the vertices of `g`

Type: a class model of ReadablePropertyMap

with `boost::graph_traits<Graph>::vertex_descriptor`

as key type and `Point_2`

as value type
Default: no vertex textures in the output

face_color_map
a property map associating colors to the faces of `g`

Type: a class model of ReadablePropertyMap

with `boost::graph_traits<Graph>::face_descriptor`

as key type and CGAL::IO::Color

as value type
Default: no face colors in the output

stream_precision
a parameter used to set the precision (i.e. how many digits are generated) of the output stream
Type: int
Default: `the precision of the stream`

os``

Returns `true`

if writing was successful, `false`

otherwise.
See also Overloads of this function for specific models of the concept FaceGraph

.
◆ write_OFF() [2/2]
template<typename Graph , typename NamedParameters >

bool CGAL::IO::write_OFF
(
const std::string &
fname ,
const Graph &
g ,
const NamedParameters &
np
)

`#include <CGAL/boost/graph/IO/OFF.h>`

writes the graph `g`

in the file `fname`

, using the Object File Format (OFF) .

Template Parameters
Parameters
fname the name of the output file
g the graph to be written
np optional Named Parameters described below

Optional Named Parameters
vertex_point_map
a property map associating points to the vertices of `g`

Type: a class model of ReadablePropertyMap

with `boost::graph_traits<Graph>::vertex_descriptor`

as key type and `Point_3`

as value type
Default: `boost::get(CGAL::vertex_point, g)`

Extra: If this parameter is omitted, an internal property map for CGAL::vertex_point_t

must be available in `Graph`

.

vertex_normal_map
a property map associating normals to the vertices of `g`

Type: a class model of ReadablePropertyMap

with `boost::graph_traits<Graph>::vertex_descriptor`

as key type and `Vector_3`

as value type
Default: no vertex normals in the output

vertex_color_map
a property map associating colors to the vertices of `g`

Type: a class model of ReadablePropertyMap

with `boost::graph_traits<Graph>::vertex_descriptor`

as key type and CGAL::IO::Color

as value type
Default: no vertex colors in the output

vertex_texture_map
a property map associating textures to the vertices of `g`

Type: a class model of ReadablePropertyMap

with `boost::graph_traits<Graph>::vertex_descriptor`

as key type and `Point_2`

as value type
Default: no vertex textures in the output

face_color_map
a property map associating colors to the faces of `g`

Type: a class model of ReadablePropertyMap

with `boost::graph_traits<Graph>::face_descriptor`

as key type and CGAL::IO::Color

as value type
Default: no face colors in the output

stream_precision
a parameter used to set the precision (i.e. how many digits are generated) of the output stream
Type: int
Default: `6`

Returns `true`

if writing was successful, `false`

otherwise.
See also Overloads of this function for specific models of the concept FaceGraph

.