Expand description
An implementation of cubic Bézier curve fitting based on a quartic solver making signed area and moment match the source curve.
Structs§
- Curve
Dist 🔒 - An acceleration structure for estimating curve distance
- Curve
FitSample - A sample point of a curve for fitting.
Enums§
Constants§
- D_
PENALTY_ 🔒ELBOW - As described in Simplifying Bézier paths, strictly optimizing for Fréchet distance can create bumps. The problem is curves with long control arms (distance from the control point to the corresponding endpoint). We mitigate that by applying a penalty as a multiplier to the measured error (approximate Fréchet distance). This is ReLU-like, with a value of 1.0 below the elbow, and a given slope above it. The values here have been determined empirically to give good results.
- D_
PENALTY_ 🔒SLOPE - N_
SAMPLE 🔒
Traits§
- Param
Curve Fit - The source curve for curve fitting.
Functions§
- cubic_
fit 🔒 - Returns curves matching area and moment, given unit chord.
- fit_
opt_ 🔒err_ delta - fit_
opt_ 🔒segment - fit_
to_ bezpath - Generate a Bézier path that fits the source curve.
- fit_
to_ bezpath_ opt - Generate a highly optimized Bézier path that fits the source curve.
- fit_
to_ 🔒bezpath_ opt_ inner - Fit a range without cusps.
- fit_
to_ 🔒bezpath_ rec - fit_
to_ cubic - Fit a single cubic to a range of the source curve.
- measure_
one_ 🔒seg - try_
fit_ 🔒line - Try fitting a line.