CGAL 6.1 - Polygon Mesh Processing
Loading...
Searching...
No Matches

Functions to triangulate faces, and to refine and fair regions of a polygon mesh.

Classes

class  CGAL::Polygon_mesh_processing::Adaptive_sizing_field< PolygonMesh, VPMap >
 a sizing field describing variable target mesh edge lengths for CGAL::Polygon_mesh_processing::isotropic_remeshing(). More...
 
struct  CGAL::Polygon_mesh_processing::Triangulate_faces::Default_visitor< PolygonMesh >
 Default new face visitor model of PMPTriangulateFaceVisitor. More...
 
struct  CGAL::Polygon_mesh_processing::Triangulate_polygons::Default_visitor
 Default new polygon visitor model of PMPTriangulateFaceVisitor. More...
 
class  CGAL::Polygon_mesh_processing::Uniform_sizing_field< PolygonMesh, VPMap >
 a sizing field describing a uniform target edge length for CGAL::Polygon_mesh_processing::isotropic_remeshing(). More...
 

Functions

template<typename TriangleMesh , typename FaceRange , typename NamedParameters = parameters::Default_named_parameters>
void CGAL::Polygon_mesh_processing::angle_and_area_smoothing (const FaceRange &faces, TriangleMesh &tmesh, const NamedParameters &np=parameters::default_values())
 smooths a triangulated region of a polygon mesh.
 
template<typename TriangleMesh , typename NamedParameters = CGAL::parameters::Default_named_parameters>
void CGAL::Polygon_mesh_processing::angle_and_area_smoothing (TriangleMesh &tmesh, const NamedParameters &np=parameters::default_values())
 smooths a polygon mesh.
 
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 TriangleMesh , typename VertexRange , typename NamedParameters = parameters::Default_named_parameters>
bool CGAL::Polygon_mesh_processing::fair (TriangleMesh &tmesh, const VertexRange &vertices, const NamedParameters &np=parameters::default_values())
 fairs a region on a triangle mesh.
 
template<typename VertexRange , typename TriangleMesh , typename NamedParameters = parameters::Default_named_parameters>
void CGAL::Polygon_mesh_processing::random_perturbation (VertexRange vertices, TriangleMesh &tmesh, const double &perturbation_max_size, const NamedParameters &np=parameters::default_values())
 randomly perturbs the locations of non-border vertices of a triangulated surface mesh.
 
template<typename TriangleMesh , typename NamedParameters = parameters::Default_named_parameters>
void CGAL::Polygon_mesh_processing::random_perturbation (TriangleMesh &tmesh, const double &perturbation_max_size, const NamedParameters &np=parameters::default_values())
 randomly perturbs the locations of all non-border vertices of a triangulated surface mesh.
 
template<typename TriangleMesh , typename FaceRange , typename FaceOutputIterator , typename VertexOutputIterator , typename NamedParameters = parameters::Default_named_parameters>
std::pair< FaceOutputIterator, VertexOutputIterator > CGAL::Polygon_mesh_processing::refine (TriangleMesh &tmesh, const FaceRange &faces, FaceOutputIterator faces_out, VertexOutputIterator vertices_out, const NamedParameters &np=parameters::default_values())
 refines a region of a triangle mesh.
 
template<typename PolygonMesh , typename FaceRange , typename SizingFunction , typename NamedParameters = parameters::Default_named_parameters, typename = typename std::enable_if_t<!std::is_convertible_v<SizingFunction, double>>>
void CGAL::Polygon_mesh_processing::isotropic_remeshing (const FaceRange &faces, SizingFunction &sizing, PolygonMesh &pmesh, const NamedParameters &np=parameters::default_values())
 remeshes a triangulated region of a polygon mesh.
 
template<typename PolygonMesh , typename EdgeRange , typename SizingFunction , typename NamedParameters = parameters::Default_named_parameters, typename = typename std::enable_if_t<!std::is_convertible_v<SizingFunction, double>>>
void CGAL::Polygon_mesh_processing::split_long_edges (const EdgeRange &edges, SizingFunction &sizing, PolygonMesh &pmesh, const NamedParameters &np=parameters::default_values())
 splits the edges listed in edges into sub-edges that are not longer than the given threshold max_length.
 
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.
 
template<typename TriangleMesh , typename FaceRange , typename NamedParameters = parameters::Default_named_parameters>
void CGAL::Polygon_mesh_processing::smooth_shape (const FaceRange &faces, TriangleMesh &tmesh, const double time, const NamedParameters &np=parameters::default_values())
 smooths the overall shape of the mesh by using the mean curvature flow.
 
