trimesh_remesh

compas.datastructures.trimesh_remesh(mesh, target, kmax=100, tol=0.1, divergence=0.01, verbose=False, allow_boundary_split=False, allow_boundary_swap=False, allow_boundary_collapse=False, smooth=True, fixed=None, callback=None, callback_args=None)[source]

Remesh until all edges have a specified target length.

Parameters:
meshcompas.datastructures.Mesh

A triangle mesh.

targetfloat

The target length for the mesh edges.

kmaxint, optional

The number of iterations.

tolfloat, optional

Length deviation tolerance.

divergencefloat, optional

??

verbosebool, optional

Print feedback messages.

allow_boundary_splitbool, optional

Allow boundary edges to be split.

allow_boundary_swapbool, optional

Allow boundary edges or edges connected to the boundary to be swapped.

allow_boundary_collapsebool, optional

Allow boundary edges or edges connected to the boundary to be collapsed.

smoothbool, optional

Apply smoothing at every iteration.

fixedlist[int], optional

A list of vertices that have to stay fixed.

callbackcallable, optional

A user-defined function that is called after every iteration.

callback_argslist[Any], optional

A list of additional parameters to be passed to the callback function.

Returns:
None

The mesh is modified in place.

Notes

This algorithm not only changes the geometry of the mesh, but also its topology as needed to achieve the specified target lengths. Topological changes are made such that vertex valencies are well-balanced and close to six. This involves three operations:

  • split edges that are longer than a maximum length,

  • collapse edges that are shorter than a minimum length,

  • swap edges if this improves the valency error.

The minimum and maximum lengths are calculated based on a desired target length.

For more info, see [1].

References

[1]

Botsch, M. & Kobbelt, L., 2004. A remeshing approach to multiresolution modeling. Proceedings of the 2004 Eurographics/ACM SIGGRAPH symposium on Geometry processing - SGP ‘04, p.185. Available at: http://portal.acm.org/citation.cfm?doid=1057432.1057457.