Safe Haskell | None |
---|
- approximatePath :: (Double -> (Point, Point)) -> Double -> Double -> Double -> Double -> [CubicBezier]
- approximatePathMax :: Int -> (Double -> (Point, Point)) -> Double -> Double -> Double -> Double -> [CubicBezier]
- approximateCurve :: CubicBezier -> [Point] -> Double -> (CubicBezier, Double, Double)
- approximateCurveWithParams :: CubicBezier -> [Point] -> [Double] -> Double -> (CubicBezier, Double, Double)
Documentation
:: (Double -> (Point, Point)) | The function to approximate and it's derivative |
-> Double | The number of discrete samples taken to approximate each subcurve |
-> Double | The tolerance |
-> Double | The lower parameter of the function |
-> Double | The upper parameter of the function |
-> [CubicBezier] |
Approximate a function with piecewise cubic bezier splines using a least-squares fit, within the given tolerance. Each subcurve is approximated by using a finite number of samples. It is recommended to avoid changes in direction by subdividing the original function at points of inflection.
:: Int | The maximum number of subcurves |
-> (Double -> (Point, Point)) | The function to approximate and it's derivative |
-> Double | The number of discrete samples taken to approximate each subcurve |
-> Double | The tolerance |
-> Double | The lower parameter of the function |
-> Double | The upper parameter of the function |
-> [CubicBezier] |
Like approximatePath, but limit the number of subcurves.
approximateCurve :: CubicBezier -> [Point] -> Double -> (CubicBezier, Double, Double)Source
approximateCurve b pts eps
finds the least squares fit of a bezier
curve to the points pts
. The resulting bezier has the same first
and last control point as the curve b
, and have tangents colinear with b
.
return the curve, the parameter with maximum error, and maximum error.
Calculate to withing eps tolerance.
approximateCurveWithParams :: CubicBezier -> [Point] -> [Double] -> Double -> (CubicBezier, Double, Double)Source
Like approximateCurve, but also takes an initial guess of the parameters closest to the points. This might be faster if a good guess can be made.