CGAL 6.2 - Meshing and Remeshing of Polygonal Meshes

Loading...
Searching...
No Matches
Classes | Functions
Meshing
Reference Manual

##

Generic functions to mesh and remesh polygon meshes.

## Classes
struct | CGAL::Polygon_mesh_processing::Triangulate_faces::Default_visitor< PolygonMesh >
| Default visitor model for the functions `triangulate_face()` and `triangulate_faces()`, model of `PMPTriangulateFaceVisitor`. More...
struct | CGAL::Polygon_mesh_processing::Triangulate_polygons::Default_visitor
| Default visitor for the function `triangulate_polygons()`, model of `PMPTriangulateFaceVisitor`. More...

## Functions
template<class InputMesh , class OutputMesh , class BottomFunctor , class TopFunctor , class NamedParameters1 = CGAL::parameters::Default_named_parameter, class NamedParameters2 = CGAL::parameters::Default_named_parameter>
void | CGAL::Polygon_mesh_processing::extrude_mesh (const InputMesh &input, OutputMesh &output, const BottomFunctor &bot, const TopFunctor &top, const NamedParameters1 &np_in=parameters::default_values(), const NamedParameters2 &np_out=parameters::default_values())
| performs a generalized extrusion of `input` and puts it in `output`.
template<class InputMesh , class OutputMesh , class NamedParameters1 = CGAL::parameters::Default_named_parameter, class NamedParameters2 = CGAL::parameters::Default_named_parameter>
void | CGAL::Polygon_mesh_processing::extrude_mesh (const InputMesh &input, OutputMesh &output, Vector_3 v, const NamedParameters1 &np_in=parameters::default_values(), const NamedParameters2 &np_out=parameters::default_values())
| fills `output` with a closed mesh bounding the volume swept by `input` when translating its vertices by `v`.
template<typename PolygonMesh , typename NamedParameters = parameters::Default_named_parameters>
bool | CGAL::Polygon_mesh_processing::triangulate_face (typename boost::graph_traits< PolygonMesh >::face_descriptor f, PolygonMesh &pmesh, const NamedParameters &np=parameters::default_values())
| triangulates a single face of a polygon mesh.
template<typename FaceRange , typename PolygonMesh , typename NamedParameters = parameters::Default_named_parameters>
bool | CGAL::Polygon_mesh_processing::triangulate_faces (const FaceRange &face_range, PolygonMesh &pmesh, const NamedParameters &np=parameters::default_values())
| triangulates given faces of a polygon mesh.
template<typename PolygonMesh , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool | CGAL::Polygon_mesh_processing::triangulate_faces (PolygonMesh &pmesh, const NamedParameters &np=parameters::default_values())
| triangulates all faces of a polygon mesh.
template<typename PointRange , typename PolygonRange , typename NamedParameters = parameters::Default_named_parameters>
bool | CGAL::Polygon_mesh_processing::triangulate_polygons (const PointRange &points, PolygonRange &polygons, const NamedParameters &np=parameters::default_values())
| triangulates all polygons of a polygon soup.

## Function Documentation

## ◆ extrude_mesh() [1/2]

template<class InputMesh , class OutputMesh , class BottomFunctor , class TopFunctor , class NamedParameters1 = CGAL::parameters::Default_named_parameter, class NamedParameters2 = CGAL::parameters::Default_named_parameter>

void CGAL::Polygon_mesh_processing::extrude_mesh | ( | const InputMesh & | input,
|  | OutputMesh & | output,
|  | const BottomFunctor & | bot,
|  | const TopFunctor & | top,
|  | const NamedParameters1 & | np_in = `parameters::default_values()`,
|  | const NamedParameters2 & | np_out = `parameters::default_values()`
| ) |  |

`#include <CGAL/Polygon_mesh_processing/extrude.h>`

performs a generalized extrusion of `input` and puts it in `output`.

This function extrudes the open surface mesh `input` and puts the result in `output`. The mesh generated is a closed surface mesh with a bottom and top part, both having the same graph combinatorics as `input` (except that the orientation of the faces of the bottom part is reversed). The bottom and the top parts are connected by a triangle strip between boundary cycles. The coordinates of the points associated to the vertices of the bottom and top part are first initialized to the same value as the corresponding vertices of `input`. Then for each vertex, a call to `bot` and `top` is done for the vertices of the bottom part and the top part, respectively.

