Appearance
Wall
Model
Every cross-section is a closed curve in the coordinates
with a radial component
with
wall.angle = "polar" selects. On a section that is not star-shaped about the centerline, the wall turns back on itself as seen from it, and

Cross-sections of the three synthetic tubes that are not star-shaped (black: exact; colour: encoded, by the harmonic angle φ), with rays from the centerline (grey) that meet the wall more than once.
The components are written in the turning frame rather than as
Fit
Every wall vertex
The squared distance between the vertex and the wall at its angle is the same in the frame that turns with
The fit therefore splits into two independent scalar fits with the same design, weights and normal matrix: one factorization serves both, and the smoothing is chosen for both together.
The coefficients minimize the penalized least squares objective with the bending energy of both components in physical units as penalty:
where
with
Parameter correction
The discrete harmonic angle carries tangential noise of the order of the irregularity of the mesh. Fitted as it is, that noise counts as misfit, and GCV answers it with more smoothing than the wall needs. After the first fit, every vertex therefore takes the angle wall.corrections times; one by default). This is the parameter correction of curve fitting (Hoschek [28]): the angles keep the smooth part of the harmonic angle and lose its noise. On the synthetic tubes one correction brings the error of the circular and elliptic presets to that of a radius function fitted on the polar angle.
The nearest point is found by sampling the section at four points per coefficient (the values of a uniform periodic basis repeat from span to span, so the samples cost a few operations each) and refining the nearest sample by Newton's method on the stationarity of the squared distance.
Adaptive knots
Vessels are not uniformly complex along their length: a stenosis or an aneurysm neck needs more resolution than a straight segment. With wall.knots.mode = "adaptive" (the default) the longitudinal knots are placed in two passes:
- Fit the wall on uniform knots.
- Compute the angular RMS of the longitudinal curvature of the wall,
(exactly, as with for both components), on samples_per_spanpoints per span. - Form the knot density
and place the interior knots at equal quantiles of . - Refit on these knots.

Top: the wall radius of the eccentric stenosis, unrolled; vertical lines are the adaptive breakpoints, concentrated around the throat. Bottom: distance to the exact surface along the vessel with the same 19 × 19 coefficients for uniform and adaptive knots.
The exponent ½ follows the classical result that the error of spline approximation is equidistributed when the local knot spacing
Each observation touches
Section measures
The area of a section,
Reported diagnostics
The encoder reports the residuals, the distance in its section plane from every vertex to the encoded section (mean, RMS, 95th percentile, maximum), the chosen non_star_fraction: those whose polar angle does not increase with furca evaluate computes true point-to-surface distances.