Class: LaplacianSmoothing
Defined in: src/utils/LaplacianSmoothing.ts:26
Laplacian smoothing utility for mesh geometry
Provides algorithms to smooth mesh surfaces by moving vertices toward the average position of their neighbors. Useful for:
- Reducing noise in scanned surfaces
- Smoothing procedurally generated meshes
- Creating organic, flowing surfaces
LaplacianSmoothing
Example
// Standard Laplacian smoothing
LaplacianSmoothing.smooth(vertices, faces, 3, 0.5);
// Volume-preserving Taubin smoothing
LaplacianSmoothing.taubinSmooth(vertices, faces, 3, 0.5, -0.53);
// Apply to THREE.js geometry
LaplacianSmoothing.smoothGeometry(geometry, 3, 0.5, 'taubin');Constructors
Constructor
new LaplacianSmoothing(): LaplacianSmoothing;Returns
LaplacianSmoothing
Methods
smooth()
static smooth(
vertices,
faces,
iterations?,
lambda?,
boundarySmoothing?): Float32Array;Defined in: src/utils/LaplacianSmoothing.ts:86
Apply standard Laplacian smoothing to vertices
Algorithm: Each vertex is moved toward the average position of its neighbors. This tends to shrink the surface slightly with each iteration.
Parameters
vertices
Float32Array
Vertex positions (will be modified in place)
faces
Uint32Array
Face indices defining mesh topology
iterations?
number = 1
Number of smoothing passes (1-10 typical). More = smoother but may lose detail
lambda?
number = 0.5
Smoothing strength per iteration:
- 0: No smoothing
- 0.1-0.3: Gentle smoothing, preserves features
- 0.4-0.6: Moderate smoothing
- 0.7-1.0: Aggressive smoothing, may over-smooth
boundarySmoothing?
boolean = false
If false, boundary edges remain fixed (recommended for open meshes)
Returns
Float32Array
The smoothed vertices (same array, modified in place)
Example
// Gentle noise reduction
LaplacianSmoothing.smooth(vertices, faces, 2, 0.25, false);
// Aggressive smoothing
LaplacianSmoothing.smooth(vertices, faces, 5, 0.7, false);taubinSmooth()
static taubinSmooth(
vertices,
faces,
iterations?,
lambda?,
mu?,
boundarySmoothing?): Float32Array;Defined in: src/utils/LaplacianSmoothing.ts:205
Apply Taubin smoothing (volume-preserving algorithm)
Algorithm: Alternates between shrinking (positive lambda) and expanding (negative mu) passes. This prevents the volume loss common in standard Laplacian smoothing.
Parameters
vertices
Float32Array
Vertex positions (will be modified in place)
faces
Uint32Array
Face indices defining mesh topology
iterations?
number = 1
Number of shrink-expand cycles (1-5 typical)
lambda?
number = 0.5
Shrinking factor (0.3-0.7 typical). Higher = more aggressive
mu?
number = -0.53
Expansion factor (-0.2 to -0.7 typical). Must be negative.
- Classic Taubin: mu = -(lambda + 0.02)
- Common default: mu = -0.53 when lambda = 0.5
boundarySmoothing?
boolean = false
If false, boundary edges remain fixed
Returns
Float32Array
The smoothed vertices (same array, modified in place)
Example
// Classic Taubin parameters
LaplacianSmoothing.taubinSmooth(vertices, faces, 3, 0.5, -0.53, false);
// Gentle volume-preserving smoothing
LaplacianSmoothing.taubinSmooth(vertices, faces, 2, 0.33, -0.35, false);smoothGeometry()
static smoothGeometry(
geometry,
iterations?,
lambda?,
method?,
boundarySmoothing?,
mu?): void;Defined in: src/utils/LaplacianSmoothing.ts:228
Apply smoothing to a BufferGeometry
Parameters
geometry
BufferGeometry
iterations?
number = 1
lambda?
number = 0.5
method?
"laplacian" | "taubin"
boundarySmoothing?
boolean = false
mu?
number = -0.53
Returns
void