Attention
  `output` may be self intersecting.

Template Parameters

  InputMesh | a model of `FaceListGraph`
  OutputMesh | a model of `FaceListGraph` and `MutableFaceGraph`
  BottomFunctor | a functor providing void operator()(boost::graph_traits<InputMesh>::vertex_descriptor input_v,boost::graph_traits<OutputMesh>::vertex_descriptor output_v) where `output_v` is the copy of `input_v` from `input` into the bottom part of `output`.
  TopFunctor | a functor providing a similar `operator()` as `BottomFunctor`.
  NamedParameters1 | a sequence of Named Parameters for `InputMesh`
  NamedParameters2 | a sequence of Named Parameters for `OutputMesh`

Parameters

  input | an open surface mesh to extrude.
  output | a surface mesh that will contain the result of the extrusion.
  bot | functor that will transform all points copied from `input` in order to shape the bottom part of the extrusion.
  top | functor that will transform all points copied from `input` in order to shape the top part of the extrusion.
  np_in | an optional sequence of Named Parameters among the ones listed below

Optional Named Parameters

  a property map associating points to the vertices of `input` Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<InputMesh>::vertex_descriptor` as key type and `Point_3` as value type Default: `boost::get(CGAL::vertex_point, input)` Extra: If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` should be available for the vertices of `input`. |

Parameters

  np_out | an optional sequence of Named Parameters among the ones listed below

Optional Named Parameters

  a property map associating points to the vertices of `output` Type: a class model of `ReadWritePropertyMap` with `boost::graph_traits<OutputMesh>::vertex_descriptor` as key type and `Point_3` as value type Default: `boost::get(CGAL::vertex_point, output)` Extra: If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` should be available for the vertices of `output`. |

Examples
  PMP_Remeshing/extrude.cpp.

## ◆ extrude_mesh() [2/2]

template<class InputMesh , class OutputMesh , class NamedParameters1 = CGAL::parameters::Default_named_parameter, class NamedParameters2 = CGAL::parameters::Default_named_parameter>

void CGAL::Polygon_mesh_processing::extrude_mesh | ( | const InputMesh & | input,
|  | OutputMesh & | output,
|  | Vector_3 | v,
|  | const NamedParameters1 & | np_in = `parameters::default_values()`,
|  | const NamedParameters2 & | np_out = `parameters::default_values()`
| ) |  |

`#include <CGAL/Polygon_mesh_processing/extrude.h>`

fills `output` with a closed mesh bounding the volume swept by `input` when translating its vertices by `v`.

The mesh is oriented so that the faces corresponding to `input` in `output` have the same orientation.

Attention
  `output` may be self intersecting.

Template Parameters

  InputMesh | a model of the concept `FaceListGraph`
  OutputMesh | a model of the concept `FaceListGraph` and `MutableFaceGraph`
  Vector_3 | vector type from the same CGAL kernel as the point of the vertex point map used for `OutputMesh`.
  NamedParameters1 | a sequence of Named Parameters for `InputMesh`
  NamedParameters2 | a sequence of Named Parameters for `OutputMesh`

Parameters

  input | an open surface mesh to extrude
  output | a surface mesh that will contain the result of the extrusion
  v | the vector defining the direction of the extrusion
  np_in | an optional sequence of Named Parameters among the ones listed below

Optional Named Parameters

  a property map associating points to the vertices of `input` Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<InputMesh>::vertex_descriptor` as key type and `Point_3` as value type Default: `boost::get(CGAL::vertex_point, input)` Extra: If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` should be available for the vertices of `input`. |

Parameters

  np_out | an optional sequence of Named Parameters among the ones listed below

