Skip to main content

fit_surface_grid

Function fit_surface_grid 

Source
pub fn fit_surface_grid(
    rows: &[Vec<Point>],
    degree: usize,
    tolerance: f64,
    tol: Tolerances,
) -> OgeomResult<Fitted<BSplineSurface>>
Expand description

Fit a rectangular grid of points with a tensor-product B-spline surface.

A grid fit kept honest the way the curve fit is: rows first, columns second, both passes at fixed parameters: a grid’s parameterization is shared property, and correcting it per row is how a grid stops being one. Each pass adapts one shared knot vector against the worst residual across its whole family, so every row rides the same basis, which is what makes the second pass a fit over control points rather than a guess. The reported error is measured at the end, surface against every input point, and met does not round up.

The error is measured at the grid points only. Between them the surface follows the spline through the grid, which for a smooth grid differs from the sampled shape by an amount that shrinks with the spacing (the parameters are assigned from the chords, so even a quadratic surface is followed closely rather than reproduced), but it is not bounded here.

rows[j][i] runs i along u and j along v.

§Errors

OgeomError::Construction if the grid is not rectangular or is smaller than two by two, or the tolerance is not a distance.