cubicbezier-0.6.0.3: Efficient manipulating of 2D cubic bezier curves.

Geom2D.CubicBezier.Approximate

Synopsis

# Documentation

Arguments

 :: (Unbox a, Ord a, Floating a) => (a -> (Point a, Point a)) The function to approximate and it's derivative -> Int The number of discrete samples taken to approximate each subcurve. More samples are more precise but take more time to calculate. For good precision 16 is a good candidate. -> a The tolerance -> a The lower parameter of the function -> a The upper parameter of the function -> Bool Calculate the result faster, but with more subcurves. Runs typically 10 times faster, but generates 50% more subcurves. Useful for interactive use. -> [CubicBezier a]

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.

Arguments

 :: (Show a, Unbox a, Ord a, Floating a) => (a -> (Point a, Point a)) The function to approximate and it's derivative -> a The tolerance -> a The lower parameter of the function -> a The upper parameter of the function -> Bool Calculate the result faster, but with more subcurves. -> [QuadBezier a]

Approximate a function with piecewise quadratic bezier splines using a least-squares fit, within the given tolerance. It is recommended to avoid changes in direction by subdividing the original function at points of inflection.

Arguments

 :: (Unbox a, Floating a, Ord a) => Int The maximum number of subcurves -> (a -> (Point a, Point a)) The function to approximate and it's derivative -> Int The number of discrete samples taken to approximate each subcurve. More samples are more precise but take more time to calculate. For good precision 16 is a good candidate. -> a The tolerance -> a The lower parameter of the function -> a The upper parameter of the function -> Bool Calculate the result faster, but with more subcurves. Runs faster (typically 10 times), but generates more subcurves (about 50%). Useful for interactive use. -> [CubicBezier a]

Like approximatePath, but limit the number of subcurves.

Arguments

 :: (Unbox a, Show a, Floating a, Ord a) => Int The maximum number of subcurves -> (a -> (Point a, Point a)) The function to approximate and it's derivative -> a The tolerance -> a The lower parameter of the function -> a The upper parameter of the function -> Bool Calculate the result faster, but with more subcurves. Runs faster, but generates more subcurves. Useful for interactive use. -> [QuadBezier a]

Like approximateQuadPath, but limit the number of subcurves.

Arguments

 :: (Unbox a, Ord a, Floating a) => CubicBezier a Curve -> Vector (Point a) Points -> Maybe (Vector a) Params. Approximate if Nothing -> Int Maximum iterations -> (CubicBezier a, a) result curve and maximum error

approximateCubic b pts maxiter 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.