Safe Haskell | None |
---|---|

Language | Haskell98 |

- approximatePath :: (Unbox a, Ord a, Floating a) => (a -> (Point a, Point a)) -> Int -> a -> a -> a -> Bool -> [CubicBezier a]
- approximateQuadPath :: (Show a, Unbox a, Ord a, Floating a) => (a -> (Point a, Point a)) -> a -> a -> a -> Bool -> [QuadBezier a]
- approximatePathMax :: (Unbox a, Floating a, Ord a) => Int -> (a -> (Point a, Point a)) -> Int -> a -> a -> a -> Bool -> [CubicBezier a]
- approximateQuadPathMax :: (Unbox a, Show a, Floating a, Ord a) => Int -> (a -> (Point a, Point a)) -> a -> a -> a -> Bool -> [QuadBezier a]
- approximateCubic :: (Unbox a, Ord a, Floating a) => CubicBezier a -> Vector (Point a) -> Maybe (Vector a) -> Int -> (CubicBezier a, a)

# Documentation

:: (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.

:: (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.

:: (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.

approximateQuadPathMax Source #

:: (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.

:: (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`

.