The function perturb_mesh_3() is a mesh optimizer that improves the quality of a Delaunay mesh by changing the positions of some vertices of the mesh. More...

The function exude_mesh_3() performs a sliver exudation process on a Delaunay mesh.

The sliver exudation process consists in optimizing the weights of vertices of the weighted Delaunay triangulation in such a way that slivers disappear and the quality of the mesh improves.

Warning

This optimizer modifies the weight of vertices of the triangulation and, if called, must be the last optimizer to be called. If the mesh is refined after this optimization has been performed, all improvements will be lost.

the initial mesh that will be modified by the algorithm to represent the final optimized mesh.

np

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

Optional Named Parameters

is used to set up, in seconds, a CPU time limit after which the optimization process is stopped. This time is measured using the Real_timer class. The default value is 0 and means that there is no time limit.

Type: double

Precondition: time_limit >= 0

Default: 0

is designed to give, in degrees, a targeted lower bound on dihedral angles of mesh cells. The exudation process considers in turn all the mesh cells that have a smallest dihedral angle less than sliver_bound and tries to make them disappear by weighting their vertices. The optimization process stops when every cell in the mesh achieves this quality. The default value is 0 and means that there is no targeted bound: the exuder then runs as long as it can improve the smallest dihedral angles of the set of cells incident to some vertices.

CGAL::CANT_IMPROVE_ANYMORE when exudation process stops because it can no longer improve the smallest dihedral angle of the set of cells incident to some vertex in the mesh.

Example

// Exude without sliver_bound, using at most 10s CPU time

Free function that generates a CGAL::Image_3 of weights associated to each voxel of image, to make the output mesh surfaces smoother.

The weights image is generated using the algorithm described by Stalling et al in [17]. The Insight toolkit is needed to compile this function.

Parameters

image

the input labeled image from which the weights image is computed. Both will then be used to construct a Labeled_mesh_domain_3.

sigma

the standard deviation parameter of the internal Gaussian filter, measured in real-world distances. The size of a voxel (e.g. shortest length or longest length) usually is a good value for this parameter. Note that if sigma is too small, the "stair-effect" of meshing from a voxel image can appear. On the other side, if sigma is too large, thin volumes (basically one voxel thick) may be lost in the meshing process because the computed weights are too blurry.

The function lloyd_optimize_mesh_3() is a mesh optimization process based on the minimization of a global energy function.

In lloyd_optimize_mesh_3(), the minimized global energy may be interpreted as the \( L^1\)-norm of the error achieved when the function \( x^2\) is interpolated on the mesh domain using a piecewise linear function which is linear in each cell of the Voronoi diagram of the mesh vertices.

The optimizer lloyd_optimize_mesh_3() works in iterative steps. At each iteration, mesh vertices are moved into positions that bring to zero the energy gradient and the Delaunay triangulation is updated. Vertices on the mesh boundaries are handled in a special way so as to preserve an accurate representation of the domain boundaries.

the initial mesh that will be modified by the algorithm to represent the final optimized mesh.

domain

the domain used to create the c3t3 parameter

np

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

Optional Named Parameters

to set up, in seconds, a CPU time limit after which the optimization process is stopped. This time is measured using CGAL::Real_timer. 0 means that there is no time limit.

Type: double

Precondition: time_limit >= 0

Default: 0

limit on the number of performed iterations. 0 means that there is no limit on the number of performed iterations.

Precondition: max_iteration_number >=0

Type: int

Default: 0

designed to reduce running time of each optimization iteration. Any vertex that has a displacement less than a given fraction of the length of its shortest incident edge, is frozen (i.e. is not relocated). The parameter freeze_bound gives the threshold ratio. If it is set to 0, freezing of vertices is disabled.

Precondition: 0<= freeze_bound <=1

Type: double

Default: 0.01

threshold ratio of stopping criterion based on convergence: the optimization process is stopped when at the last iteration the displacement of any vertex is less than a given fraction of the length of the shortest edge incident to that vertex.

Precondition: 0 <=convergence <= 1

Type: double

Default: 0.02

