CGAL 6.2 - Meshing and Remeshing of Polygonal Meshes

Loading...
Searching...
No Matches
Functions
Planar Patch Simplification
Reference Manual

##

Functions to simplify planar patches of a polygon mesh.

## Functions
template<typename TriangleMeshIn , typename PolygonMeshOut , typename NamedParametersIn = parameters::Default_named_parameters, typename NamedParametersOut = parameters::Default_named_parameters>
void | CGAL::Polygon_mesh_processing::remesh_planar_patches (const TriangleMeshIn &tm_in, PolygonMeshOut &pm_out, const NamedParametersIn &np_in=parameters::default_values(), const NamedParametersOut &np_out=parameters::default_values())
| generates a new triangle mesh `pm_out` with the minimal number of triangles while preserving the shape of `tm_in`.
template<typename TriangleMeshIn , typename PolygonMeshOut , typename FacePatchMap , typename EdgeIsConstrainedMap , typename VertexCornerMap , typename NamedParametersIn = parameters::Default_named_parameters, typename NamedParametersOut = parameters::Default_named_parameters>
bool | CGAL::Polygon_mesh_processing::remesh_almost_planar_patches (const TriangleMeshIn &tm_in, PolygonMeshOut &pm_out, std::size_t nb_patches, std::size_t nb_corners, FacePatchMap face_patch_map, VertexCornerMap vertex_corner_map, EdgeIsConstrainedMap ecm, const NamedParametersIn &np_in=parameters::default_values(), const NamedParametersOut &np_out=parameters::default_values())
| generates a new triangle mesh `pm_out` with the minimal number of triangles from a partition of `tm_in`.

## Function Documentation

## ◆ remesh_almost_planar_patches()

template<typename TriangleMeshIn , typename PolygonMeshOut , typename FacePatchMap , typename EdgeIsConstrainedMap , typename VertexCornerMap , typename NamedParametersIn = parameters::Default_named_parameters, typename NamedParametersOut = parameters::Default_named_parameters>

bool CGAL::Polygon_mesh_processing::remesh_almost_planar_patches | ( | const TriangleMeshIn & | tm_in,
|  | PolygonMeshOut & | pm_out,
|  | std::size_t | nb_patches,
|  | std::size_t | nb_corners,
|  | FacePatchMap | face_patch_map,
|  | VertexCornerMap | vertex_corner_map,
|  | EdgeIsConstrainedMap | ecm,
|  | const NamedParametersIn & | np_in = `parameters::default_values()`,
|  | const NamedParametersOut & | np_out = `parameters::default_values()`
| ) |  |

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

generates a new triangle mesh `pm_out` with the minimal number of triangles from a partition of `tm_in`.

The terminology used here and the global idea is very similar to what is done by `remesh_planar_patches()` except that here the partition into patches and corner identification is provided by the user. It allows to have a remeshing of almost coplanar regions, detected for example using the region growing algorithm with the functions `region_growing_of_planes_on_faces()` and `detect_corners_of_regions()`. If a patch cannot be triangulated, it is left untouched in the output and all its vertices become corners so that the output is still a valid conformal triangle mesh.

Returns
  `true` if all patches could be triangulated and `false` otherwise.

Template Parameters

  TriangleMeshIn | a model of `HalfedgeListGraph` and `FaceListGraph`
  PolygonMeshOut | a model of `MutableFaceGraph`
  FacePatchMap | a class model of `ReadablePropertyMap` with `boost::graph_traits<TriangleMeshIn>::face_descriptor` as key type and `std::size_t` as value type
  EdgeIsConstrainedMap | a class model of `ReadablePropertyMap` with `boost::graph_traits<TriangleMeshIn>::edge_descriptor` as key type and `bool` as value type
  VertexCornerMap | a class model of `ReadablePropertyMap` with `boost::graph_traits<TriangleMeshIn>::vertex_descriptor` as key type and `std::size_t` as value type
  NamedParametersIn | a sequence of Named Parameters
  NamedParametersOut | a sequence of Named Parameters

