Skip to main content

fit_points_faired

Function fit_points_faired 

Source
pub fn fit_points_faired(
    points: &[Point],
    degree: usize,
    controls: usize,
    smoothing: f64,
    tol: Tolerances,
) -> OgeomResult<Fitted<BSplineCurve>>
Expand description

Fit a fair curve: least squares over the points, pulled toward minimum bending energy by a smoothing weight.

The energy is the squared second difference of the control polygon (the discrete bending of the curve’s own skeleton), added to the normal equations as λ·DᵀD. At λ = 0 this is plain least squares; as λ grows the curve trades closeness for straightness, which is the batten a drafter flexes through points. Both ends interpolate their points exactly, whatever the weight. The reported error is the honest maximum distance from the inputs, which rises with λ: fairness is spent closeness, and the number says how much was spent.

§Errors

OgeomError::Construction if fewer than two distinct points arrive, the control budget cannot carry the degree, or the weight is not finite and non-negative.