pub fn fit_surface_scattered(
points: &[Point],
degree: usize,
controls: (usize, usize),
smoothing: f64,
tol: Tolerances,
) -> OgeomResult<Fitted<BSplineSurface>>Expand description
Fit a surface to scattered points: no grid required.
The points are parameterized by projection onto the cloud’s own
principal plane (the two dominant directions of its covariance), and
fitted by tensor-product least squares with a bending penalty at
smoothing, which is what keeps the system solvable where the scatter
leaves basis functions unsupported. The reported error is the honest
maximum distance from any input to the surface at its assigned
parameters.
The cloud must be a height field over its principal plane: points that fold over (a closed shell, a cliff) project onto each other, and the fit answers with a large reported error rather than a lie.
§Errors
OgeomError::Construction if
there are too few points for the control budget, the budget cannot
carry the degree, or the weight is not finite and non-negative.