CGAL 6.2 - 3D Polyhedral Surface

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

##

## Functions
template<class Traits >
bool | CGAL::IO::read_OFF (std::istream &in, CGAL::Polyhedron_3< Traits > &P)
| reads a polyhedral surface in Object File Format, OFF, with file extension `.off`, from the input stream `in` and appends it to the polyhedral surface \( P\).
template<class Traits >
bool | CGAL::IO::write_OFF (std::ostream &out, const CGAL::Polyhedron_3< Traits > &P)
| writes the polyhedral surface \(P\) to the output stream `out` using the Object File Format, OFF, with file extension `.off`.
template<class Traits >
std::istream & | operator>> (std::istream &in, CGAL::Polyhedron_3< Traits > &P)
| calls `CGAL::IO::read_OFF(in, P)`.
template<class Traits >
std::ostream & | operator<< (std::ostream &out, const CGAL::Polyhedron_3< Traits > &P)
| calls `CGAL::IO::write_OFF(out, P)` .

## Function Documentation

## ◆ read_OFF()

template<class Traits >

bool CGAL::IO::read_OFF | ( | std::istream & | in,
|  | CGAL::Polyhedron_3< Traits > & | P
| ) |  |

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

reads a polyhedral surface in Object File Format, OFF, with file extension `.off`, from the input stream `in` and appends it to the polyhedral surface \( P\).

Only the point coordinates and facets from the input stream are used to build the polyhedral surface. Neither normal vectors nor color attributes are evaluated.

This function overloads the generic function `read_OFF(std::istream&, FaceGraph&)` (if no named parameters are used).

Note
  This function requires `Traits` to be a model of `Kernel` (a stronger requirement than `PolyhedronTraits_3`).

Implementation

This operator is implemented using the modifier mechanism for polyhedral surfaces and the `Polyhedron_incremental_builder_3` class, which allows the construction in a single, efficient scan pass of the input and handles also all the possible flexibility of the polyhedral surface.

Note
  Starting with CGAL 5.2, this function will no longer set the `ios::badbit` of the input stream `in` if the file contains 0 vertices.

See also
  `CGAL::Polyhedron_3<Traits>`
  `CGAL::Polyhedron_incremental_builder_3<HDS>`
  operator<<(std::ostream&, CGAL::Polyhedron_3<Traits>&)

## ◆ write_OFF()

template<class Traits >

bool CGAL::IO::write_OFF | ( | std::ostream & | out,
|  | const CGAL::Polyhedron_3< Traits > & | P
| ) |  |

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

writes the polyhedral surface \(P\) to the output stream `out` using the Object File Format, OFF, with file extension `.off`.

The output is in ASCII format. From the polyhedral surface, only the point coordinates and facets are written. Neither normal vectors nor color attributes are used.

For `OFF` an ASCII and a binary format exist. The format can be selected with the CGAL modifiers for streams, `set_ascii_mode()` and `set_binary_mode()` respectively. The modifier `set_pretty_mode()` can be used to allow for (a few) structuring comments in the output. Otherwise, the output would be free of comments. The default for writing is ASCII without comments.

This function overloads the generic function `write_OFF(std::istream&,FaceGraph)` (if no named parameters are used).

See also
  `CGAL::Polyhedron_3<Traits>`
  `CGAL::Polyhedron_incremental_builder_3<HDS>`
  operator>>(std::istream& in, CGAL::Polyhedron_3<Traits>&)