smoothie-0.3.2: Smooth curves via several splines and polynomials.

Copyright(C) 2015 Dimitri Sabadie
LicenseBSD3
MaintainerDimitri Sabadie <dimitri.sabadie@gmail.com>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Data.Spline.Curve

Contents

Description

 

Synopsis

Spline

data Spline a s Source

A Spline is a collection of keys with associated interpolation modes. Given two keys which indices are i and i+1, the interpolation mode on the resulting curve is performed using the interpolation mode of the key i. Thus, the interpolation mode of the latest key might be ignored. There’s an exception, though, when using the Bezier interpolation mode.

Instances

(FromJSON (a s), Ord s) => FromJSON ((a s -> s) -> Spline a s) Source 

splineKeys :: Spline a s -> Vector (Key (a s)) Source

Extract the keys.

splineSampler :: Spline a s -> a s -> s Source

Extract the sampler.

Building splines

spline :: Ord s => (a s -> s) -> [Key (a s)] -> Spline a s Source

Build a 'Spline a s'.

'a s' is the type hold by keys. For instance, V2 Float.

The first argument of the function, which has type a s -> s is a function used to extract the sampling value of each keys. In most cases, that value represents the time or the frame of a simulation. That value is used to perform sampling comparison.

Sampling splines

sample :: (Additive a, Floating s, Ord s) => Spline a s -> s -> Maybe (a s) Source

Sample a Spline at a given s sampling value. If no sample exists, yields Nothing.

Re-exported