CGAL 6.2 - IO Streams

Loading...
Searching...
No Matches
Functions
OBJ I/O Functions
Reference Manual » I/O Functions

##

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

## Functions
template<typename PointRange , typename PolygonRange , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool | CGAL::IO::read_OBJ (std::istream &is, PointRange &points, PolygonRange &polygons, const NamedParameters &np=parameters::default_values())
| reads the content of `is` into `points` and `polygons`, using the Wavefront Advanced Visualizer Object Format (OBJ).
template<typename PointRange , typename PolygonRange , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool | CGAL::IO::read_OBJ (const std::string &fname, PointRange &points, PolygonRange &polygons, const NamedParameters &np=parameters::default_values())
| reads the content of the file `fname` into `points` and `polygons`, using the Wavefront Advanced Visualizer Object Format (OBJ).
template<typename PointRange , typename PolygonRange , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool | CGAL::IO::write_OBJ (std::ostream &os, const PointRange &points, const PolygonRange &polygons, const NamedParameters &np=parameters::default_values())
| writes the content of `points` and `polygons` in `os`, using the Wavefront Advanced Visualizer Object Format (OBJ).
template<typename PointRange , typename PolygonRange , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool | CGAL::IO::write_OBJ (const std::string &fname, const PointRange &points, const PolygonRange &polygons, const NamedParameters &np=parameters::default_values())
| writes the content of `points` and `polygons` in a file named `fname`, using the Wavefront Advanced Visualizer Object Format (OBJ).

## Function Documentation

## ◆ read_OBJ() [1/2]

template<typename PointRange , typename PolygonRange , typename NamedParameters = CGAL::parameters::Default_named_parameters>

bool CGAL::IO::read_OBJ | ( | const std::string & | fname,
|  | PointRange & | points,
|  | PolygonRange & | polygons,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

`#include <CGAL/IO/OBJ.h>`

reads the content of the file `fname` into `points` and `polygons`, using the Wavefront Advanced Visualizer Object Format (OBJ).

Attention
  The polygon soup is not cleared, and the data from the file are appended.

Template Parameters

  PointRange | a model of the concept `RandomAccessContainer` whose value type is the point type.
  PolygonRange | a model of the concepts `SequenceContainer` and `BackInsertionSequence` whose `value_type` is itself a model of the concept `SequenceContainer` and `BackInsertionSequence` whose `value_type` is an unsigned integer type convertible to `std::size_t`
  NamedParameters | a sequence of Named Parameters

Parameters

  fname | the path to the input file
  points | points of the soup of polygons
  polygons | a range of polygons. Each element in it describes a polygon using the indices of the points in `points`.
  np | optional Named Parameters described below

Optional Named Parameters

  indicates whether output warnings and error messages should be printed or not. Type: Boolean Default: `false` |

Returns
  `true` if the reading was successful, `false` otherwise.

## ◆ read_OBJ() [2/2]

template<typename PointRange , typename PolygonRange , typename NamedParameters = CGAL::parameters::Default_named_parameters>

bool CGAL::IO::read_OBJ | ( | std::istream & | is,
|  | PointRange & | points,
|  | PolygonRange & | polygons,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

`#include <CGAL/IO/OBJ.h>`

reads the content of `is` into `points` and `polygons`, using the Wavefront Advanced Visualizer Object Format (OBJ).

Attention
  The polygon soup is not cleared, and the data from the stream are appended.

Template Parameters

  PointRange | a model of the concepts `RandomAccessContainer` and `BackInsertionSequence` whose value type is the point type
  PolygonRange | a model of the concepts `SequenceContainer` and `BackInsertionSequence` whose `value_type` is itself a model of the concepts `SequenceContainer` and `BackInsertionSequence` whose `value_type` is an unsigned integer type convertible to `std::size_t`
  NamedParameters | a sequence of Named Parameters

Parameters

  is | the input stream
  points | points of the soup of polygons
  polygons | a range of polygons. Each element in it describes a polygon using the indices of the points in `points`.
  np | optional Named Parameters described below

Optional Named Parameters

  indicates whether output warnings and error messages should be printed or not. Type: Boolean Default: `false` |

Returns
  `true` if the reading was successful, `false` otherwise.

## ◆ write_OBJ() [1/2]

template<typename PointRange , typename PolygonRange , typename NamedParameters = CGAL::parameters::Default_named_parameters>

bool CGAL::IO::write_OBJ | ( | const std::string & | fname,
|  | const PointRange & | points,
|  | const PolygonRange & | polygons,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

`#include <CGAL/IO/OBJ.h>`

writes the content of `points` and `polygons` in a file named `fname`, using the Wavefront Advanced Visualizer Object Format (OBJ).

Template Parameters

  PointRange | a model of the concept `RandomAccessContainer` whose value type is the point type
  PolygonRange | a model of the concept `SequenceContainer` whose `value_type` is itself a model of the concept `SequenceContainer` whose `value_type` is an unsigned integer type convertible to `std::size_t`
  NamedParameters | a sequence of Named Parameters

Parameters

  fname | the path to the output file
  points | points of the soup of polygons
  polygons | a range of polygons. Each element in it describes a polygon using the indices of the points in `points`.
  np | optional sequence of Named Parameters among the ones listed below

Optional Named Parameters

  a property map associating points to the elements of the range `points` Type: a model of `ReadablePropertyMap` whose key type is the value type of the iterator of `PointRange` and value type is a model of the concept `Kernel::Point_3` Default: `CGAL::Identity_property_map<std::iterator_traits<PointRange::iterator>::value_type>` |
  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 the writing was successful, `false` otherwise.

## ◆ write_OBJ() [2/2]

template<typename PointRange , typename PolygonRange , typename NamedParameters = CGAL::parameters::Default_named_parameters>

bool CGAL::IO::write_OBJ | ( | std::ostream & | os,
|  | const PointRange & | points,
|  | const PolygonRange & | polygons,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

`#include <CGAL/IO/OBJ.h>`

writes the content of `points` and `polygons` in `os`, using the Wavefront Advanced Visualizer Object Format (OBJ).

Template Parameters

  PointRange | a model of the concept `RandomAccessContainer` whose value type is the point type
  PolygonRange | a model of the concept `SequenceContainer` whose `value_type` is itself a model of the concept `SequenceContainer` whose `value_type` is an unsigned integer type convertible to `std::size_t`
  NamedParameters | a sequence of Named Parameters

Parameters

  os | the output stream
  points | points of the soup of polygons
  polygons | a range of polygons. Each element in it describes a polygon using the indices of the points in `points`.
  np | optional sequence of Named Parameters among the ones listed below

Optional Named Parameters

  a property map associating points to the elements of the range `points` Type: a model of `ReadablePropertyMap` whose key type is the value type of the iterator of `PointRange` and value type is a model of the concept `Point_3` Default: `CGAL::Identity_property_map<std::iterator_traits<PointRange::iterator>::value_type>` |
  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 the writing was successful, `false` otherwise.