Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Interpolate between values.
Synopsis
- lerp :: VectorSpace vec => (Double, Double) -> (vec, vec) -> Double -> vec
- lerpDI :: Integral int => (Double, Double) -> (int, int) -> Double -> int
- lerpID :: Integral int => (int, int) -> (Double, Double) -> int -> Double
- lerpII :: (Integral intA, Integral intB) => (intA, intA) -> (intB, intB) -> intA -> intB
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