CGAL 6.2 - Polygon Mesh Processing

Loading...
Searching...
No Matches
Functions
Normal Computation
Reference Manual

##

Functions to compute unit normals for individual/all vertices or faces.

## Functions
template<typename PolygonMesh , typename NamedParameters = parameters::Default_named_parameters>
Vector_3 | CGAL::Polygon_mesh_processing::compute_face_normal (typename boost::graph_traits< PolygonMesh >::face_descriptor f, const PolygonMesh &pmesh, const NamedParameters &np=parameters::default_values())
| computes the outward unit vector normal to face `f`.
template<typename PolygonMesh , typename FaceNormalMap , typename NamedParameters = parameters::Default_named_parameters>
void | CGAL::Polygon_mesh_processing::compute_face_normals (const PolygonMesh &pmesh, FaceNormalMap face_normals, const NamedParameters &np=parameters::default_values())
| computes the outward unit vector normal for all faces of the polygon mesh.
template<typename PolygonMesh , typename NamedParameters = parameters::Default_named_parameters>
Vector_3 | CGAL::Polygon_mesh_processing::compute_vertex_normal (typename boost::graph_traits< PolygonMesh >::vertex_descriptor v, const PolygonMesh &pmesh, const NamedParameters &np=parameters::default_values())
| computes the unit normal at vertex `v` as a function of the normals of incident faces.
template<typename PolygonMesh , typename VertexNormalMap , typename NamedParameters = parameters::Default_named_parameters>
void | CGAL::Polygon_mesh_processing::compute_vertex_normals (const PolygonMesh &pmesh, VertexNormalMap vertex_normals, const NamedParameters &np=parameters::default_values())
| computes the outward unit vector normal for all vertices of the polygon mesh.
template<typename PolygonMesh , typename VertexNormalMap , typename FaceNormalMap , typename NamedParameters = parameters::Default_named_parameters>
void | CGAL::Polygon_mesh_processing::compute_normals (const PolygonMesh &pmesh, VertexNormalMap vertex_normals, FaceNormalMap face_normals, const NamedParameters &np=parameters::default_values())
| computes the outward unit vector normal for all vertices and faces of the polygon mesh.

## Function Documentation

## ◆ compute_face_normal()

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

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

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

computes the outward unit vector normal to face `f`.

Template Parameters

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

Parameters

  f | the face whose normal is computed
  pmesh | the polygon mesh containing `f`
  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 `ReadablePropertyMap` 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. |

Returns
  the computed normal. The return type is a 3D vector 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 `pmesh`.

Warning
  This function involves a square root computation. If the field type (`FT`) of the traits does not support the `sqrt()` operation, the square root computation will be performed approximately.

See also
  `compute_face_normals()`

## ◆ compute_face_normals()

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

void CGAL::Polygon_mesh_processing::compute_face_normals | ( | const PolygonMesh & | pmesh,
|  | FaceNormalMap | face_normals,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

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

computes the outward unit vector normal for all faces of the polygon mesh.

Template Parameters

  PolygonMesh | a model of `FaceListGraph`
  FaceNormalMap | a model of `WritablePropertyMap` with `boost::graph_traits<PolygonMesh>::face_descriptor` as key type and a model of `Kernel::Vector_3` as value type.

Parameters

  pmesh | the polygon mesh
  face_normals | the property map in which the normals are written
  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 `ReadablePropertyMap` 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. |

Warning
  This function involves a square root computation. If the field type (`FT`) of the traits does not support the `sqrt()` operation, the square root computation will be performed approximately.

See also
  `compute_face_normal()`

## ◆ compute_normals()

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

void CGAL::Polygon_mesh_processing::compute_normals | ( | const PolygonMesh & | pmesh,
|  | VertexNormalMap | vertex_normals,
|  | FaceNormalMap | face_normals,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

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

computes the outward unit vector normal for all vertices and faces of the polygon mesh.

Template Parameters

  PolygonMesh | a model of `VertexListGraph` and `FaceListGraph`
  VertexNormalMap | a model of `WritablePropertyMap` with `boost::graph_traits<PolygonMesh>::vertex_descriptor` as key type and a model of `Kernel::Vector_3` as value type.
  FaceNormalMap | a model of `ReadWritePropertyMap` with `boost::graph_traits<PolygonMesh>::face_descriptor` as key type and a model of `Kernel::Vector_3` as value type.

Parameters

  pmesh | the polygon mesh
  vertex_normals | the property map in which the vertex normals are written
  face_normals | the property map in which the face normals are written
  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 `ReadablePropertyMap` 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. |

Warning
  This function involves a square root computation. If the field type (`FT`) of the traits does not support the `sqrt()` operation, the square root computation will be performed approximately.

See also
  `compute_vertex_normals()`
  `compute_face_normals()`

Examples
  Polygon_mesh_processing/compute_normals_example.cpp, and Polygon_mesh_processing/compute_normals_example_Polyhedron.cpp.

## ◆ compute_vertex_normal()

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

Vector_3 CGAL::Polygon_mesh_processing::compute_vertex_normal | ( | typename boost::graph_traits< PolygonMesh >::vertex_descriptor | v,
|  | const PolygonMesh & | pmesh,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

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

computes the unit normal at vertex `v` as a function of the normals of incident faces.

The implementation is inspired by Aubry et al. "On the most 'normal' normal" [1], which aims to compute a normal that maximizes the visibility to the incident faces. If such normal does not exist or if the optimization process fails to find it, a fallback normal is computed as a sine-weighted sum of the normals of the incident faces.

Note
  The function `compute_vertex_normals()` should be preferred if normals are intended to be computed at all vertices of the graph.

Template Parameters

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

Parameters

  v | the vertex whose normal is computed
  pmesh | the polygon mesh containing `v`
  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 `ReadablePropertyMap` 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. |

Returns
  the computed normal. The return type is a 3D vector type. It is either deduced from the `geom_traits` Named Parameters if provided, or the geometric traits class deduced from the point property map of `pmesh`.

Warning
  This function involves a square root computation. If the field type (`FT`) of the traits does not support the `sqrt()` operation, the square root computation will be performed approximately.

See also
  `compute_vertex_normals()`

## ◆ compute_vertex_normals()

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

void CGAL::Polygon_mesh_processing::compute_vertex_normals | ( | const PolygonMesh & | pmesh,
|  | VertexNormalMap | vertex_normals,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

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

computes the outward unit vector normal for all vertices of the polygon mesh.

Template Parameters

  PolygonMesh | a model of `VertexListGraph` and `FaceListGraph`
  VertexNormalMap | a model of `WritablePropertyMap` with `boost::graph_traits<PolygonMesh>::vertex_descriptor` as key type and the return type of `compute_vertex_normal()` as value type.
  NamedParameters | a sequence of Named Parameters

Parameters

  pmesh | the polygon mesh
  vertex_normals | the property map in which the normals are written
  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 `ReadablePropertyMap` 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. |

Warning
  This function involves a square root computation. If the field type (`FT`) of the traits does not support the `sqrt()` operation, the square root computation will be performed approximately.

See also
  `compute_vertex_normal()`