cellcomplex.property_topomesh.optimization.property_topomesh_edge_collapse_optimization

cellcomplex.property_topomesh.optimization.property_topomesh_edge_collapse_optimization(topomesh, omega_energies={'error_quadrics': 0.65, 'length': 0.01}, minimal_length=None, target_triangles=None, iterations=1, verbose=False, debug=False, loglevel=0)[source]

Perform a topological optimization of a PropertyTopomesh using edge collapses.

The topomesh is decimated by successive edge collapse operations in order to minimize an energy function, while reaching the double goal of eliminating edges under a minimal length and reducing the total number of triangles. The collapse operations are performed in the ascending order of energy variation until either the target number of triangles or the maximal number of iterations is reached.

Parameters
  • topomesh (cellcomplex.property_topomesh.PropertyTopomesh) – The structure on which to perform the optimization

  • omega_energies (dict) –

    The weights (float) associated to each energy term:
    • error_quadics energy minimizing the decimation error

    • length energy maximizing total edge length

  • minimal_length (float) – The edge length under which the edges will be collapsed

  • target_triangles (int) – The number of triangles to reach after decimation

  • iterations (int) – Number of optimization passes to perform

Returns

n_collapses – Number of edges collapsed in the last iteration

Return type

int

Note

The PropertyTopomesh passed as argument is updated.

Warning

The PropertyTopomesh must be a triangular topomesh (cellcomplex.property_topomesh.analysis.is_triangular())