packages feed

smoothie 0.2.1 → 0.2.2

raw patch · 3 files changed

+16/−1 lines, 3 files

Files

CHANGELOG.md view
@@ -1,3 +1,11 @@+## 0.2.2++- Added cubicHermite.++## 0.2.1++- Added unspline.+ ## 0.2  - Function 'smooth' has a new name; 'sample'.
smoothie.cabal view
@@ -1,5 +1,5 @@ name:                smoothie
-version:             0.2.1
+version:             0.2.2
 synopsis:            Smooth curves via several splines and polynomials.
 description:         This package exports several splines and curves you can use
                      to interpolate points in between.
src/Data/Spline/Polynomial.hs view
@@ -17,6 +17,7 @@   , linear   , linearBy   , cosine+  , cubicHermite     -- * Helpers   , bsearchLower   ) where@@ -80,6 +81,12 @@ -- |Cosine polynomial. cosine :: (Additive a,Floating s,Ord s) => Polynomial s (a s) cosine = linearBy $ \x -> (1 - cos (x * pi)) * 0.5++-- |Cubic hermite interpolation.+--+-- Implemented with https://en.wikipedia.org/wiki/Smoothstep.+cubicHermite :: (Additive a,Fractional s,Ord s) => Polynomial s (a s)+cubicHermite = linearBy $ \x -> x * x * (3 - 2 * x)  -- |Helper binary search that search the ceiling index for the -- value to be searched according to the predicate.