Function try_fit_line

Source
fn try_fit_line(
    source: &impl ParamCurveFit,
    accuracy: f64,
    range: Range<f64>,
    start: Point,
    end: Point,
) -> Option<(CubicBez, f64)>
Expand description

Try fitting a line.

This is especially useful for very short chords, in which the standard cubic fit is not numerically stable. The tangents are not considered, so it’s useful in cusp and near-cusp situations where the tangents are not reliable, as well.

Returns the line raised to a cubic and the error, if within tolerance.