generative-art-0.1.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Numerics.Interpolation

Description

Interpolate between values.

Synopsis

Documentation

lerp :: VectorSpace vec => (Double, Double) -> (vec, vec) -> Double -> vec Source #

Linearly interpolate the interval \([a,b]\) to \([x,y]\). In computer graphics lingo, this is often known as lerp.

\[ f(t) = x + \frac{y-x}{b-a} (t-a) \]

>>> lerp (0,1) (10,20) 0.5
15.0

lerpDI :: Integral int => (Double, Double) -> (int, int) -> Double -> int Source #

Linear interpolation from Double to Integral (hence: DI).

lerpID :: Integral int => (int, int) -> (Double, Double) -> int -> Double Source #

Linear interpolation from Integral to Double (hence: ID).

lerpII :: (Integral intA, Integral intB) => (intA, intA) -> (intB, intB) -> intA -> intB Source #

Linear interpolation from Integral to Integral (hence: II).