filtering

Module Contents

Functions

mesh_smoothing(mesh[, method, curvature_weight, ...])

Smooths a mesh using anisotropic mesh smoothing.

scalar_attribute_smoothing(mesh[, attribute_name, ...])

Smooths a (multi-channel) scalar attribute on a surface mesh.

filtering.mesh_smoothing(mesh, method='NormalSmoothing', curvature_weight=0.02, normal_smoothing_weight=0.0001, gradient_weight=0.0001, gradient_modulation_scale=0.0, normal_projection_weight=100.0)

Smooths a mesh using anisotropic mesh smoothing.

Parameters:
  • mesh (lagrange.core.SurfaceMesh) – Input mesh.

  • method (str) – The filtering method. Options are [‘VertexSmoothing’, ‘NormalSmoothing’]. Default is ‘NormalSmoothing’.

  • curvature_weight (float) – The curvature/inhomogeneity weight. Specifies the extent to which total curvature should be used to change the underlying metric. Setting =0 is equivalent to using standard homogeneous/anisotropic diffusion.

  • normal_smoothing_weight (float) – The normal smoothing weight. Specifies the extent to which normals should be diffused before curvature is estimated. Formally, this is the time-step for heat-diffusion performed on the normals. Setting =0 will reproduce the original normals.

  • gradient_weight (float) – Gradient fitting weight. Specifies the importance of matching the gradient constraints (objective #2) relative to matching the positional constraints (objective #1). Setting =0 reproduces the original normals.

  • gradient_modulation_scale (float) – Gradient modulation scale. Prescribes the scale factor relating the gradients of the source to those of the target. <1 => gradients are dampened => smoothing. >1 => gradients are amplified => sharpening. Setting =0 is equivalent to performing a semi-implicit step of heat-diffusion, with time-step equal to gradient_weight. Setting =1 reproduces the original normals.

  • normal_projection_weight (float) – Weight for fitting the surface to prescribed normals. Specifies the importance of matching the target normals (objective #2) relative to matching the original positions (objective #1). Setting =0 will reproduce the original geometry.

Returns:

The smoothed mesh.

Return type:

None

filtering.scalar_attribute_smoothing(mesh, attribute_name='', curvature_weight=0.02, normal_smoothing_weight=0.0001, gradient_weight=0.0001, gradient_modulation_scale=0.0)

Smooths a (multi-channel) scalar attribute on a surface mesh.

Parameters:
  • mesh (lagrange.core.SurfaceMesh) – Input mesh.

  • attribute_name (str) – The name of the scalar vertex attribute to smooth. If empty, all attributes with scalar usage and vertex element type will be smoothed.

  • curvature_weight (float) – The curvature/inhomogeneity weight. Controls the strength of the smoothing operation. Higher values result in stretching in the surface metric, slowing down diffusion process. The default value of 0.02 provides a moderate smoothing effect. Values should typically be in the range [0.0, 1.0].

  • normal_smoothing_weight (float) – The normal smoothing weight. Specifies the extent to which normals should be diffused before curvature is estimated.

  • gradient_weight (float) – Gradient fitting weight. Specifies the importance of matching the gradient constraints.

  • gradient_modulation_scale (float) – Gradient modulation scale. Prescribes the scale factor relating the gradients of the source to those of the target.

Returns:

None. The attribute is modified in place.

Return type:

None