cellcomplex.property_topomesh.optimization.property_topomesh_vertices_deformation¶
-
cellcomplex.property_topomesh.optimization.property_topomesh_vertices_deformation(topomesh, iterations=1, omega_forces={'taubin_smoothing': 0.65}, sigma_deformation=0.1, gradient_derivatives=None, gaussian_sigma=10.0, voxelsize=(1.0, 1.0, 1.0), target_normal=None, target_areas=None, fix_borders=False, verbose=False, debug=False, loglevel=0)[source]¶ Optimize the positions of the mesh vertices along multiple criteria.
The ‘barycenter’ property of the elements of degree 0 is updated following a different “force” vector for each vertex. This vector is computed as the opposite of the gradient of a composite energy functional defined over the mesh. The weights of the energy terms are to be specified in the function arguments. The deformation is constrained to a possibly small range around each vertex. The function can for instance be used to apply a smoothing to the mesh (laplacian, curvature flow, taubin), or for more complex optimization such as planarization of interfaces, or triangle quality enhancement.
- Parameters
topomesh (
cellcomplex.property_topomesh.PropertyTopomesh:) – The structure on which to apply the optimization.iterations (int) – The number of times the deformation is repeated.
omega_forces (dict) –
- The weights (float) associated to each energy term:
regularization: energy optimizing triangle eccentricity
area: energy optimizing triangle size homogeneity
gradient: energy pushing vertices towards local maxima of a gradient field
laplacian: energy regularizing cell edges towards straight lines
planarization: energy regularizing cell interfaces towards planar surfaces
epidermis_planarization: energy regularizing outer cell surfaces towards planar surfaces
convexity: energy regularizing outer cell surfaces towards spherical surfaces
laplacian_smoothing: energy regularizing the mesh using a Laplacian operator
gaussian_smoothing: energy regularizing the mesh using a Gaussian operator
curvature_flow_smoothing: energy regularizing the mesh using a Cotangent Laplacian operator
taubin_smoothing: energy regularizing the mesh using two-pass Gaussian operator
sigma_deformation (float) – The maximal allowed amplitude of a deformation of a vertex at each iteration.
gaussian_sigma (float) – The standard deviation used to compute gaussian weights in gaussian/taubin smoothing.
gradient_derivatives (
timagetk.SpatialImage) – The 3 derivatives of the gradient field (x, y, z) used for gradient optimization.target_normal (
numpy.ndarray, optional) – The normal of the desired plane for the interface planarization optimization. If None, the direction linking cell centers is chosen.target_areas (
numpy.array, optional) – The values of areas to which the mesh triangles should tend in the area optimization. If None, the average area value is chosen.fix_borders (bool) – Whether the border vertices should be fixed or not (in the case of open surfaces).
- Returns
- Return type
Note
The PropertyTopomesh passed as argument is updated.