completes the freeze_bound parameter. If it is set to true (default value), frozen vertices will not move anymore in next iterations. Otherwise, at each iteration, any vertex that moves, unfreezes all its incident vertices.

It produces simplicial meshes which discretize 3D domains.

The mesh generation algorithm is a Delaunay refinement process followed by an optimization phase. The criteria driving the Delaunay refinement process may be tuned to achieve the user needs with respect to the size of mesh elements, the accuracy of boundaries approximation, etc.

The optimization phase is a sequence of optimization processes, amongst the following available optimizers: an ODT-smoothing, a Lloyd-smoothing, a sliver perturber, and a sliver exuder. Each optimization process can be activated or not, according to the user requirements and available time. By default, only the perturber and the exuder are activated. Note that the benefits of the exuder will be lost if the mesh is further refined afterward, and that ODT-smoothing, Lloyd-smoothing, and sliver perturber should never be called after the sliver exuder. In the case of further refinement, only the sliver exuder can be used.

The function outputs the mesh to an object which provides iterators to traverse the resulting mesh data structure or can be written to a file (see Examples ).

either a model of the concept MeshDomain_3 or of MeshDomainWithFeatures_3 if 0 and 1-dimensional features of the input complex have to be accurately represented in the mesh.

the domain used to create the c3t3 parameter. It is the sole link through which the domain to be discretized is known by the mesh generation algorithm.

criteria

specifies the size and shape requirements for mesh tetrahedra and surface facets. These criteria form the rules which drive the refinement process. All mesh elements satisfy those criteria at the end of the refinement process. In addition, if the domain has features, the argument criteria provides a sizing field to guide the discretization of 1-dimensional exposed features.

np

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

Optional Named Parameters

If the domain is a model of MeshDomainWithFeatures_3, 0 and 1-dimensional features can be taken into account while generating the mesh. The following two named parameters control this option:

In order to drive the meshing algorithm and ensure that the output mesh follows a desired topological criterion, three named parameters control this option:

Note that regardless of which optimization processes are activated, they are always launched in the order that is a suborder of the following (see user manual for further details): ODT-smoother, Lloyd-smoother, perturber, and exuder.

Beware that optimization of the mesh is obtained by perturbing mesh vertices and modifying the mesh connectivity and that this has an impact on the strict compliance to the refinement criteria. Though a strict compliance to mesh criteria is guaranteed at the end of the Delaunay refinement, this may no longer be true after some optimization processes. Also beware that the default behavior does involve some optimization processes.

The function odt_optimize_mesh_3() is a mesh optimization process based on the minimization of a global energy function.

In odt_optimize_mesh_3(), the minimized global energy may be interpreted as the \( L^1\)-norm of the error achieved when the function \( x^2\) is interpolated on the mesh domain using a piecewise linear function which is linear in each mesh cell.

The optimizer odt_optimize_mesh_3() works in iterative steps. At each iteration, mesh vertices are moved into positions that bring to zero the energy gradient and the Delaunay triangulation is updated. Vertices on the mesh boundaries are handled in a special way so as to preserve an accurate representation of the domain boundaries.

the initial mesh and is modified by the algorithm to represent the final optimized mesh.

domain

the domain used to create the c3t3 parameter

np

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

Optional Named Parameters

is used to set up, in seconds, a CPU time limit after which the optimization process is stopped. This time is measured using Real_timer. The default value is 0 and means that there is no time limit.

Type: double

Precondition: time_limit >= 0

Default: 0

sets a limit on the number of performed iterations. The default value of 0 means that there is no limit on the number of performed iterations.

Type: std::size_t

Default: 0

is a stopping criterion based on convergence: the optimization process is stopped, when at the last iteration, the displacement of any vertex is less than a given percentage of the length the shortest edge incident to that vertex. The parameter convergence gives the threshold ratio.

Type: double

Precondition: 0 <= convergence <= 1

Default: 0.02

is designed to reduce running time of each optimization iteration. Any vertex that has a displacement less than a given percentage of the length of its shortest incident edge, is frozen (i.e. is not relocated). The parameter freeze_bound gives the threshold ratio.

