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
  • mesh (compas.datastructures.Mesh) – A triangle mesh.

  • target (float) – The target length for the mesh edges.

  • kmax (int, optional) – The number of iterations.

  • tol (float, optional) – Length deviation tolerance.

  • divergence (float, optional) – ??

  • verbose (bool, optional) – Print feedback messages.

  • allow_boundary_split (bool, optional) – Allow boundary edges to be split.

  • allow_boundary_swap (bool, optional) – Allow boundary edges or edges connected to the boundary to be swapped.

  • allow_boundary_collapse (bool, optional) – Allow boundary edges or edges connected to the boundary to be collapsed.

  • smooth (bool, optional) – Apply smoothing at every iteration.

  • fixed (list[int], optional) – A list of vertices that have to stay fixed.

  • callback (callable, optional) – A user-defined function that is called after every iteration.

  • callback_args (list[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.