I/O Functions for the STereoLithography (STL) File Format .
template<typename Graph , typename NamedParameters >
bool CGAL::IO::read_STL (std::istream &is, Graph &g, const NamedParameters &np)
reads the graph g
from the input stream, using the STereoLithography (STL) File Format . More...
template<typename Graph , typename NamedParameters >
bool CGAL::IO::read_STL (const std::string &fname, Graph &g, const NamedParameters &np)
reads the graph g
from the file fname
, using the STereoLithography (STL) File Format . More...
template<typename Graph , typename NamedParameters >
bool CGAL::IO::write_STL (std::ostream &os, const Graph &g, const NamedParameters &np)
writes the graph g
in the output stream os
, using the STereoLithography (STL) File Format . More...
template<typename Graph , typename NamedParameters >
bool CGAL::IO::write_STL (const std::string &fname, const Graph &g, const NamedParameters &np)
writes the graph g
into a file named fname
, using the STereoLithography (STL) File Format . More...
◆ read_STL() [1/2]
template<typename Graph , typename NamedParameters >
bool CGAL::IO::read_STL
(
std::istream &
is ,
Graph &
g ,
const NamedParameters &
np
)
#include <CGAL/boost/graph/IO/STL.h>
reads the graph g
from the input stream, using the STereoLithography (STL) File Format .
The data is expected to represent a 2-manifold (possibly with borders).
Attention The graph g
is not cleared, and the data from the stream are appended.
When reading a binary file, the flag std::ios::binary
flag must be set during the creation of the ifstream
.
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
.
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_STL() [2/2]
template<typename Graph , typename NamedParameters >
bool CGAL::IO::read_STL
(
const std::string &
fname ,
Graph &
g ,
const NamedParameters &
np
)
#include <CGAL/boost/graph/IO/STL.h>
reads the graph g
from the file fname
, using the STereoLithography (STL) File Format .
The data is expected to represent a 2-manifold (possibly with borders). If use_binary_mode
is true
, but the reading fails, ASCII reading will be automatically tested.
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
use_binary_mode
indicates whether data should be read in binary (true
) or in ASCII (false
)
Type: Boolean
Default: true
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
.
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_STL() [1/2]
template<typename Graph , typename NamedParameters >
bool CGAL::IO::write_STL
(
std::ostream &
os ,
const Graph &
g ,
const NamedParameters &
np
)
#include <CGAL/boost/graph/IO/STL.h>
writes the graph g
in the output stream os
, using the STereoLithography (STL) File Format .
Attention When writing a binary file, the flag std::ios::binary
flag must be set during the creation of the ofstream
.
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
.
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``
Extra: This parameter is only meaningful while using ASCII encoding.
Precondition The graph must contain only triangle faces.
Returns true
if writing was successful, false
otherwise.
◆ write_STL() [2/2]
template<typename Graph , typename NamedParameters >
bool CGAL::IO::write_STL
(
const std::string &
fname ,
const Graph &
g ,
const NamedParameters &
np
)
#include <CGAL/boost/graph/IO/STL.h>
writes the graph g
into a file named fname
, using the STereoLithography (STL) File Format .
Template Parameters
Parameters
fname the name of the output stream
g the graph to be written
np optional Named Parameters described below
Optional Named Parameters
use_binary_mode
indicates whether data should be written in binary (true
) or in ASCII (false
)
Type: Boolean
Default: true
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
.
stream_precision
a parameter used to set the precision (i.e. how many digits are generated) of the output stream
Type: int
Default: 6
Extra: This parameter is only meaningful while using ASCII encoding.
Precondition The graph must contain only triangle faces.
Returns true
if writing was successful, false
otherwise.
See also Overloads of this function for specific models of the concept FaceGraph
.