Parameters

  tm_in | input triangle mesh
  pm_out | output polygon mesh
  nb_patches | the number of patches in the partition
  nb_corners | the number of corners
  face_patch_map | a property map that contains for each face the id of its patch in the range `[0, nb_patches]`
  vertex_corner_map | a property map that contains for each vertex that is a corner an id in the range `[0, nb_corners - 1]`, and `std::size_t(-1)` otherwise.
  ecm | a property map that contains `true` if an edge is on the border of a patch and `false` otherwise.
  np_in | an optional sequence of Named Parameters among the ones listed below:

Optional Named Parameters

  a property map providing for each patch the normal of the supporting plane of the patch (used to triangulate it) Type: a class model of `ReadPropertyMap` with the value type of `FacePatchMap` as key and `GeomTraits::Vector_3` as value type, `GeomTraits` being the type of the parameter `geom_traits` Default: If not provided, patch normals will be estimated using corners of the patches |
  a property map associating points to the vertices of `tm_in` Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<TriangleMeshIn>::vertex_descriptor` as key type and `GeomTraits::Point_3` as value type, `GeomTraits` being the type of the parameter `geom_traits` Default: `boost::get(CGAL::vertex_point, tm_in)` Extra: If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` must be available in `TriangleMeshIn`. |
  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. |

Parameters

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

