Expand description
Mesh subdivision by Loop’s scheme.
subdivide refines every triangle into four, SubdivideOptions::levels
times, smoothing the surface toward the limit: each level moves the old
vertices with Loop’s vertex stencil and inserts one vertex per edge with
the edge stencil, then splits every triangle at its three edge vertices.
The whole plan is computed on working copies first and committed through
one Transaction, which keeps the call
atomic under sweep: either every level lands or nothing does.
§Boundary and crease rule
Standard Loop with boundary handling (no crease tags):
- An edge two triangles share is interior: its new vertex is
3/8 (a + b) + 1/8 (c + d)from its endpointsa,band the two opposite verticesc,d. Any other edge (one owner, or three or more on a non-manifold rim) is a crease: its new vertex is the midpoint. - A vertex on no boundary edge is interior: Loop’s vertex stencil over
all its neighbours, with the exact weight
beta = (5/8 - (3/8 + cos(2 pi / n) / 4)^2) / nfor valencen. - A vertex on boundary edges with exactly two boundary neighbours is a
smooth boundary vertex:
3/4 v + 1/8 (b0 + b1), so rims relax along their own curve and sharp corners round off. - A vertex on any other number of boundary edges (one, or three or more at a pinch or non-manifold corner) is pinned: it stays where it is.
- Isolated vertices, and triangles with a repeated vertex id, pass through untouched.
UVs (Mesh::uvs) stay linear: an old vertex
keeps its UV even though it moves, and a new one takes its edge’s midpoint.
The two sides of a seam are boundaries, so they split in step.
The stencils are convex combinations, so finite input stays finite, and every list is sorted explicitly, so results do not depend on hash iteration order.
Structs§
- Subdivide
Options - Options for
subdivide. - Subdivide
Options Builder - Builder for
SubdivideOptions. - Subdivide
Report - Outcome of
subdivide.
Enums§
- Subdivide
Method - Which subdivision scheme to run. Only Loop’s scheme exists so far.
Functions§
- subdivide
- Subdivides the mesh
SubdivideOptions::levelstimes by Loop’s scheme (see the module docs). Each level quadruples the clean triangle count: every triangle becomes four, with one new vertex per subdivided edge. Degenerate triangles and isolated vertices pass through untouched.