smoothstep

Smoothstep from edge0 to edge1 at x.

@safe pure nothrow
CommonType!(T1, T2, T3)
smoothstep
(
T1
T2
T3
)
(,,
T3 x
)
if (
isFloatingPoint!(CommonType!(T1, T2, T3))
)

Return Value

Type: CommonType!(T1, T2, T3)

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.

Examples

//  assert(smoothstep(1, 0, 2) == 0);
assert(smoothstep(1.0, 0.0, 2.0) == 0);
assert(smoothstep(1.0, 0.0, 0.5) == 0.5);
// assert(almost_equal(smoothstep(0.0, 2.0, 0.5), 0.15625, 0.00001));

Meta