Safe Haskell | None |
---|---|
Language | Haskell98 |
- interpolate :: Num a => a -> a -> a -> a
- 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]
- quadDist :: (Unbox a, Floating a) => (a -> (Point a, Point a)) -> QuadBezier a -> a -> a -> a -> a
- phi :: Floating a => a
- goldSearch :: (Ord a, Floating a) => (a -> a) -> a
- goldSearch' :: (Ord a, Floating a) => (a -> a) -> a -> a -> a -> a -> a -> a -> a -> a -> Int -> a
- maxDist :: (Unbox a, Ord a, Floating a) => (a -> (Point a, Point a)) -> QuadBezier a -> a -> a -> a
- approxquad :: (Ord a, Floating a) => Point a -> Point a -> Point a -> Point a -> QuadBezier a
- approx1quad :: (Ord a, Floating a) => (a -> (Point a, Point a)) -> a -> a -> QuadBezier a
- splitQuad :: (Show a, Unbox a, Ord a, Floating a) => a -> a -> (a -> (Point a, Point a)) -> a -> a -> Int -> (a, a, QuadBezier a, a, QuadBezier a)
- approximateQuad' :: (Show a, Unbox a, Ord a, Floating a) => (a -> (Point a, Point a)) -> a -> a -> a -> Bool -> [QuadBezier a]
- approximatePath' :: (Unbox a, Ord a, Floating a) => (a -> (Point a, Point a)) -> Int -> a -> a -> a -> Bool -> [CubicBezier a]
- approximatePathMax :: (Unbox a, Floating a, Ord a) => Int -> (a -> (Point a, Point a)) -> Int -> a -> a -> a -> Bool -> [CubicBezier a]
- data FunctionSegment a = FunctionSegment {
- fsTmin :: !a
- _fsTmax :: !a
- fsCurve :: CubicBezier a
- approxMax :: (Unbox a, Ord a, Floating a) => (a -> (Point a, Point a)) -> a -> Int -> Vector a -> Bool -> Map a (FunctionSegment a) -> [CubicBezier a]
- splitCubic :: (Unbox a, Ord a, Floating a) => a -> a -> Int -> (a -> (Point a, Point a)) -> a -> a -> Int -> (a, a, CubicBezier a, a, CubicBezier a)
- approx1cubic :: (Unbox a, Ord a, Floating a) => Int -> (a -> (Point a, Point a)) -> a -> a -> Int -> (CubicBezier a, a)
- approximateCubic :: (Unbox a, Ord a, Floating a) => CubicBezier a -> Vector (Point a) -> Maybe (Vector a) -> Int -> (CubicBezier a, a)
- leastSquares :: (Unbox a, Fractional a, Eq a) => Vector a -> Vector a -> Vector a -> Maybe (a, a)
- lsqDist :: (Unbox a, Fractional a, Eq a) => CubicBezier a -> Vector (Point a) -> Vector a -> Maybe (CubicBezier a)
- approximateCubic' :: (Unbox a, Ord a, Floating a) => CubicBezier a -> Vector (Point a) -> Vector a -> Int -> a -> Vector (Point a) -> Vector (Point a) -> Maybe (CubicBezier a, Vector a, Vector a, a, Vector (Point a))
- approximateParams :: (Unbox a, Floating a) => Point a -> Point a -> Vector (Point a) -> Vector a
Documentation
interpolate :: Num a => a -> a -> a -> a Source
:: (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.
quadDist :: (Unbox a, Floating a) => (a -> (Point a, Point a)) -> QuadBezier a -> a -> a -> a -> a Source
goldSearch :: (Ord a, Floating a) => (a -> a) -> a Source
goldSearch' :: (Ord a, Floating a) => (a -> a) -> a -> a -> a -> a -> a -> a -> a -> a -> Int -> a Source
maxDist :: (Unbox a, Ord a, Floating a) => (a -> (Point a, Point a)) -> QuadBezier a -> a -> a -> a Source
approxquad :: (Ord a, Floating a) => Point a -> Point a -> Point a -> Point a -> QuadBezier a Source
approx1quad :: (Ord a, Floating a) => (a -> (Point a, Point a)) -> a -> a -> QuadBezier a Source
splitQuad :: (Show a, Unbox a, Ord a, Floating a) => a -> a -> (a -> (Point a, Point a)) -> a -> a -> Int -> (a, a, QuadBezier a, a, QuadBezier a) Source
approximateQuad' :: (Show a, Unbox a, Ord a, Floating a) => (a -> (Point a, Point a)) -> a -> a -> a -> Bool -> [QuadBezier a] Source
approximatePath' :: (Unbox a, Ord a, Floating a) => (a -> (Point a, Point a)) -> Int -> a -> a -> a -> Bool -> [CubicBezier a] Source
:: (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 typically 10 times faster, but generates 50% more subcurves. Useful for interactive use. |
-> [CubicBezier a] |
Like approximatePath, but limit the number of subcurves.
data FunctionSegment a Source
FunctionSegment | |
|
approxMax :: (Unbox a, Ord a, Floating a) => (a -> (Point a, Point a)) -> a -> Int -> Vector a -> Bool -> Map a (FunctionSegment a) -> [CubicBezier a] Source
splitCubic :: (Unbox a, Ord a, Floating a) => a -> a -> Int -> (a -> (Point a, Point a)) -> a -> a -> Int -> (a, a, CubicBezier a, a, CubicBezier a) Source
approx1cubic :: (Unbox a, Ord a, Floating a) => Int -> (a -> (Point a, Point a)) -> a -> a -> Int -> (CubicBezier a, a) Source
:: (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
.
leastSquares :: (Unbox a, Fractional a, Eq a) => Vector a -> Vector a -> Vector a -> Maybe (a, a) Source
lsqDist :: (Unbox a, Fractional a, Eq a) => CubicBezier a -> Vector (Point a) -> Vector a -> Maybe (CubicBezier a) Source