pub fn smoothstep<N: Number>(edge0: N, edge1: N, x: N) -> N
Returns 0.0 if
x <= edge0 and
1.0 if x >= edge1 and performs smooth Hermite interpolation between 0 and 1 when
edge0 < x < edge1.
This is useful in cases where you would want a threshold function with a smooth transition.
This is equivalent to:
let result = clamp((x - edge0) / (edge1 - edge0), 0, 1); return t * t * (3 - 2 * t); Results are undefined if
edge0 >= edge1.