template<typename VertexRange , class TriangleMesh , typename NamedParameters = CGAL::parameters::Default_named_parameters>
void CGAL::Polygon_mesh_processing::tangential_relaxation (const VertexRange &vertices, TriangleMesh &tm, const NamedParameters &np=parameters::default_values())
 applies an iterative area-based tangential smoothing to the given range of vertices.
 
template<class TriangleMesh , typename NamedParameters = CGAL::parameters::Default_named_parameters>
void CGAL::Polygon_mesh_processing::tangential_relaxation (TriangleMesh &tm, const NamedParameters &np=parameters::default_values())
 applies tangential_relaxation() to all the vertices of tm.
 
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 (FaceRange face_range, PolygonMesh &pmesh, const NamedParameters &np=parameters::default_values())
 triangulates given faces of a polygon mesh.
 
template<typename PolygonMesh , typename NamedParameters = 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.
 
template<typename TriangleMesh , typename TriangleMeshOut = TriangleMesh, typename NamedParameters = parameters::Default_named_parameters>
TriangleMeshOut CGAL::Polygon_mesh_processing::surface_Delaunay_remeshing (const TriangleMesh &tmesh, const NamedParameters &np=parameters::default_values())
 remeshes a surface triangle mesh following the Delaunay refinement algorithm described in the 3D Mesh Generation package.
 

Function Documentation

◆ angle_and_area_smoothing() [1/2]