Optional Named Parameters

  if `true`, faces of `pm_out` will not be triangulated, but the one with more than one connected component of the boundary. Type: `bool` Default: false |
  a property map associating points to the vertices of `pm_out` Type: a class model of `WritablePropertyMap` with `boost::graph_traits<PolygonMeshOut>::vertex_descriptor` as key type and `GeomTraits::Point_3` as value type, `GeomTraits` being the type of the parameter `geom_traits` Default: `boost::get(CGAL::vertex_point, pm_out)` Extra: If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` must be available in `PolygonMeshOut`. |
  a property map filled by this function and that will contain for each face the id of its patch in the range `[0, number of patches - 1]` Type: a class model of `ReadWritePropertyMap` with `boost::graph_traits<PolygonMeshOut>::face_descriptor` as key type and `std::size_t` as value type Default: None |
  a property map filled by this function and that will contain for each vertex its corner an id in the range `[0, number of corners - 1]` Type: a class model of `ReadWritePropertyMap` with `boost::graph_traits<PolygonMeshOut>::vertex_descriptor` as key type and `std::size_t` as value type Default: None |
  a callable with `visitor(pm_out)` being called once `tm_in` is no longer needed and before `pm_out` starts being built. It should be used in the case when `tm_in` and `pm_out` are the same mesh, so that `pm_out` can be cleared before being filled. Type: `visitor(pm_out)` must be a valid expression. Default: None |

Examples
  PMP_Remeshing/remesh_almost_planar_patches.cpp.

## ◆ remesh_planar_patches()

template<typename TriangleMeshIn , typename PolygonMeshOut , typename NamedParametersIn = parameters::Default_named_parameters, typename NamedParametersOut = parameters::Default_named_parameters>

void CGAL::Polygon_mesh_processing::remesh_planar_patches | ( | const TriangleMeshIn & | tm_in,
|  | PolygonMeshOut & | pm_out,
|  | const NamedParametersIn & | np_in = `parameters::default_values()`,
|  | const NamedParametersOut & | np_out = `parameters::default_values()`
| ) |  |

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

generates a new triangle mesh `pm_out` with the minimal number of triangles while preserving the shape of `tm_in`.

In practice, this means that connected components of edge-connected faces belonging to the same plane are first extracted (each such connected component is called a patch). Then, the connected components of vertex-connected patch border edges belonging to the same line are extracted. Endpoints of such components and vertices incident to more than two patches (or two patches + one mesh boundary) are called corners. `pm_out` contains the 2D constrained Delaunay triangulation of each patch using only corner vertices on the boundary of the patch.

Warning
  if `tm_in` contains a non-manifold vertex, `pm_out` will be empty. Those vertices must be duplicated with `duplicate_non_manifold_vertices()` to get an output.

Template Parameters

  TriangleMeshIn | a model of `HalfedgeListGraph` and `FaceListGraph`
  PolygonMeshOut | a model of `MutableFaceGraph`
  NamedParametersIn | a sequence of Named Parameters
  NamedParametersOut | a sequence of Named Parameters

Parameters

  tm_in | input triangle mesh
  pm_out | output polygon mesh
  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 `tm_in` Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<TriangleMeshIn>::vertex_descriptor` as key type and `GeomTraits::Point_3` as value type, `GeomTraits` being the type of the parameter `geom_traits` Default: `boost::get(CGAL::vertex_point, tm_in)` Extra: If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` must be available in `TriangleMeshIn`. |
  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 property map where the user should put `true` for edges that must be considered as on the boundary of a patch. Additionally, the map is updated by this function and will contain `true` if, based on the angle criteria, an edge is on the boundary of a patch and `false` otherwise. Type: a class model of `ReadWritePropertyMap` with `boost::graph_traits<TriangleMeshIn>::edge_descriptor` as key type and `bool` as value type Default: None |
  a property map filled by this function and that will contain for each face the id of its patch in the range `[0, number of patches - 1]` Type: a class model of `ReadWritePropertyMap` with `boost::graph_traits<TriangleMeshIn>::face_descriptor` as key type and `std::size_t` as value type Default: None |
  a property map filled by this function and that will contain for each vertex that is a corner an id in the range `[0, number of corners - 1]`, and `std::size_t(-1)` otherwise. Type: a class model of `ReadWritePropertyMap` with `boost::graph_traits<TriangleMeshIn>::vertex_descriptor` as key type and `std::size_t` as value type Default: None |
  The maximum angle, given as a cosine, (i) between the normals of the supporting planes of adjacent faces such that they are considered coplanar, and (ii) for the smallest angle between the supporting line of a segment and an adjacent segment such that they are considered collinear. Type: `FT` type from the `geom_traits` parameter Default: 1, which means exact coplanarity and collinearity Extra: The value must be in the interval `[0,1]` |

Parameters

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

Optional Named Parameters

  if `true`, faces of `pm_out` will not be triangulated, but the one with more than one connected component of the boundary. Type: `bool` Default: false |
  a property map associating points to the vertices of `pm_out` Type: a class model of `WritablePropertyMap` with `boost::graph_traits<PolygonMeshOut>::vertex_descriptor` as key type and `GeomTraits::Point_3` as value type, `GeomTraits` being the type of the parameter `geom_traits` Default: `boost::get(CGAL::vertex_point, pm_out)` Extra: If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` must be available in `PolygonMeshOut`. |
  a property map filled by this function and that will contain for each face the id of its patch in the range `[0, number of patches - 1]`, the patch id of two identical patches in the input and output meshes being equal. Type: a class model of `ReadWritePropertyMap` with `boost::graph_traits<PolygonMeshOut>::face_descriptor` as key type and `std::size_t` as value type Default: None |
  a property map filled by this function and that will contain for each vertex its corner an id in the range `[0, number of corners - 1]` Type: a class model of `ReadWritePropertyMap` with `boost::graph_traits<PolygonMeshOut>::vertex_descriptor` as key type and `std::size_t` as value type Default: None |
  a callable with `visitor(pm_out)` being called once `tm_in` is no longer needed and before `pm_out` starts being built. It should be used in the case when `tm_in` and `pm_out` are the same mesh, so that `pm_out` can be cleared before being filled. Type: `visitor(pm_out)` must be a valid expression. Default: None |

Examples
  PMP_Remeshing/remesh_planar_patches.cpp.