Function flo_curves::bezier::fit_curve

source ·
pub fn fit_curve<Curve>(
    points: &[Curve::Point],
    max_error: f64,
) -> Option<Vec<Curve>>
Expand description

Creates a bezier curve that fits a set of points with a particular error

Algorithm from Philip J. Schneider, Graphics Gems

There are a few modifications from the original algorithm:

  • The ‘small’ error used to determine if we should use Newton-Raphson is now just a multiplier of the max error
  • We only try to fit a certain number of points at once as the algorithm runs in quadratic time otherwise