Skip to main content

fit_surface_sampled

Function fit_surface_sampled 

Source
pub fn fit_surface_sampled(
    point: impl FnMut(f64, f64) -> OgeomResult<Point>,
    sampling: &Sampling,
    degree: usize,
    tolerance: f64,
    tol: Tolerances,
) -> OgeomResult<Fitted<BSplineSurface>>
Expand description

Fit a surface to the geometry point traces over its parameters, measured between the samples as well as at them.

The fit is same-parameter with point: it is fitted at the grid’s own parameters, and the fit at (u, v) is compared with point(u, v), which bounds the distance between the two from above. Each span of a direction known between its samples is checked at its quarter points, along the sample lines and across them; a miss splits the spans it lies in, its middle becoming a sample, so the grid (and the fit’s knots, which follow its residuals) thickens only where the fit strays. Where the least-squares fit strays between the samples, the spline through every sample (on knots that follow the samples) is measured too and decides where to refine, and the closer of the two stands. This repeats until tolerance holds at every point measured or a direction would pass sampling.most spans. A fit the quarter points pass is read again along its sample lines (and midway between them), at eight points of every knot span of its own and its peaks climbed, along them and across, before it is stated met: a peak at a crease of the geometry can stand between the quarter points. The best fit is returned either way, read so, its error the worst measured and met whether that is within tolerance.

§Errors

OgeomError::Construction if the tolerance is not a distance or the parameters do not strictly increase with at least two a side; whatever point refuses.