Type: double

Precondition: 0 <= freeze_bound <= 1

Default: 0.01

completes the freeze_bound parameter. If it is set to true, frozen vertices will not move anymore in next iterations. Otherwise, at each iteration, any vertex that moves, unfreezes all its incident vertices.

The function perturb_mesh_3() is a mesh optimizer that improves the quality of a Delaunay mesh by changing the positions of some vertices of the mesh.

The perturber tries to improve the dihedral angles of the worst cells in the mesh degree by degree: the step number n is considered as successful if after this step the worst tetrahedron of the mesh has a minimal dihedral angle larger than n degrees. The perturber exits if this is not the case.

the initial mesh, modified by the algorithm to represent the final optimized mesh

domain

the domain used to create the c3t3 parameter

np

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

Optional Named Parameters

is used to set up, in seconds, a CPU time limit after which the optimization process is stopped. This time is measured using the Real_timer class. The default value is 0 and means that there is no time limit.

Type: double

Precondition: time_limit >= 0

Default: 0

is designed to give, in degrees, a targeted lower bound on dihedral angles of mesh cells. The function perturb_mesh_3() runs as long as steps are successful and step number sliver_bound (after which the worst tetrahedron in the mesh has a smallest angle larger than sliver_bound degrees) has not been reached. The default value is 0 and means that there is no targeted bound: the perturber then runs as long as steps are successful.

It produces simplicial meshes which discretize 3D domains.

The mesh generation algorithm is a Delaunay refinement process followed by an optimization phase. The criteria driving the Delaunay refinement process may be tuned to achieve the user needs with respect to the size of mesh elements, the accuracy of boundaries approximation, etc.

The optimization phase is a sequence of optimization processes, amongst the following available optimizers: an ODT smoothing, a Lloyd smoothing, a sliver perturber, and a sliver exuder. Each optimization process can be activated or not, according to the user requirements and available time. By default, only the perturber and the exuder are activated. Note that the benefits of the exuder will be lost if the mesh is further refined afterward.

Attention

The function template refine_mesh_3() may be used to refine a previously computed mesh, e.g.:

either a model of the concept MeshDomain_3 or of MeshDomainWithFeatures_3 if 0 and 1-dimensional features of the input complex have to be accurately represented in the mesh.

the mesh to be refined that is modified by the refinement process. As the refinement process only adds points to the triangulation, all vertices of the triangulation of c3t3 remain in the mesh during the refinement process. c3t3 can be used to insert specific points in the domain to ensure that they will be contained in the final triangulation.

domain

the domain used to create the c3t3 parameter. It is the sole link through which the domain to be discretized is known by the mesh generation algorithm.

criteria

specifies the size and shape requirements for mesh tetrahedra and surface facets. These criteria form the rules which drive the refinement process. All mesh elements satisfy those criteria at the end of the refinement process. In addition, if the domain has features, the argument criteria provides a sizing field to guide the discretization of 1-dimensional exposed features.

np

an optional sequence of Named Parameters among the ones listed below. They control which optimization processes are performed and allow the user to tune the parameters of the optimization processes. Individual optimization parameters are not described here as they are internal types (see instead the documentation page of each optimizer). For each optimization algorithm, there exist two global functions that allow to enable or disable the optimizer.

Optional Named Parameters

In order to drive the meshing algorithm and ensure that the output mesh follows a desired topological criterion, three named parameters control this option:

The optimization parameters can be passed in arbitrary order. If one parameter is not passed, its default value is used. The default values are no_lloyd(), no_odt(), perturb() and exude(). Note that regardless of which optimization processes are activated, they are always launched in the order that is a suborder of the following (see user manual for further details): ODT-smoother, Lloyd-smoother, perturber, and exuder.

Beware that optimization of the mesh is obtained by perturbing mesh vertices and modifying the mesh connectivity and that this has an impact on the strict compliance to the refinement criteria. Though a strict compliance to mesh criteria is guaranteed at the end of the Delaunay refinement, this may no longer be true after some optimization processes. Also beware that the default behavior does involve some optimization processes.