splines/lerp
Generalized linear interpolation
Most splines use linear-interpolation (“lerp”) in their calculations when sampling points from their curves. This module generalizes lerp into multiple dimensions and provides example lerp functions for 1D, 2D, and 3D domains.
Types
The type of a function that can linearly-interpolate over a domain a.
pub type Interpolator(a) =
fn(a, a, Float) -> a
Values
pub fn lerp1(i: Float, j: Float, t: Float) -> Float
Interpolates in one-dimension over floats. You can use this function instead of lerper when
the generic type is Float.
pub fn lerp2(
i: vec2.Vec2(Float),
j: vec2.Vec2(Float),
t: Float,
) -> vec2.Vec2(Float)
Interpolates in two-dimensions over vectors. You can use this function instead of lerper when
the generic type is vec2.Vec2(Float).