CGAL 6.2 - Polygon Mesh Processing

Loading...
Searching...
No Matches
Functions
Feature Detection Functions
Reference Manual

##

Functions to detect sharp edges and surface patches of polygon meshes.

## Functions
template<typename PolygonMesh , typename FT , typename EdgeIsFeatureMap , typename NamedParameters >
void | CGAL::Polygon_mesh_processing::detect_sharp_edges (const PolygonMesh &pmesh, FT angle_in_deg, EdgeIsFeatureMap edge_is_feature_map, const NamedParameters &np=parameters::default_values())
| detects and marks the edges that are considered to be sharp with respect to the given angle bound.
template<typename PolygonMesh , typename PatchIdMap , typename VertexIncidentPatchesMap , typename EdgeIsFeatureMap >
void | CGAL::Polygon_mesh_processing::detect_vertex_incident_patches (const PolygonMesh &pmesh, const PatchIdMap patch_id_map, VertexIncidentPatchesMap vertex_incident_patches_map, const EdgeIsFeatureMap edge_is_feature_map)
| collects the surface patches of the faces incident to each vertex of the input polygon mesh.
template<typename PolygonMesh , typename FT , typename EdgeIsFeatureMap , typename PatchIdMap , typename NamedParameters >
boost::graph_traits< PolygonMesh >::faces_size_type | CGAL::Polygon_mesh_processing::sharp_edges_segmentation (const PolygonMesh &pmesh, FT angle_in_deg, EdgeIsFeatureMap edge_is_feature_map, PatchIdMap patch_id_map, const NamedParameters &np=parameters::default_values())
| This function calls successively `CGAL::Polygon_mesh_processing::detect_sharp_edges()`, `CGAL::Polygon_mesh_processing::connected_components()`, and `CGAL::Polygon_mesh_processing::detect_vertex_incident_patches()`
template<typename PolygonMesh , typename RegionMap , typename NamedParameters = parameters::Default_named_parameters>
std::size_t | CGAL::Polygon_mesh_processing::region_growing_of_planes_on_faces (const PolygonMesh &mesh, RegionMap region_map, const NamedParameters &np=parameters::default_values())
| applies a region growing algorithm to fit planes on faces of a mesh.
template<typename PolygonMesh , typename RegionMap , typename CornerIdMap , typename NamedParameters = parameters::Default_named_parameters>
std::size_t | CGAL::Polygon_mesh_processing::detect_corners_of_regions (const PolygonMesh &mesh, RegionMap region_map, std::size_t nb_regions, CornerIdMap corner_id_map, const NamedParameters &np=parameters::default_values())
| detects the corners on the boundary of almost planar regions by applying the region growing algorithm fitting lines on segment edges of a partition of a mesh.

## Function Documentation

## ◆ detect_corners_of_regions()

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