Optional Named Parameters

  a property map associating points to the vertices of `output` Type: a class model of `ReadWritePropertyMap` with `boost::graph_traits<OutputMesh>::vertex_descriptor` as key type and `Point_3` as value type Default: `boost::get(CGAL::vertex_point, output)` Extra: If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` should be available for the vertices of `output`. |

## ◆ triangulate_face()

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

bool CGAL::Polygon_mesh_processing::triangulate_face | ( | typename boost::graph_traits< PolygonMesh >::face_descriptor | f,
|  | PolygonMesh & | pmesh,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

`#include <CGAL/Polygon_mesh_processing/triangulate_faces.h>`

triangulates a single face of a polygon mesh.

This function depends on the package 2D Triangulations.

Template Parameters

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

Parameters

  f | face to be triangulated
  pmesh | the polygon mesh to which the face to be triangulated belongs
  np | an optional sequence of Named Parameters among the ones listed below

Optional Named Parameters

  a property map associating points to the vertices of `pmesh` Type: a class model of `ReadWritePropertyMap` with `boost::graph_traits<PolygonMesh>::vertex_descriptor` as key type and `Point_3` as value type Default: `boost::get(CGAL::vertex_point, pmesh)` Extra: If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` must be available in `PolygonMesh`. |
  an instance of a geometric traits class Type: a class model of `Kernel` Default: a CGAL Kernel deduced from the point type, using `CGAL::Kernel_traits` Extra: The geometric traits class must be compatible with the vertex point type. |
  a visitor that enables to track how faces are triangulated into subfaces Type: a class model of `PMPTriangulateFaceVisitor` and `PMPHolefillingVisitor`, with `PMPTriangulateFaceVisitor::face_descriptor` and `PMPTriangulateFaceVisitor::vertex_descriptor` being the corresponding descriptor types of `booost::graph_traits<PolygonMesh>` Default: `Triangulate_faces::Default_visitor<PolygonMesh>` Extra: Note that the visitor will be copied, so it must not have any data member that does not have a reference-like type. |

This function calls `CGAL::Polygon_mesh_processing::triangulate_hole_polyline()`. Refer to its documentation for its named parameters.

Precondition
  The face `f` is not degenerate.

Returns
  `true` if the face has been triangulated.

See also
  `triangulate_faces()`

## ◆ triangulate_faces() [1/2]

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

bool CGAL::Polygon_mesh_processing::triangulate_faces | ( | const FaceRange & | face_range,
|  | PolygonMesh & | pmesh,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

`#include <CGAL/Polygon_mesh_processing/triangulate_faces.h>`

triangulates given faces of a polygon mesh.

This function depends on the package 2D Triangulations.

Template Parameters

  FaceRange | range of `boost::graph_traits<PolygonMesh>::face_descriptor`, model of `Range`. Its iterator type is `InputIterator`.
  PolygonMesh | a model of `FaceListGraph` and `MutableFaceGraph`
  NamedParameters | a sequence of Named Parameters

Parameters

  face_range | the range of faces to be triangulated
  pmesh | the polygon mesh to be triangulated
  np | an optional sequence of Named Parameters among the ones listed below

Optional Named Parameters

  a property map associating points to the vertices of `pmesh` Type: a class model of `ReadWritePropertyMap` with `boost::graph_traits<PolygonMesh>::vertex_descriptor` as key type and `Point_3` as value type Default: `boost::get(CGAL::vertex_point, pmesh)` Extra: If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` must be available in `PolygonMesh`. |
  an instance of a geometric traits class Type: a class model of `Kernel` Default: a CGAL Kernel deduced from the point type, using `CGAL::Kernel_traits` Extra: The geometric traits class must be compatible with the vertex point type. |
  a visitor that enables to track how faces are triangulated into subfaces Type: a class model of `PMPTriangulateFaceVisitor` and `PMPHolefillingVisitor`, with `PMPTriangulateFaceVisitor::face_descriptor` and `PMPTriangulateFaceVisitor::vertex_descriptor` being the corresponding descriptor types of `booost::graph_traits<PolygonMesh>` Default: `Triangulate_faces::Default_visitor<PolygonMesh>` Extra: Note that the visitor will be copied, so it must not have any data member that does not have a reference-like type. |

This function calls `CGAL::Polygon_mesh_processing::triangulate_hole_polyline()` for each face. Refer to its documentation for its named parameters.

Precondition
  No face within `face_range` is degenerate.

Returns
  `true` if all the faces have been triangulated.

See also
  `triangulate_face()`
  `triangulate_polygons()`

Examples
  PMP_Remeshing/remesh_planar_patches.cpp, PMP_Remeshing/triangulate_faces_example.cpp, and PMP_Remeshing/triangulate_faces_split_visitor_example.cpp.

## ◆ triangulate_faces() [2/2]

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

bool CGAL::Polygon_mesh_processing::triangulate_faces | ( | PolygonMesh & | pmesh,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

`#include <CGAL/Polygon_mesh_processing/triangulate_faces.h>`

