colour.algebra.smooth#
- colour.algebra.smooth(x: ArrayLike, a: ArrayLike = 0, b: ArrayLike = 1, clip: bool = False) NDArrayFloat#
Apply the smoothstep cubic Hermite interpolation function to array \(x\).
The smoothstep function creates a smooth S-shaped curve between specified edge values, commonly used for smooth transitions in colour interpolation and rendering operations.
- Parameters:
x (ArrayLike) – Input array \(x\) containing values to be transformed.
a (ArrayLike) – Lower edge value for the interpolation domain.
b (ArrayLike) – Upper edge value for the interpolation domain.
clip (bool) – Whether to normalize and constrain input values to the domain [\(a\), \(b\)] before applying the smoothstep function.
- Returns:
Transformed array with values smoothly interpolated using the cubic Hermite polynomial \(3x^2 - 2x^3\).
- Return type:
Examples
>>> x = np.linspace(-2, 2, 5) >>> smoothstep_function(x, -2, 2, clip=True) array([ 0. , 0.15625, 0.5 , 0.84375, 1. ])