colour.algebra.lerp#

colour.algebra.lerp(x: ArrayLike, a: ArrayLike = 0, b: ArrayLike = 1, clip: bool = False) NDArrayFloat#

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

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

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

  • b (ArrayLike) – 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