colour.algebra.lerp#

colour.algebra.lerp(x: FloatingOrArrayLike, a: FloatingOrArrayLike = 0, b: FloatingOrArrayLike = 1, clip: bool = False) numpy.ndarray#

Perform a simple linear interpolation between given array \(a\) and array \(b\) using \(x\) array.

Parameters
  • x (FloatingOrArrayLike) – Array \(x\) value to use to interpolate between array \(a\) and array \(b\).

  • a (FloatingOrArrayLike) – Array \(a\), the start of the range in which to interpolate.

  • b (FloatingOrArrayLike) – Array \(b\), the end of the range in which to interpolate.

  • clip (bool) – Whether to clip the output values to range [a, b].

Returns

Linear interpolation result.

Return type

numpy.ndarray

Examples

>>> a = 0
>>> b = 2
>>> linstep_function(0.5, a, b)
1.0