template<typename TriangleMesh , typename FaceRange , typename NamedParameters = parameters::Default_named_parameters>
void CGAL::Polygon_mesh_processing::angle_and_area_smoothing ( const FaceRange &  faces,
TriangleMesh &  tmesh,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/angle_and_area_smoothing.h>

smooths a triangulated region of a polygon mesh.

This function aims to make the triangle angle and area distributions as uniform as possible by moving (non-constrained) vertices.

Angle-based smoothing does not change the combinatorial information of the mesh. Area-based smoothing might change the combinatorial information, unless specified otherwise. It is also possible to make the smoothing algorithm "safer" by rejecting moves that, when applied, would worsen the quality of the mesh, e.g. that would decrease the value of the smallest angle around a vertex or create self-intersections.

Optionally, the points are reprojected after each iteration.

Template Parameters
TriangleMeshmodel of MutableFaceGraph.
FaceRangerange of boost::graph_traits<TriangleMesh>::face_descriptor, model of Range. Its iterator type is ForwardIterator.
NamedParametersa sequence of Named Parameters
Parameters
tmesha polygon mesh with triangulated surface patches to be smoothed.
facesthe range of triangular faces defining one or several surface patches to be smoothed.
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • the number of iterations for the sequence of the smoothing iterations performed
  • Type: unsigned int
  • Default: 1

  • value to indicate whether angle-based smoothing should be used
  • Type: Boolean
  • Default: true

  • value to indicate whether area-based smoothing should be used
  • Type: Boolean
  • Default: true

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

  • 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.

  • If true, vertex moves that would worsen the mesh are ignored.
  • Type: Boolean
  • Default: false

  • If true, area-based smoothing will be completed by a phase of Delaunay-based edge-flips to prevent the creation of elongated triangles.
  • Type: Boolean
  • Default: true

  • If true, points are projected onto the initial surface after each iteration.
  • Type: Boolean
  • Default: true

  • a property map containing the constrained-or-not status of each vertex of tmesh.
  • Type: a class model of ReadWritePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and bool as value type. It must be default constructible.
  • Default: a default property map where no vertex is constrained
  • Extra: A constrained vertex cannot be modified at all during smoothing.

  • a property map containing the constrained-or-not status of each edge of tmesh.
  • Type: a class model of ReadWritePropertyMap with boost::graph_traits<TriangleMesh>::edge_descriptor as key type and bool as value type. It must be default constructible.
  • Default: a default property map where no edge is constrained
  • Extra: A constrained edge cannot be modified at all during smoothing.
Warning
The third party library Ceres is required to use area-based smoothing.
Precondition
tmesh does not contain any degenerate faces.

◆ angle_and_area_smoothing() [2/2]

template<typename TriangleMesh , typename NamedParameters = CGAL::parameters::Default_named_parameters>
void CGAL::Polygon_mesh_processing::angle_and_area_smoothing ( TriangleMesh &  tmesh,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/angle_and_area_smoothing.h>

smooths a polygon mesh.

This function aims to make the triangle angle and area distributions as uniform as possible by moving (non-constrained) vertices.

Angle-based smoothing does not change the combinatorial information of the mesh. Area-based smoothing might change the combinatorial information, unless specified otherwise. It is also possible to make the smoothing algorithm "safer" by rejecting moves that, when applied, would worsen the quality of the mesh, e.g. that would decrease the value of the smallest angle around a vertex or create self-intersections.

Optionally, the points are reprojected after each iteration.

See the overload which takes a face range as additional parameter for a comprehensive description of the parameters.

◆ 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
InputMesha model of FaceListGraph
OutputMesha model of FaceListGraph and MutableFaceGraph
NamedParameters1a sequence of Named Parameters for InputMesh
NamedParameters2a sequence of Named Parameters for OutputMesh
BottomFunctora 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.
TopFunctora functor providing a similar operator() as BottomFunctor.
Parameters
inputan open surface mesh to extrude.
outputa surface mesh that will contain the result of the extrusion.
botfunctor that will transform all points copied from input in order to shape the bottom part of the extrusion.
topfunctor that will transform all points copied from input in order to shape the top part of the extrusion.
np_inan 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_outan 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
Polygon_mesh_processing/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
InputMesha model of the concept FaceListGraph
OutputMesha model of the concept FaceListGraph and MutableFaceGraph
Vector_3vector type from the same CGAL kernel as the point of the vertex point map used for OutputMesh.
NamedParameters1a sequence of Named Parameters for InputMesh
NamedParameters2a sequence of Named Parameters for OutputMesh
Parameters
inputan open surface mesh to extrude
outputa surface mesh that will contain the result of the extrusion
vthe vector defining the direction of the extrusion
np_inan 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_outan 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.

◆ fair()

template<typename TriangleMesh , typename VertexRange , typename NamedParameters = parameters::Default_named_parameters>
bool CGAL::Polygon_mesh_processing::fair ( TriangleMesh &  tmesh,
const VertexRange &  vertices,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/fair.h>

fairs a region on a triangle mesh.

The points of the selected vertices are relocated to yield an as-smooth-as-possible surface patch, based on solving a linear bi-Laplacian system with boundary constraints, described in [4]. The optional parameter fairing_continuity gives the ability to control the tangential continuity C n of the output mesh.

The region described by vertices might contain multiple disconnected components. Note that the mesh connectivity is not altered in any way, only vertex locations get updated.

Fairing might fail if fixed vertices, which are used as boundary conditions, do not suffice to solve constructed linear system.

Note that if the vertex range to which fairing is applied contains all the vertices of the triangle mesh, fairing does not fail, but the mesh gets shrunk to CGAL::ORIGIN.

Template Parameters
TriangleMesha model of FaceGraph and MutableFaceGraph
VertexRangea range of vertex descriptors of TriangleMesh, model of Range. Its iterator type is InputIterator.
NamedParametersa sequence of Named Parameters
Parameters
tmeshthe triangle mesh with patches to be faired
verticesthe vertices of the patches to be faired (the positions of only those vertices will be changed)
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • a property map associating points to the vertices of tmesh
  • Type: a class model of ReadablePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and Point_3 as value type
  • Default: boost::get(CGAL::vertex_point, tmesh)
  • Extra: If this parameter is omitted, an internal property map for CGAL::vertex_point_t should be available for the vertices of tmesh.

  • A value controlling the tangential continuity of the output surface patch. The possible values are 0, 1 and 2, referring to the C0, C1 and C2 continuity.
  • Type: unsigned int
  • Default: 1
  • Extra: The larger fairing_continuity gets, the more fixed vertices are required.

Returns
true if fairing is successful, otherwise no vertices are relocated.
Precondition
is_triangle_mesh(tmesh)
Warning
This function involves linear algebra, that is computed using non-exact, floating-point arithmetic.
Todo:
accuracy of solvers are not good, for example when there is no boundary condition pre_factor should fail, but it does not.

◆ isotropic_remeshing()

template<typename PolygonMesh , typename FaceRange , typename SizingFunction , typename NamedParameters = parameters::Default_named_parameters, typename = typename std::enable_if_t<!std::is_convertible_v<SizingFunction, double>>>
void CGAL::Polygon_mesh_processing::isotropic_remeshing ( const FaceRange &  faces,
SizingFunction &  sizing,
PolygonMesh &  pmesh,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/remesh.h>

remeshes a triangulated region of a polygon mesh.

This operation sequentially performs edge splits, edge collapses, edge flips, tangential relaxation and projection to the initial surface to generate a smooth mesh with a prescribed edge length.

Template Parameters
PolygonMeshmodel of MutableFaceGraph. The descriptor types boost::graph_traits<PolygonMesh>::face_descriptor and boost::graph_traits<PolygonMesh>::halfedge_descriptor must be models of Hashable.
FaceRangerange of boost::graph_traits<PolygonMesh>::face_descriptor, model of Range. Its iterator type is ForwardIterator.
SizingFunctionmodel of PMPSizingField
NamedParametersa sequence of Named Parameters
Parameters
pmesha polygon mesh with triangulated surface patches to be remeshed
facesthe range of triangular faces defining one or several surface patches to be remeshed
sizingfield that determines a target length for individual edges. If a number convertible to a double is passed, Uniform_sizing_field() will be used, with the number as a target edge length. If 0 is passed then only the edge-flip, tangential relaxation, and projection steps will be done.
npan optional sequence of Named Parameters among the ones listed below
Precondition
if constraints protection is activated, the constrained edges must not be longer than 4/3*target_edge_length.
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.
  • Extra: Exact constructions kernels are not supported by this function.

  • 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

  • the number of iterations for the sequence of atomic operations performed (listed in the above description)
  • Type: unsigned int
  • Default: 1

  • a property map containing the constrained-or-not status of each edge of pmesh
  • Type: a class model of ReadWritePropertyMap with boost::graph_traits<PolygonMesh>::edge_descriptor as key type and bool as value type. It must be default constructible.
  • Default: a default property map where no edge is constrained
  • Extra: A constrained edge can be split or collapsed, but not flipped, nor its endpoints moved by smoothing.
  • Extra: Sub-edges generated by splitting are set to be constrained.
  • Extra: Patch boundary edges (i.e. incident to only one face in the range) are always considered as constrained edges.

  • a property map containing the constrained-or-not status of each vertex of pmesh.
  • Type: a class model of ReadWritePropertyMap with boost::graph_traits<PolygonMesh>::vertex_descriptor as key type and bool as value type. It must be default constructible.
  • Default: a default property map where no vertex is constrained
  • Extra: A constrained vertex cannot be modified during remeshing.

  • If true, the edges set as constrained in edge_is_constrained_map (or by default the boundary edges) are neither split nor collapsed during remeshing.
  • Type: Boolean
  • Default: false
  • Extra: Note that around constrained edges that have their length higher than twice target_edge_length, remeshing will fail to provide good quality results. It can even fail to terminate because of cascading vertex insertions.

  • If true, the edges set as constrained in edge_is_constrained_map (or by default the boundary edges) are collapsed during remeshing.
  • Type: Boolean
  • Default: true
  • Extra: This value is ignored if protect_constraints is true.

  • a property map with the patch id's associated to the faces of faces
  • Type: a class model of ReadWritePropertyMap with boost::graph_traits<PolygonMesh>::face_descriptor as key type and the desired property, model of CopyConstructible and LessThanComparable as value type.
  • Default: a default property map where each face is associated with the ID of the connected component it belongs to. Connected components are computed with respect to the constrained edges listed in the property map edge_is_constrained_map
  • Extra: The map is updated during the remeshing process while new faces are created.

  • whether edges that are too long with respect to the given sizing are split
  • Type: Boolean
  • Default: true

  • whether edges that are too short with respect to the given sizing are collapsed
  • Type: Boolean
  • Default: true

  • whether edge flips are performed to improve shape and valence
  • Type: Boolean
  • Default: true

  • the number of iterations of tangential relaxation that are performed at each iteration of the remeshing process
  • Type: unsigned int
  • Default: 1

  • If true, the end vertices of the edges set as constrained in edge_is_constrained_map and boundary edges move along the constrained polylines they belong to.
  • Type: Boolean
  • Default: false

  • A function object used to determinate if a vertex move should be allowed or not during the relaxation step.
  • Type: Functor that provides bool operator()(vertex_descriptor v, Point_3 src, Point_3 tgt) returning true if the vertex v can be moved from src to tgt; Point_3 being the value type of the vertex point map
  • Default: If not provided, all moves are allowed.

  • whether vertices should be reprojected on the input surface after creation or displacement
  • Type: Boolean
  • Default: true

  • A function object used to project input vertices (moved by the smoothing) and created vertices
  • Type: Unary functor that provides Point_3 operator()(vertex_descriptor), Point_3 being the value type of the vertex point map.
  • Default: If not provided, vertices are projected on the input surface mesh.
See also
split_long_edges()
Todo:
Deal with exact constructions Kernel. The only thing that makes sense is to guarantee that the output vertices are exactly on the input surface. To do so, we can do every construction in double, and use an exact process for projection. For each vertex, the AABB_tree would be used in an inexact manner to find the triangle on which projection has to be done. Then, use CGAL::intersection(triangle, line) in the exact constructions kernel to get a point which is exactly on the surface.
Examples
Polygon_mesh_processing/hausdorff_distance_remeshing_example.cpp.

◆ random_perturbation() [1/2]

template<typename TriangleMesh , typename NamedParameters = parameters::Default_named_parameters>
void CGAL::Polygon_mesh_processing::random_perturbation ( TriangleMesh &  tmesh,
const double &  perturbation_max_size,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/random_perturbation.h>

randomly perturbs the locations of all non-border vertices of a triangulated surface mesh.

By default, the vertices are re-projected onto the input surface after perturbation. Note that no geometric checks are performed after the perturbation (self-intersections might be introduced).

Template Parameters
TriangleMeshmodel of VertexListGraph.
NamedParametersa sequence of Named Parameters
Parameters
tmeshthe triangulated surface mesh
perturbation_max_sizethe maximal length of moves that can be applied to vertices of tmesh.
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • a property map associating points to the vertices of tmesh
  • Type: a class model of ReadWritePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and Point_3 as value type
  • Default: boost::get(CGAL::vertex_point, tmesh)

  • 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 containing the constrained-or-not status of each vertex of tmesh
  • Type: a class model of ReadWritePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and bool as value type. It must be default constructible.
  • Default: a default property map where no vertex is constrained
  • Extra: A constrained vertex cannot be modified at all during perturbation

  • indicates whether vertices are reprojected on the input surface after their coordinates random perturbation
  • Type: Boolean
  • Default: true

  • a value to seed the random number generator, and make the perturbation deterministic
  • Type: unsigned int
  • Default: unsigned int(-1)

◆ random_perturbation() [2/2]

template<typename VertexRange , typename TriangleMesh , typename NamedParameters = parameters::Default_named_parameters>
void CGAL::Polygon_mesh_processing::random_perturbation ( VertexRange  vertices,
TriangleMesh &  tmesh,
const double &  perturbation_max_size,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/random_perturbation.h>

randomly perturbs the locations of non-border vertices of a triangulated surface mesh.

By default, the vertices are re-projected onto the input surface after perturbation. Note that no geometric checks are performed after the perturbation (self-intersections might be introduced).

Template Parameters
VertexRangemodel of Range, holding vertices of type boost::graph_traits<TriangleMesh>::vertex_descriptor. Its iterator type is ForwardIterator.
TriangleMeshmodel of VertexListGraph.
NamedParametersa sequence of Named Parameters
Parameters
verticesthe range of vertices to be perturbed
tmeshthe triangulated surface mesh
perturbation_max_sizethe maximal length of moves that can be applied to vertices of tmesh.
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • a property map associating points to the vertices of tmesh
  • Type: a class model of ReadWritePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and Point_3 as value type
  • Default: boost::get(CGAL::vertex_point, tmesh)

  • 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 containing the constrained-or-not status of each vertex of tmesh
  • Type: a class model of ReadWritePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and bool as value type. It must be default constructible.
  • Default: a default property map where no vertex is constrained
  • Extra: A constrained vertex cannot be modified at all during perturbation

  • indicates whether vertices are reprojected on the input surface after their coordinates random perturbation
  • Type: Boolean
  • Default: true

  • a value to seed the random number generator, and make the perturbation deterministic
  • Type: unsigned int
  • Default: unsigned int(-1)

◆ refine()

template<typename TriangleMesh , typename FaceRange , typename FaceOutputIterator , typename VertexOutputIterator , typename NamedParameters = parameters::Default_named_parameters>
std::pair< FaceOutputIterator, VertexOutputIterator > CGAL::Polygon_mesh_processing::refine ( TriangleMesh &  tmesh,
const FaceRange &  faces,
FaceOutputIterator  faces_out,
VertexOutputIterator  vertices_out,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/refine.h>

refines a region of a triangle mesh.

Template Parameters
TriangleMeshmodel of MutableFaceGraph
FaceRangerange of face descriptors, model of Range. Its iterator type is InputIterator.
FaceOutputIteratormodel of OutputIterator holding boost::graph_traits<TriangleMesh>::face_descriptor for patch faces
VertexOutputIteratormodel of OutputIterator holding boost::graph_traits<TriangleMesh>::vertex_descriptor for patch vertices
NamedParametersa sequence of Named Parameters
Parameters
tmeshtriangle mesh with patches to be refined
facesthe range of faces defining the patches to refine
faces_outoutput iterator into which descriptors of new faces are recorded
vertices_outoutput iterator into which descriptors of new vertices are recorded
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • a property map associating points to the vertices of tmesh
  • Type: a class model of ReadWritePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and Point_3 as value type
  • Default: boost::get(CGAL::vertex_point, tmesh)
  • Extra: If this parameter is omitted, an internal property map for CGAL::vertex_point_t must be available in TriangleMesh.

  • a factor to control density of the output mesh, where larger values lead to denser refinements
  • Type: double
  • Default: \( \sqrt{2}\)
  • Extra: The density of vertices of faces_out is this factor times higher than the vertices of faces.
Returns
pair of faces_out and vertices_out
Precondition
is_triangle_mesh(tmesh)
Todo:
current algorithm iterates 10 times at most, since (I guess) there is no termination proof.

◆ 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
TriangleMeshIna model of HalfedgeListGraph and FaceListGraph
PolygonMeshOuta model of MutableFaceGraph
FacePatchMapa class model of ReadablePropertyMap with boost::graph_traits<TriangleMeshIn>::face_descriptor as key type and std::size_t as value type
EdgeIsConstrainedMapa class model of ReadablePropertyMap with boost::graph_traits<TriangleMeshIn>::edge_descriptor as key type and bool as value type
VertexCornerMapa class model of ReadablePropertyMap with boost::graph_traits<TriangleMeshIn>::vertex_descriptor as key type and std::size_t as value type
NamedParametersIna sequence of Named Parameters
NamedParametersOuta sequence of Named Parameters
Parameters
tm_ininput triangle mesh
pm_outoutput polygon mesh
nb_patchesthe number of patches in the partition
nb_cornersthe number of corners
face_patch_mapa property map that contains for each face the id of its patch in the range [0, nb_patches]
vertex_corner_mapa 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.
ecma property map that contains true if an edge is on the border of a patch and false otherwise.
np_inan 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_outan 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

◆ 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
TriangleMeshIna model of HalfedgeListGraph and FaceListGraph
PolygonMeshOuta model of MutableFaceGraph
NamedParametersIna sequence of Named Parameters
NamedParametersOuta sequence of Named Parameters
Parameters
tm_ininput triangle mesh
pm_outoutput polygon mesh
np_inan 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_outan 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

◆ smooth_shape()

template<typename TriangleMesh , typename FaceRange , typename NamedParameters = parameters::Default_named_parameters>
void CGAL::Polygon_mesh_processing::smooth_shape ( const FaceRange &  faces,
TriangleMesh &  tmesh,
const double  time,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/smooth_shape.h>

smooths the overall shape of the mesh by using the mean curvature flow.

The effect depends on the curvature of each area and on a time step which represents the amount by which vertices are allowed to move. The result conformally maps the initial surface to a sphere.

Template Parameters
TriangleMeshmodel of MutableFaceGraph.
FaceRangerange of boost::graph_traits<TriangleMesh>::face_descriptor, model of Range. Its iterator type is ForwardIterator.
NamedParametersa sequence of Named Parameters
Parameters
tmesha polygon mesh with triangulated surface patches to be smoothed.
facesthe range of triangular faces defining one or several surface patches to be smoothed.
timea time step that corresponds to the speed by which the surface is smoothed. A larger time step results in faster convergence but details may be distorted to a larger extent compared to more iterations with a smaller step. Typical values scale in the interval (1e-6, 1].
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • the number of iterations for the sequence of the smoothing iterations performed
  • Type: unsigned int
  • Default: 1

  • a property map containing the constrained-or-not status of each vertex of tmesh.
  • Type: a class model of ReadWritePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and bool as value type. It must be default constructible.
  • Default: a default property map where no vertex is constrained
  • Extra: A constrained vertex cannot be modified at all during smoothing.

  • Whether to apply rescaling after smoothing. This is useful because the mean curvature flow tends to shrink the surface.
  • Type: Boolean
  • Default: true
  • Extra: Scaling can only be applied if the mesh is closed and if there is no more than a single constrained vertex.
  • Extra: If a vertex is constrained, it is the fixed point of the scaling, otherwise the centroid is used.

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

  • 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 linear algebra, that is computed using non-exact, floating-point arithmetic.
See also
angle_and_area_smoothing()

◆ split_long_edges()

template<typename PolygonMesh , typename EdgeRange , typename SizingFunction , typename NamedParameters = parameters::Default_named_parameters, typename = typename std::enable_if_t<!std::is_convertible_v<SizingFunction, double>>>
void CGAL::Polygon_mesh_processing::split_long_edges ( const EdgeRange &  edges,
SizingFunction &  sizing,
PolygonMesh &  pmesh,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/remesh.h>

splits the edges listed in edges into sub-edges that are not longer than the given threshold max_length.

Note this function is useful to split constrained edges before calling isotropic_remeshing() with protection of constraints activated (to match the constrained edge length required by the remeshing algorithm to be guaranteed to terminate)

Template Parameters
PolygonMeshmodel of MutableFaceGraph that has an internal property map for CGAL::vertex_point_t.
EdgeRangerange of boost::graph_traits<PolygonMesh>::edge_descriptor, model of Range. Its iterator type is InputIterator.
SizingFunctionmodel of PMPSizingField
NamedParametersa sequence of Named Parameters
Parameters
pmesha polygon mesh
edgesthe range of edges to be split if they are longer than given threshold
sizingthe sizing function that is used to split edges from 'edges' list. If a number convertible to a double is passed, Uniform_sizing_field() will be used, with the number as target edge length.
npan 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.

  • 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 with the patch id's associated to the faces of faces
  • Type: a class model of ReadWritePropertyMap with boost::graph_traits<PolygonMesh>::face_descriptor as key type and the desired property, model of CopyConstructible and LessThanComparable as value type.
  • Default: a default property map where each face is associated with the ID of the connected component it belongs to. Connected components are computed with respect to the constrained edges listed in the property map edge_is_constrained_map
  • Extra: The map is updated during the remeshing process while new faces are created.

  • a property map containing the constrained-or-not status of each edge of pmesh
  • Type: a class model of ReadWritePropertyMap with boost::graph_traits<PolygonMesh>::edge_descriptor as key type and bool as value type. It must be default constructible.
  • Default: a default property map where no edge is constrained
  • Extra: A constrained edge can be split or collapsed, but not flipped, nor its endpoints moved by smoothing.
See also
isotropic_remeshing()

◆ surface_Delaunay_remeshing()

template<typename TriangleMesh , typename TriangleMeshOut = TriangleMesh, typename NamedParameters = parameters::Default_named_parameters>
TriangleMeshOut CGAL::Polygon_mesh_processing::surface_Delaunay_remeshing ( const TriangleMesh &  tmesh,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/surface_Delaunay_remeshing.h>

remeshes a surface triangle mesh following the Delaunay refinement algorithm described in the 3D Mesh Generation package.

Template Parameters
TriangleMeshmodel of FaceListGraph
TriangleMeshOutmodel of FaceListGraph, model of DefaultConstructible, with an internal property map for CGAL::vertex_point_t with geom_traits::Point_3 as value type.
NamedParametersa sequence of Named Parameters
Parameters
tmesha triangle surface mesh
npan optional sequence of Named Parameters among the ones listed below
Returns
the triangulated surface mesh following the requirements of the input meshing criteria
Optional Named Parameters
  • 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.
  • Extra: Exact construction kernels are not supported by this function.

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

  • the dihedral angle bound (in degrees) for detection of feature edges
  • Type: A number type FT, either deduced from the geom_traits Named Parameters if provided, or from the geometric traits class deduced from the point property map of TriangleMesh.
  • Default: 60
  • Extra: Border edges are protected, along with detected sharp edges.
  • Extra: If the given value is 180, only the border edges are protected.

  • a property map containing the constrained-or-not status of each edge of tmesh
  • Type: a class model of ReadWritePropertyMap with boost::graph_traits<TriangleMesh>::edge_descriptor as key type and bool as value type. It must be default constructible.
  • Default: a default property map where no edge is constrained

  • a set of polylines that will be resampled and appear as protected polyline constraints in the output mesh
  • Type: a class model of Range, of which value type is model of MeshPolyline_3
  • Default: an empty range of segments

  • If true, the feature edges of the input are re-sampled and present in the output mesh. If edge_is_constrained_map is provided, the corresponding "constrained" edges are protected. Else, if polyline_constraints is provided, the corresponding polylines are protected. Otherwise, features_angle_bound is used, and the edges that form a sharp dihedral angle with respect to that bound are protected.
  • Type: Boolean
  • Default: false
  • Extra: Note that only one of these three input parameters is taken into account, in the priority order listed above.

  • a property map with the patch id's associated to the faces of faces
  • Type: a class model of ReadWritePropertyMap with boost::graph_traits<TriangleMesh>::face_descriptor as key type and the desired property, model of CopyConstructible and LessThanComparable, as value type.
  • Default: a default property map where each face is associated with the ID of the connected component it belongs to. Connected components are computed with respect to the constrained edges listed in the property map edge_is_constrained_map.
  • Extra: The map is updated during the remeshing process while new faces are created.

  • A scalar field (resp. a constant) providing a space-varying (resp. a uniform) upper bound for the lengths of curve edges. This parameter has to be set to a positive value when 1-dimensional features protection is used (when protect_constraints is true).
  • Type: A number type FT model of the concept Field, or a model of the concept MeshDomainField_3
  • Default: (std::numeric_limits<FT>::max)(), with FT a number type, either deduced from the geom_traits Named Parameters if provided, or from the geometric traits class deduced from the point property map of TriangleMesh.

  • A scalar field (resp. a constant) describing a space-varying (resp. a uniform) upper bound for the radii of the surface Delaunay balls.
  • Type: A number type FT model of the concept Field, or a model of the concept MeshDomainField_3
  • Default: 0.

  • A lower bound for the angles (in degrees) of the surface mesh facets.
  • Type: A number type FT model of the concept Field
  • Default: 0.

  • A scalar field (resp. a constant) describing a space-varying (resp. a uniform) upper bound for the distance between the facet circumcenter and the center of its surface Delaunay ball.
  • Type: A number type FT model of the concept Field, or a model of the concept MeshDomainField_3
  • Default: 0.

Precondition
tmesh must be free of self-intersections.
Note
Only one of the named parameters defining constrained edges is taken into account for meshing, in the following priority order : edge_is_constrained_map, polyline_constraints, and features_angle_bound. The selected edges are protected only if protect_constraints is set to true.

◆ tangential_relaxation()

template<typename VertexRange , class TriangleMesh , typename NamedParameters = CGAL::parameters::Default_named_parameters>
void CGAL::Polygon_mesh_processing::tangential_relaxation ( const VertexRange &  vertices,
TriangleMesh &  tm,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/tangential_relaxation.h>

applies an iterative area-based tangential smoothing to the given range of vertices.

Each vertex v is relocated to its gravity-weighted centroid, and the relocation vector is projected back to the tangent plane to the surface at v, iteratively. The connectivity remains unchanged.

Template Parameters
TriangleMeshmodel of FaceGraph and VertexListGraph. The descriptor types boost::graph_traits<TriangleMesh>::face_descriptor and boost::graph_traits<TriangleMesh>::halfedge_descriptor must be models of Hashable.
VertexRangerange of boost::graph_traits<TriangleMesh>::vertex_descriptor, model of Range. Its iterator type is ForwardIterator.
NamedParametersa sequence of Named Parameters
Parameters
verticesthe range of vertices which will be relocated by relaxation
tmthe triangle mesh to which vertices belong
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • a property map associating points to the vertices of tm
  • Type: a class model of ReadWritePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and Point_3 as value type
  • Default: boost::get(CGAL::vertex_point, tm)
  • Extra: If this parameter is omitted, an internal property map for CGAL::vertex_point_t must be available in TriangleMesh.

  • an instance of a geometric traits class
  • Type: a class model of Kernel
  • Default: a CGAL Kernel deduced from the Point_3 type, using CGAL::Kernel_traits
  • Extra: The geometric traits class must be compatible with the vertex Point_3 type.
  • Extra: Exact constructions kernels are not supported by this function.

  • the number of smoothing iterations
  • Type: unsigned int
  • Default: 1

  • a property map containing the constrained-or-not status of each edge of tm. The endpoints of a constrained edge cannot be moved by relaxation.
  • Type: a class model of ReadWritePropertyMap with boost::graph_traits<TriangleMesh>::edge_descriptor as key type and bool as value type. It must be default constructible.
  • Default: a default property map where no edges are constrained
  • Extra: Boundary edges are always considered as constrained edges.

  • a property map containing the constrained-or-not status of each vertex of tm. A constrained vertex cannot be modified during relaxation.
  • Type: a class model of ReadWritePropertyMap with boost::graph_traits<PolygonMesh>::vertex_descriptor as key type and bool as value type. It must be default constructible.
  • Default: a default property map where no vertices are constrained

  • If true, the end vertices of the edges set as constrained in edge_is_constrained_map and boundary edges move along the constrained polylines they belong to.
  • Type: Boolean
  • Default: false

  • A function object used to determinate if a vertex move should be allowed or not
  • Type: Unary functor that provides bool operator()(vertex_descriptor v, Point_3 src, Point_3 tgt) returning true if the vertex v can be moved from src to tgt; Point_3 being the value type of the vertex point map
  • Default: If not provided, all moves are allowed.

  • An object containing sizing field for individual vertices. Used to derive smoothing weights.
  • Type: A model of PMPSizingField.
  • Default: If not provided, smoothing weights are the same for all vertices.

Todo:
check if it should really be a triangle mesh or if a polygon mesh is fine

◆ 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
PolygonMesha model of FaceListGraph and MutableFaceGraph
NamedParametersa sequence of Named Parameters
Parameters
fface to be triangulated
pmeshthe polygon mesh to which the face to be triangulated belongs
npan 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.

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 ( 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
FaceRangerange of boost::graph_traits<PolygonMesh>::face_descriptor, model of Range. Its iterator type is InputIterator.
PolygonMesha model of FaceListGraph and MutableFaceGraph
NamedParametersa sequence of Named Parameters
Parameters
face_rangethe range of faces to be triangulated
pmeshthe polygon mesh to be triangulated
npan 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.

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
Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp.

◆ triangulate_faces() [2/2]

template<typename PolygonMesh , typename NamedParameters = 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
PolygonMesha model of FaceListGraph and MutableFaceGraph
NamedParametersa sequence of Named Parameters
Parameters
pmeshthe polygon mesh to be triangulated
npan 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.

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
PointRangea model of ConstRange. The value type of its iterator is the point type.
PolygonRangea 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.
NamedParametersa sequence of Named Parameters
Parameters
pointsthe point geometry of the soup to be triangulated
polygonsthe polygons to be triangulated
npan 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.

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()