trimesh.smoothing module

Functions

filter_humphrey(mesh[, alpha, beta, …])

Smooth a mesh in-place using laplacian smoothing and Humphrey filtering.

filter_laplacian(mesh[, lamb, iterations, …])

Smooth a mesh in-place using laplacian smoothing.

filter_taubin(mesh[, lamb, nu, iterations, …])

Smooth a mesh in-place using laplacian smoothing and taubin filtering.

laplacian_calculation(mesh[, equal_weight])

Calculate a sparse matrix for laplacian operations.

trimesh.smoothing.filter_humphrey(mesh, alpha=0.1, beta=0.5, iterations=10, laplacian_operator=None)

Smooth a mesh in-place using laplacian smoothing and Humphrey filtering.

Articles “Improved Laplacian Smoothing of Noisy Surface Meshes” J. Vollmer, R. Mencl, and H. Muller

Parameters
  • mesh (trimesh.Trimesh) – Mesh to be smoothed in place

  • alpha (float) – Controls shrinkage, range is 0.0 - 1.0 If 0.0, not considered If 1.0, no smoothing

  • beta (float) – Controls how aggressive smoothing is If 0.0, no smoothing If 1.0, full aggressiveness

  • iterations (int) – Number of passes to run filter

  • laplacian_operator (None or scipy.sparse.coo.coo_matrix) – Sparse matrix laplacian operator Will be autogenerated if None

trimesh.smoothing.filter_laplacian(mesh, lamb=0.5, iterations=10, implicit_time_integration=False, volume_constraint=True, laplacian_operator=None)

Smooth a mesh in-place using laplacian smoothing. Articles 1 - “Improved Laplacian Smoothing of Noisy Surface Meshes”

  1. Vollmer, R. Mencl, and H. Muller

2 - “Implicit Fairing of Irregular Meshes using Diffusion

and Curvature Flow”. M. Desbrun, M. Meyer, P. Schroder, A.H.B. Caltech

Parameters
  • mesh (trimesh.Trimesh) –

  • to be smoothed in place (Mesh) –

  • lamb (float) –

  • speed constant (Diffusion) –

  • 0.0, no diffusion (If) –

  • > 0.0, diffusion occurs (If) –

  • implicit_time_integration (boolean) –

  • False (if) – -lamb <= 1.0 - Stability Limit (Article 1)

  • True (if) – -lamb no limit (Article 2)

  • iterations (int) –

  • of passes to run filter (Number) –

  • laplacian_operator (None or scipy.sparse.coo.coo_matrix) –

  • matrix laplacian operator (Sparse) –

  • be autogenerated if None (Will) –

trimesh.smoothing.filter_taubin(mesh, lamb=0.5, nu=0.5, iterations=10, laplacian_operator=None)

Smooth a mesh in-place using laplacian smoothing and taubin filtering.

Articles “Improved Laplacian Smoothing of Noisy Surface Meshes” J. Vollmer, R. Mencl, and H. Muller

Parameters
  • mesh (trimesh.Trimesh) – Mesh to be smoothed in place.

  • lamb (float) – Controls shrinkage, range is 0.0 - 1.0

  • nu (float) – Controls dilation, range is 0.0 - 1.0 Nu shall be between 0.0 < 1.0/lambda - 1.0/nu < 0.1

  • iterations (int) – Number of passes to run the filter

  • laplacian_operator (None or scipy.sparse.coo.coo_matrix) – Sparse matrix laplacian operator Will be autogenerated if None

trimesh.smoothing.laplacian_calculation(mesh, equal_weight=True)

Calculate a sparse matrix for laplacian operations.

Parameters
  • mesh (trimesh.Trimesh) – Input geometry

  • equal_weight (bool) – If True, all neighbors will be considered equally If False, all neightbors will be weighted by inverse distance

Returns

laplacian – Laplacian operator

Return type

scipy.sparse.coo.coo_matrix