std::size_t CGAL::Polygon_mesh_processing::detect_corners_of_regions | ( | const PolygonMesh & | mesh,
|  | RegionMap | region_map,
|  | std::size_t | nb_regions,
|  | CornerIdMap | corner_id_map,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

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

detects the corners on the boundary of almost planar regions by applying the region growing algorithm fitting lines on segment edges of a partition of a mesh.

More precisely, a corner on the boundary of a region is a vertex that is either shared by at least three regions (two if it is also a vertex on the boundary of the mesh), or that is incident to two segments edges assigned to different lines. See Section Region Growing for more details on the method.

Template Parameters

  PolygonMesh | a model of `FaceListGraph` and `EdgeListGraph`
  RegionMap | a model of `ReadablePropertyMap` with `boost::graph_traits<PolygonMesh>::face_descriptor` as key type and `std::size_t` as value type.
  CornerIdMap | a model of `WritablePropertyMap` with `boost::graph_traits<PolygonMesh>::vertex_descriptor` as key type and `std::size_t` as value type.
  NamedParameters | a sequence of Named Parameters

Parameters

  mesh | polygon mesh for region growing.
  region_map | property map providing the region index of each face, values must be in `[0, nb_regions-1]`.
  corner_id_map | property map storing the corner index of each vertex. Values start at `0` up to the value returned minus 1. `std::size_t(-1)` is put for vertices that are not corners.
  nb_regions | the number of patches in the partition of `mesh` defined by `region_map`
  np | an optional sequence of Named Parameters among the ones listed below

Returns
  the number of corners detected

Optional Named Parameters

  a property map filled by this function such that an edge is marked as constrained if it is at the interface of two different regions or on the boundary of the mesh Type: a class model of `ReadWritePropertyMap` with `boost::graph_traits<PolygonMesh>::edge_descriptor` as key type and `bool` as value type Default: Unused if not provided Extra: The value for each edge must be initialized to `false`. |
  the maximum distance from a segment to a line such that it is considered part of the region of the line Type: `GeomTraits::FT` with `GeomTraits` being the type of the parameter `geom_traits` Default: 1 |
  the maximum angle in degrees between two adjacent segments such that they are considered part of the same region Type: `GeomTraits::FT` with `GeomTraits` being the type of the parameter `geom_traits` Default: 25 degrees Extra: this parameter and `cosine_of_maximum_angle` are exclusive |
  The maximum angle, given as a cosine, for the smallest angle between the supporting line of a segment and an adjacent segment such that they are considered part of the same region Type: `GeomTraits::FT` with `GeomTraits` being the type of the parameter `geom_traits` Default: `cos(25 * PI / 180)` Extra: this parameter and `maximum_angle` are exclusive |
  Refit the line primitive regularly to the region during the region growing algorithm. If false, the line primitive is equal to the support line of the seed edge. Type: `CGAL::Boolean_tag` Default: `CGAL::Tag_false()` Extra: Valid values are CGAL::Tag_true() or CGAL::Tag_false(). |
  a property map associating points to the vertices of `mesh` Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<PolygonMesh>::vertex_descriptor` as key type and `Point_3` as value type Default: `boost::get(CGAL::vertex_point, mesh)` 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. |

## ◆ detect_sharp_edges()

template<typename PolygonMesh , typename FT , typename EdgeIsFeatureMap , typename NamedParameters >

void CGAL::Polygon_mesh_processing::detect_sharp_edges | ( | const PolygonMesh & | pmesh,
|  | FT | angle_in_deg,
|  | EdgeIsFeatureMap | edge_is_feature_map,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

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

detects and marks the edges that are considered to be sharp with respect to the given angle bound.

`angle_in_deg` gives the maximum angle (in degrees) between the two normal vectors of adjacent triangles. For an edge of the input polygon mesh, if the angle between the two normal vectors of its incident facets is bigger than the given bound, then the edge is marked as being a feature edge.

Also computes the number of sharp edges incident to each vertex, if `vertex_feature_degree_map` is provided.

Template Parameters

  PolygonMesh | a model of `HalfedgeListGraph`
  FT | a number type. It is either deduced from the `geom_traits` Named Parameters if provided, or from the geometric traits class deduced from the point property map of `PolygonMesh`.
  EdgeIsFeatureMap | a model of `ReadWritePropertyMap` with `boost::graph_traits<PolygonMesh>::edge_descriptor` as key type and `bool` as value type. It must be default constructible.
  NamedParameters | a sequence of Named Parameters

Parameters

  pmesh | the polygon mesh
  angle_in_deg | the dihedral angle bound
  edge_is_feature_map | the property map that will contain the sharp-or-not status of each edge of `pmesh`
  np | an optional sequence of Named Parameters among the ones listed below

Optional Named Parameters

  a property map that will associate to each vertex of `pmesh` the number of incident feature edges Type: a class model of `ReadWritePropertyMap` with `boost::graph_traits<PolygonMesh>::vertex_descriptor` as key type and `int` as value type Default: `boost::get(CGAL::vertex_feature_degree_t(), pmesh)` |
  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. |

See also
  `sharp_edges_segmentation()`

## ◆ detect_vertex_incident_patches()

template<typename PolygonMesh , typename PatchIdMap , typename VertexIncidentPatchesMap , typename EdgeIsFeatureMap >

void CGAL::Polygon_mesh_processing::detect_vertex_incident_patches | ( | const PolygonMesh & | pmesh,
|  | const PatchIdMap | patch_id_map,
|  | VertexIncidentPatchesMap | vertex_incident_patches_map,
|  | const EdgeIsFeatureMap | edge_is_feature_map
| ) |  |

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

collects the surface patches of the faces incident to each vertex of the input polygon mesh.

Template Parameters

  PolygonMesh | a model of `HalfedgeListGraph`
  PatchIdMap | a model of `ReadablePropertyMap` with `boost::graph_traits<PolygonMesh>::face_descriptor` as key type and the desired patch id, model of `CopyConstructible` as value type.
  VertexIncidentPatchesMap | a model of mutable `LvaluePropertyMap` with `boost::graph_traits<PolygonMesh>::vertex_descriptor` as key type. Its value type must be a container of `boost::property_traits<PatchIdMap>::value_type` and have a function `insert()`. A `std::set` or a `boost::unordered_set` are recommended, as a patch index may be inserted several times.
  EdgeIsFeatureMap | a model of `ReadablePropertyMap` with `boost::graph_traits<PolygonMesh>::edge_descriptor` as key type and `bool` as value type.

Parameters

  pmesh | the polygon mesh
  patch_id_map | the property map containing the surface patch ids for the faces of `pmesh`. It must be already filled.
  vertex_incident_patches_map | a property map that will contain the patch ids of all the faces incident to each vertex of `pmesh`.
  edge_is_feature_map | a filled property map that will contain the sharp-or-not status of each edge of `pmesh`

See also
  `sharp_edges_segmentation()`

## ◆ region_growing_of_planes_on_faces()

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

std::size_t CGAL::Polygon_mesh_processing::region_growing_of_planes_on_faces | ( | const PolygonMesh & | mesh,
|  | RegionMap | region_map,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

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

applies a region growing algorithm to fit planes on faces of a mesh.

See Section Region Growing for more details on the method.

Template Parameters

  PolygonMesh | a model of `FaceListGraph`
  RegionMap | a model of `WritablePropertyMap` with `boost::graph_traits<PolygonMesh>::face_descriptor` as key type and `std::size_t` as value type.
  NamedParameters | a sequence of Named Parameters

Parameters

  mesh | the polygon mesh whose faces are used for region growing
  region_map | a property map storing the region index of each face. Values start at `0` up to the value returned minus `1`. `std::size_t(-1)` is put for faces with no region assigned (it can happen if `minimum_region_size > 1` or for a non-triangular face having a fitting plane not satisfying the maximum distance criterium).
  np | an optional sequence of Named Parameters among the ones listed below

Returns
  the number of regions detected

Optional Named Parameters

  the maximum distance from a face to a plane such that it is considered part of the region of the plane Type: `GeomTraits::FT` with `GeomTraits` being the type of the parameter `geom_traits` Default: 1 |
  the maximum angle (in degrees) between the normals of the supporting planes of two adjacent faces such that they are considered part of the same region Type: `GeomTraits::FT` with `GeomTraits` being the type of the parameter `geom_traits` Default: 25 degrees Extra: this parameter and `cosine_of_maximum_angle` are exclusive |
  Refit the plane primitive regularly to the region during the region growing algorithm. If false, the plane is equal to the support plane of the seed face. Type: `CGAL::Boolean_tag` Default: `CGAL::Tag_false()` Extra: Valid values are CGAL::Tag_true() or CGAL::Tag_false(). |
  Apply a postprocessing step to the output of the region growing algorithm. Type: `bool` Default: false |
  The maximum angle, given as a cosine, between the normals of the supporting planes of adjacent faces such that they are considered part of the same region Type: `GeomTraits::FT` with `GeomTraits` being the type of the parameter `geom_traits` Default: `cos(25 * PI / 180)` Extra: this parameter and `maximum_angle` are exclusive |
  the minimum number of faces such that a new region can be created from a set of faces Type: `std::size_t` Default: 1 |
  a property map associating points to the vertices of `mesh` Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<PolygonMesh>::vertex_descriptor` as key type and `Point_3` as value type Default: `boost::get(CGAL::vertex_point, mesh)` 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 property map associating normal vectors to the faces of `mesh`. Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<PolygonMesh>::face_descriptor` as key type and `GT::Vector_3` as value type, `GT` being the type of the parameter `geom_traits`. Default: If this parameter is omitted, face normals will be estimated using cross products of vectors created from consecutive vertices of the face. |
  a property map filled by this function and that will contain for each region the plane (or only its orthognonal vector) estimated that approximates it. Type: a class model of `WritablePropertyMap` with the value type of `RegionMap` as key and `GeomTraits::Plane_3` or `GeomTraits::Vector_3` as value type, `GeomTraits` being the type of the parameter `geom_traits` Default: None |

## ◆ sharp_edges_segmentation()

template<typename PolygonMesh , typename FT , typename EdgeIsFeatureMap , typename PatchIdMap , typename NamedParameters >

boost::graph_traits< PolygonMesh >::faces_size_type CGAL::Polygon_mesh_processing::sharp_edges_segmentation | ( | const PolygonMesh & | pmesh,
|  | FT | angle_in_deg,
|  | EdgeIsFeatureMap | edge_is_feature_map,
|  | PatchIdMap | patch_id_map,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

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

This function calls successively `CGAL::Polygon_mesh_processing::detect_sharp_edges()`, `CGAL::Polygon_mesh_processing::connected_components()`, and `CGAL::Polygon_mesh_processing::detect_vertex_incident_patches()`

It detects and marks the sharp edges of `pmesh` according to `angle_in_deg`. The sharp edges define a segmentation of `pmesh`, that is done by computing a surface patch id for each face.

Template Parameters

  PolygonMesh | a model of `FaceGraph`
  FT | a number type. It is either deduced from the `geom_traits` Named Parameters if provided, or from the geometric traits class deduced from the point property map of `PolygonMesh`.
  EdgeIsFeatureMap | a model of `ReadWritePropertyMap` with `boost::graph_traits<PolygonMesh>::edge_descriptor`
  PatchIdMap | a model of `ReadWritePropertyMap` with `boost::graph_traits<PolygonMesh>::face_descriptor` as key type and the desired patch id, model of `CopyConstructible` as value type.
  NamedParameters | a sequence of Named Parameters

Parameters

  pmesh | the polygon mesh
  angle_in_deg | the dihedral angle bound
  edge_is_feature_map | the property map that will contain the sharp-or-not status of each edge of `pmesh`
  patch_id_map | the property map that will contain the surface patch ids for the faces of `pmesh`.
  np | an optional sequence of Named Parameters among the ones listed below

Optional Named Parameters

  a property map that will associate to each vertex of `pmesh` the number of incident feature edges Type: a class model of `ReadWritePropertyMap` with `boost::graph_traits<PolygonMesh>::vertex_descriptor` as key type and `int` as value type Default: `boost::get(CGAL::vertex_feature_degree_t(), pmesh)` |
  the index of the first surface patch of `pmesh` Type: `std::size_t` Extra: The patches will be numbered on `[first_index; first_index + num_patches]`, where `num_patches` is the number of surface patches. |
  a property map associating to each face of `pmesh` a unique index between `0` and `num_faces(pmesh) - 1` Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<PolygonMesh>::face_descriptor` as key type and `std::size_t` as value type Default: an automatically indexed internal map |
  a property map that will contain the patch ids of all the faces incident to each vertex of `pmesh` Type: a model of mutable `LvaluePropertyMap` with `boost::graph_traits<PolygonMesh>::vertex_descriptor` as key type. Its value type must be a container of `boost::property_traits<PatchIdMap>::value_type` and have a function `insert()`. Extra: A `std::set` or a `boost::unordered_set` are recommended, as a patch index may be inserted several times. |
  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. |

Returns
  the number of surface patches.

See also
  `CGAL::Polygon_mesh_processing::detect_sharp_edges()`
  `CGAL::Polygon_mesh_processing::connected_components()`
  `CGAL::Polygon_mesh_processing::detect_vertex_incident_patches()`

Examples
  Polygon_mesh_processing/detect_features_example.cpp.