Skip to main content

Module smooth

Module smooth 

Source
Expand description

Smoothing an editable mesh by projecting each vertex onto a local quadric, keeping creases sharp where asked.

§A pass

Each vertex is moved along its neighbourhood’s normal onto the local quadric fitted about it, the one curvature reads: a weighted least-squares height field over the vertex’s tangent plane, fitted to the NEIGHBOURS vertices nearest it within the smoothing’s size. Every vertex of a pass is moved from the positions the pass started from, so the result does not depend on the order the vertices are taken in, and is the same at any thread count. Smoothing makes PASSES passes.

§Creases

With Smooth::keep_edges an angle, a neighbour counts towards a vertex’s quadric only if its normal turns from the vertex’s own by no more than that angle. A vertex beside a crease then fits the faces on its own side, and stays on them. A vertex on the crease, whose normal lies between the faces’, is fitted to the vertices along the crease, or where they fix no quadric, as at a corner, stays where it is.

§How far a vertex moves

No vertex ends farther than Smooth::max_move from where it started: a move past it is shortened, along its line, until the distance as computed is no more than max_move.

With Smooth::region, only the vertices in it move, each by its pass’s move scaled by its distance to the nearest vertex outside the region over size, up to the whole move from one size in. The region thus blends into the rest of the mesh rather than stepping off it.

§What stays

Only positions change. A vertex with no face, and every vertex Editable::non_manifold reports, the copies of a point several fans meet and the ends of edges not cleanly joined, stays where it is, so a point’s copies stay together. How faces are joined across an edge of three or more of them depends on where their far corners stand, so those edges are joined again afterwards, by the rule in the module documentation.

Structs§

Smooth
How a mesh is smoothed.
SmoothReport
What a smoothing moved.

Constants§

PASSES
How many passes a smoothing makes.