CGAL 6.2 - 3D Boolean Operations on Nef Polyhedra: I/O Functions

CGAL 6.2 - 3D Boolean Operations on Nef Polyhedra

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

##

## Functions
template<class NefPolyhedron_3 , class PolygonMesh >
void | CGAL::convert_nef_polyhedron_to_polygon_mesh (const NefPolyhedron_3 &nef, PolygonMesh &pm, bool triangulate_all_faces=false)
| Converts an object of type `NefPolyhedron_3` into a polygon mesh model of `MutableFaceGraph`.
template<class NefPolyhedron_3 , typename PolygonRange , typename PointRange >
void | CGAL::convert_nef_polyhedron_to_polygon_soup (const NefPolyhedron_3 &nef, PointRange &points, PolygonRange &polygons, bool triangulate_all_faces=false)
| Converts an object of type `NefPolyhedron_3` into a polygon soup.
template<class Traits >
istream & | CGAL::operator>> (std::istream &in, CGAL::Nef_polyhedron_3< Traits > &N)
| This operator reads a Nef polyhedron, which is given in the proprietary file format written by the input operator in and assigns it to N.
template<class Traits >
ostream & | CGAL::operator<< (std::ostream &out, CGAL::Nef_polyhedron_3< Traits > &N)
| This operator writes the Nef polyhedron `N` to the output stream `out` using a proprietary file format.
template<class NefPolyhedron_3 >
std::size_t | CGAL::OFF_to_nef_3 (std::istream &in, NefPolyhedron_3 &N)
| This function creates a 3D Nef polyhedron from an OFF file which is read from input stream `in`.

## Function Documentation

## ◆ convert_nef_polyhedron_to_polygon_mesh()

template<class NefPolyhedron_3 , class PolygonMesh >

void CGAL::convert_nef_polyhedron_to_polygon_mesh | ( | const NefPolyhedron_3 & | nef,
|  | PolygonMesh & | pm,
|  | bool | triangulate_all_faces = `false`
| ) |  |

`#include <CGAL/boost/graph/convert_nef_polyhedron_to_polygon_mesh.h>`

Converts an object of type `NefPolyhedron_3` into a polygon mesh model of `MutableFaceGraph`.

Note that contrary to `Nef_polyhedron_3::convert_to_polyhedron()`, the output is not triangulated (but faces with more than one connected component of the boundary). The polygon mesh can be triangulated by setting `triangulate_all_faces` to `true` or by calling the function `Polygon_mesh_processing::triangulate_faces()`.

Template Parameters

  NefPolyhedron_3 | an object of type `Nef_polyhedron_3`.
  PolygonMesh | a model of `MutableFaceGraph` with an internal property map for `CGAL::vertex_point_t`.

The points from `nef` to `pm` are converted using `CGAL::Cartesian_converter<NefKernel, TargetKernel>`. `NefKernel` and `TargetKernel` are deduced using `CGAL::Kernel_traits` from the point type of `nef` and the value type of the vertex_point_map of `tm`.

Parameters

  nef | the input.
  pm | the output.
  triangulate_all_faces | indicates whether all the faces must be triangulated.

Precondition
  `PolygonMesh` must have an internal point property map with value type being `NefPolyhedron_3::Point_3`.
  `nef.simple()`

Examples
  Nef_3/nef_3_to_surface_mesh.cpp.

## ◆ convert_nef_polyhedron_to_polygon_soup()

template<class NefPolyhedron_3 , typename PolygonRange , typename PointRange >

void CGAL::convert_nef_polyhedron_to_polygon_soup | ( | const NefPolyhedron_3 & | nef,
|  | PointRange & | points,
|  | PolygonRange & | polygons,
|  | bool | triangulate_all_faces = `false`
| ) |  |

`#include <CGAL/boost/graph/convert_nef_polyhedron_to_polygon_mesh.h>`

Converts an object of type `NefPolyhedron_3` into a polygon soup.

The polygons can be triangulated by setting `triangulate_all_faces` to `true`.