triangulates all faces of a polygon mesh.

This function depends on the package 2D Triangulations.

Template Parameters

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

Parameters

  pmesh | the polygon mesh to be triangulated
  np | an optional sequence of Named Parameters among the ones listed below

Optional Named Parameters

  a property map associating points to the vertices of `pmesh` Type: a class model of `ReadWritePropertyMap` with `boost::graph_traits<PolygonMesh>::vertex_descriptor` as key type and `Point_3` as value type Default: `boost::get(CGAL::vertex_point, pmesh)` Extra: If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` must be available in `PolygonMesh`. |
  an instance of a geometric traits class Type: a class model of `Kernel` Default: a CGAL Kernel deduced from the point type, using `CGAL::Kernel_traits` Extra: The geometric traits class must be compatible with the vertex point type. |
  a visitor that enables to track how faces are triangulated into subfaces Type: a class model of `PMPTriangulateFaceVisitor` and `PMPHolefillingVisitor`, with `PMPTriangulateFaceVisitor::face_descriptor` and `PMPTriangulateFaceVisitor::vertex_descriptor` being `std::size_t`. Default: `Triangulate_faces::Default_visitor<PolygonMesh>` Extra: Note that the visitor will be copied, so it must not have any data member that does not have a reference-like type. |

This function calls `CGAL::Polygon_mesh_processing::triangulate_hole_polyline()` on all the faces of the polygon mesh. Refer to its documentation for its named parameters.

Precondition
  No face of `pmesh` is degenerate.

Returns
  `true` if all the faces have been triangulated.

See also
  `triangulate_face()`
  `triangulate_polygons()`

## ◆ triangulate_polygons()

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

bool CGAL::Polygon_mesh_processing::triangulate_polygons | ( | const PointRange & | points,
|  | PolygonRange & | polygons,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

`#include <CGAL/Polygon_mesh_processing/triangulate_faces.h>`

triangulates all polygons of a polygon soup.

This function depends on the package 2D Triangulations.

Template Parameters

  PointRange | a model of `ConstRange`. The value type of its iterator is the point type.
  PolygonRange | a model of the concepts `SequenceContainer` and `Swappable`, whose `value_type` is itself a model of the concept `SequenceContainer` whose `value_type` is `std::size_t`.
  NamedParameters | a sequence of Named Parameters

Parameters

  points | the point geometry of the soup to be triangulated
  polygons | the polygons to be triangulated
  np | an optional sequence of Named Parameters among the ones listed below

Optional Named Parameters

  a property map associating points to the elements of the point set `points` Type: a model of `ReadablePropertyMap` whose key type is the value type of the iterator of `PointRange` and whose value type is `geom_traits::Point_3` Default: `CGAL::Identity_property_map<geom_traits::Point_3>` |
  an instance of a geometric traits class Type: a class model of `Kernel` Default: a CGAL Kernel deduced from the point type, using `CGAL::Kernel_traits` Extra: The geometric traits class must be compatible with the vertex point type. |
  a visitor that enables to track how polygons are divided into triangles Type: a class model of `PMPTriangulateFaceVisitor` and `PMPHolefillingVisitor` Default: `Triangulate_polygons::Default_visitor` Extra: Note that the visitor will be copied, so it must not have any data member that does not have a reference-like type. |

This function calls `CGAL::Polygon_mesh_processing::triangulate_hole_polyline()` for each polygon. Refer to its documentation for its named parameters.

Precondition
  No polygon within `polygons` is degenerate.

Returns
  `true` if all the polygons have been triangulated.

See also
  `triangulate_faces()`