CGAL 5.5.2 - CGAL and the Boost Graph Library

I/O Functions for the Wavefront Advanced Visualizer Object Format (OBJ).

Functions

template<typename Graph , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::read_OBJ (std::istream &is, Graph &g, const NamedParameters &np=parameters::default_values())
 reads the graph g from the stream in, using the Wavefront Advanced Visualizer Object Format (OBJ). More...
 
template<typename Graph , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::read_OBJ (const std::string &fname, Graph &g, const NamedParameters &np=parameters::default_values())
 reads the graph g from the file fname, using the Wavefront Advanced Visualizer Object Format (OBJ). More...
 
template<typename Graph , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::write_OBJ (std::ostream &os, const Graph &g, const NamedParameters &np=parameters::default_values())
 writes the graph g into the output stream, using the Wavefront Advanced Visualizer Object Format (OBJ). More...
 
template<typename Graph , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::write_OBJ (const std::string &fname, const Graph &g, const NamedParameters &np=parameters::default_values())
 writes the graph g into a file named fname, using the Wavefront Advanced Visualizer Object Format (OBJ). More...
 

Function Documentation

◆ read_OBJ() [1/2]

template<typename Graph , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::read_OBJ ( std::istream &  is,
Graph &  g,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/boost/graph/IO/OBJ.h>

reads the graph g from the stream in, using the Wavefront Advanced Visualizer Object Format (OBJ).

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

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
Grapha model of MutableFaceGraph
NamedParametersa sequence of Named Parameters
Parameters
isthe input stream
gthe graph to be built from the input data
npoptional Named Parameters described below
Optional Named Parameters
  • 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.

  • 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_OBJ() [2/2]

template<typename Graph , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::read_OBJ ( const std::string &  fname,
Graph &  g,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/boost/graph/IO/OBJ.h>

reads the graph g from the file fname, using the Wavefront Advanced Visualizer Object Format (OBJ).

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

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
Grapha model of MutableFaceGraph
NamedParametersa sequence of Named Parameters
Parameters
fnamethe name of the input file
gthe graph to be built from the input data
npoptional Named Parameters described below
Optional Named Parameters
  • 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.

  • 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_OBJ() [1/2]

template<typename Graph , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::write_OBJ ( std::ostream &  os,
const Graph &  g,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/boost/graph/IO/OBJ.h>

writes the graph g into the output stream, using the Wavefront Advanced Visualizer Object Format (OBJ).

Template Parameters
Grapha model of FaceListGraph and HalfedgeListGraph
NamedParametersa sequence of Named Parameters
Parameters
osthe output stream
gthe graph to be written
npoptional Named Parameters described below
Optional Named Parameters
  • 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.

  • 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_OBJ() [2/2]

template<typename Graph , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::write_OBJ ( const std::string &  fname,
const Graph &  g,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/boost/graph/IO/OBJ.h>

writes the graph g into a file named fname, using the Wavefront Advanced Visualizer Object Format (OBJ).

Template Parameters
Grapha model of FaceListGraph and HalfedgeListGraph
NamedParametersa sequence of Named Parameters
Parameters
fnamethe output file
gthe graph to be written
npoptional Named Parameters described below
Optional Named Parameters
  • 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.
  • 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.