public class PMesh extends Object
Constructor and Description |
---|
PMesh(processing.core.PShape mesh) |
Modifier and Type | Method and Description |
---|---|
processing.core.PShape |
getMesh()
Returns a PShape object representing the smoothed mesh, with vertices moved
to their smoothed positions.
|
float |
smooth(boolean excludeBoundaryVertices)
Performs one pass of simple laplacian smoothing on the mesh.
|
float |
smoothTaubin(double λ,
double µ,
boolean excludeBoundaryVertices)
Performs a single pass of Taubin smoothing.
|
float |
smoothWeighted(boolean excludeBoundaryVertices)
Performs one pass of weighted laplacian smoothing on the mesh.
|
public float smooth(boolean excludeBoundaryVertices)
During simple laplacian smoothing, vertices are moved to the barycenter center of their neighbors (equally-weighted), generally resulting in more isotropic mesh.
excludeBoundaryVertices
- a boolean value indicating whether or not to
exclude the boundary vertices from being
smoothed. Generally this should be set to
true, otherwise the mesh will shrink as it is
smoothed.public float smoothWeighted(boolean excludeBoundaryVertices)
This slightly more complex approximation of the Laplacian uses weights proportional to the inverse distance between the vertices, such that a vertex is "pulled" more towards its farther-away neighbours.
excludeBoundaryVertices
- a boolean value indicating whether or not to
exclude the boundary vertices from being
smoothed. Generally this should be set to
true, otherwise the mesh will shrink as it is
smoothed.public float smoothTaubin(double λ, double µ, boolean excludeBoundaryVertices)
In geometric terms, Taubin smoothing diffuses the mesh inwards and outwards to attenuate details while keeping the surface in roughly the same position. Although this approach is not guaranteed to preserve mesh volume, it does a good job if the parameters λ and µ are well chosen. On the down side, Taubin smoothing requires more iterations to achieve a level of smoothing comparable to other methods.
A good starting point for λ and µ is a µ negative value that is mildly larger
than λ: i.e. λ=0.2
, µ=-0.201
.
λ
- Controls the amount of inward diffusion /
shrinkage. Should be positive.µ
- Controls the amount of outward diffusion /
inflation. Should be negative, with an
absolute value greater than lambda.excludeBoundaryVertices
- A boolean value indicating whether or not to
exclude the boundary vertices from being
smoothed, preserving their original location
and the area of the mesh.public processing.core.PShape getMesh()
Copyright © 2023. All rights reserved.