Function nalgebra_glm::smoothstep

source ·
pub fn smoothstep<T: RealNumber>(edge0: T, edge1: T, x: T) -> T
Expand description

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.