Template Parameters

  NefPolyhedron_3 | an object of type `Nef_polyhedron_3`.
  PointRange | a model of the concept `BackInsertionSequence` whose `value_type` is the point type
  PolygonRange | a model of the concept `BackInsertionSequence` whose `value_type` is a model of the concept `BackInsertionSequence` whose `value_type` is `std::size_t`.

The points from `nef` to `points` are converted using `CGAL::Cartesian_converter<NefKernel, OutputKernel>`. `NefKernel` and `OutputKernel` are deduced using `CGAL::Kernel_traits` from the point types.

Parameters

  nef | the input.
  points | the output points of the soup
  polygons | the output polygons of the soup.
  triangulate_all_faces | indicates whether all polygons must be triangulated.

## ◆ OFF_to_nef_3()

template<class NefPolyhedron_3 >

std::size_t CGAL::OFF_to_nef_3 | ( | std::istream & | in,
|  | NefPolyhedron_3 & | N
| ) |  |

`#include <CGAL/OFF_to_nef_3.h>`

This function creates a 3D Nef polyhedron from an OFF file which is read from input stream `in`.

The purpose of `OFF_to_nef_3()` is to create a Nef polyhedron from an OFF file that cannot be handled by the `Nef_polyhedron_3` constructors. It handles double coordinates while using a homogeneous kernel, non-coplanar facets, surfaces with boundaries, self-intersecting surfaces, and single facets. Every closed volume gets marked. The function returns the number of facets it could not handle.

Template Parameters

  NefPolyhedron_3 | an object of type `Nef_polyhedron_3`.

See also
  `CGAL::Nef_polyhedron_3<Traits>`

Examples
  Nef_3/complex_construction.cpp.

## ◆ operator<<()

template<class Traits >

ostream & CGAL::operator<< | ( | std::ostream & | out,
|  | CGAL::Nef_polyhedron_3< Traits > & | N
| ) |  |

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

This operator writes the Nef polyhedron `N` to the output stream `out` using a proprietary file format.

It includes the complete incidence structure, the geometric data, and the marks of each item.

Using CGAL stream modifiers the following output formats can be chosen: ASCII (`set_ascii_mode()`), binary (`set_binary_mode()`) or pretty (`set_pretty_mode()`). The mandatory format is the ASCII format. It is recommended to use this format for file input and output.

As the output depends on the output operators of the geometric primitives provided by the traits class, it might not be possible that the input operator and output operators of different traits classes are not compatible. We recommend to use the CGAL kernels `Homogeneous`, `Simple_homogeneous`, or `Extended_homogeneous` parametrized with any exact number type that models \(\mathbb{Z}\) (e.g. `Gmpz` or `leda_integer`).

A bounded `Nef_polyhedron_3<Extended_homogeneous>` is automatically written as though `Nef_polyhedron_3<Homogeneous>` or `Nef_polyhedron_3<Simple_homogeneous>` is used. As a result, the input operator of each of these types can read the output.

See also
  `CGAL::Nef_polyhedron_3<Traits>`

## ◆ operator>>()

template<class Traits >

istream & CGAL::operator>> | ( | std::istream & | in,
|  | CGAL::Nef_polyhedron_3< Traits > & | N
| ) |  |

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

This operator reads a Nef polyhedron, which is given in the proprietary file format written by the input operator in and assigns it to N.

It includes the complete incidence structure, the geometric data, and the marks of each item.

It is recommended to use the CGAL kernels `Homogeneous`, `Simple_homogeneous`, or `Extended_homogeneous` parametrized with any exact number type that models \( \mathbb{Z}\) (e.g.`Gmpz` or `leda_integer`). The input and output iterators of Nef polyhedra parametrized with either of these kernels are compatible as long as the Nef polyhedron is bounded. An unbounded Nef polyhedron can only be read by a Nef polyhedron parametrized with an extended kernel. It is also recommended to use the CGAL stream modifier `set_ascii_mode()`.

See also
  `CGAL::Nef_polyhedron_3<Traits>`