CGAL 6.1.2 - Polygon Mesh Processing

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

##

## Functions
template<typename PolygonMesh , typename NamedParameters = parameters::Default_named_parameters>
bool | CGAL::Polygon_mesh_processing::IO::read_polygon_mesh (const std::string &fname, PolygonMesh &g, const NamedParameters &np=parameters::default_values())
| reads the file as a polygon soup, repairs (using `repair_polygon_soup()`), and orients it (using `orient_polygon_soup()`) as to obtain a polygon mesh.

## Function Documentation

## ◆ read_polygon_mesh()

template<typename PolygonMesh , typename NamedParameters = parameters::Default_named_parameters>

bool CGAL::Polygon_mesh_processing::IO::read_polygon_mesh | ( | const std::string & | fname,
|  | PolygonMesh & | g,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

`#include <CGAL/Polygon_mesh_processing/IO/polygon_mesh_io.h>`

reads the file as a polygon soup, repairs (using `repair_polygon_soup()`), and orients it (using `orient_polygon_soup()`) as to obtain a polygon mesh.

Supported file formats are the following:

- Object File Format (OFF) (`.off`)
- Wavefront Advanced Visualizer Object Format (OBJ) (`.obj`)
- STereoLithography (STL) File Format (`.stl`)
- Polygon File Format (PLY) (`.ply`)
- GOCAD (TS) File Format (`.ts`)
- VTK (VTU / VTP / legacy) File Formats (`.vtp`)

The format is detected from the filename extension (letter case is not important).

If repairing and orientation are known to not be required, one can use `CGAL::IO::read_polygon_mesh()` directly.

Template Parameters

  PolygonMesh | a model of `MutableFaceGraph`
  NamedParameters | a sequence of Named Parameters

Parameters

  fname | the name of the input file
  g | the polygon mesh
  np | sequence of Named Parameters among the ones listed below

Optional Named Parameters

  a property map associating points to the vertices of `g` Type: a class model of `WritablePropertyMap` with `boost::graph_traits<PolygonMesh>::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 `PolygonMesh`. |
  a parameter used indicate whether `CGAL::Polygon_mesh_processing::repair_polygon_soup()` should be called on the intermediate polygon soup. Type: Boolean Default: `true` |
  whether extra information is printed when an incident occurs during reading Type: Boolean Default: `false` |

Returns
  `true` if the reading, repairing, and orientation operations were successful, `false` otherwise.

See also
  `CGAL::IO::read_polygon_mesh()`