# trimesh.smoothing¶

Classes:

 `coo_matrix`(arg1[, shape, dtype, copy]) A sparse matrix in COOrdinate format.

Functions:

 `eye`(m[, n, k, dtype, format]) Sparse matrix with ones on diagonal `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. Articles 1 - “Improved Laplacian Smoothing of Noisy Surface Meshes” J. 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. `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. `spsolve`(A, b[, permc_spec, use_umfpack]) Solve the sparse linear system Ax=b, where b may be a vector or a matrix.
`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 (If) –

• diffusion (no) –

• > 0.0 (If) –

• occurs (diffusion) –

• 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 neighbors will be weighted by inverse distance

Returns

laplacian – Laplacian operator

Return type

scipy.sparse.coo.coo_matrix