Skip to main content

smooth

Function smooth 

Source
pub fn smooth(
    tx: &mut Transaction<'_>,
    options: &SmoothOptions,
) -> Result<SmoothReport>
Expand description

Smooths the vertices under the brush, Taubin λ/μ or plain Laplacian.

  • Region: every live vertex closer than radius to center (brute-force distance check). Vertices outside it never move but still serve as neighbor sources.
  • Each of the cycles runs one pass per method constant (λ then μ for [SmoothMethod::Taubin (TAUBIN_LAMBDA, TAUBIN_MU)), a single full pass for SmoothMethod::Laplacian); every pass moves each region vertex by w * k * (centroid - p), where w is strength * falloff at its normalized distance, k the pass constant, and centroid the mean of its neighbor vertices (the deduped vertices of its fan triangles, excluding itself). Both the moved positions and the neighbor sources come from a snapshot taken before the pass.
  • The move is written once, in a single set_positions call over the vertices whose total displacement is above 0; an empty region writes nothing. History is untouched.

§Errors

Nothing is written in any of these cases.