## smootherstep (`lygia`/`math`/`smootherstep`)

quintic polynomial step function

Dependencies:

Use:

``````<float|vec2|vec3|vec4> smoothstep(<float|vec2|vec3|vec4> in, <float|vec2|vec3|vec4> out, <float|vec2|vec3|vec4> value)
``````

Check it on Github

``````

#ifndef FNC_SMOOTHERSTEP
#define FNC_SMOOTHERSTEP
float smootherstep(float a, float b, float v) { return quintic( saturate( (v - a)/(b - a) )); }
vec2  smootherstep(vec2  a, vec2  b, vec2  v) { return quintic( saturate( (v - a)/(b - a) )); }
vec3  smootherstep(vec3  a, vec3  b, vec3  v) { return quintic( saturate( (v - a)/(b - a) )); }
vec4  smootherstep(vec4  a, vec4  b, vec4  v) { return quintic( saturate( (v - a)/(b - a) )); }
#endif
``````

Dependencies:

Use:

``````<float|float2|float3|float4> smoothstep(<float|float2|float3|float4> in, <float|float2|float3|float4> out, <float|float2|float3|float4> value)
``````

Check it on Github

``````

#ifndef FNC_SMOOTHERSTEP
#define FNC_SMOOTHERSTEP
float smootherstep(float edge0, float edge1, float x) { return quintic( saturate( (x - edge0)/(edge1 - edge0) )); }
float2 smootherstep(float2 edge0, float2 edge1, float2 x) { return quintic( saturate( (x - edge0)/(edge1 - edge0) )); }
float3 smootherstep(float3 edge0, float3 edge1, float3 x) { return quintic( saturate( (x - edge0)/(edge1 - edge0) )); }
float4 smootherstep(float4 edge0, float4 edge1, float4 x) { return quintic( saturate( (x - edge0)/(edge1 - edge0) )); }
#endif
``````

Dependencies:

Check it on Github

``````

fn smootherstep(a: f32, b: f32, v: f32) -> f32 { return quintic( saturate( (v - a)/(b - a) )); }
fn smootherstep2(a: vec2f, b: vec2f, v: vec2f) -> vec2f { return quintic( saturate( (v - a)/(b - a) )); }
fn smootherstep3(a: vec3f, b: vec3f, v: vec3f) -> vec3f { return quintic( saturate( (v - a)/(b - a) )); }
fn smootherstep4(a: vec4f, b: vec4f, v: vec4f) -> vec4f { return quintic( saturate( (v - a)/(b - a) )); }
``````

Dependencies:

Use:

``````<float|float2|float3|float4> smoothstep(<float|float2|float3|float4> in, <float|float2|float3|float4> out, <float|float2|float3|float4> value)
``````

Check it on Github

``````

#ifndef FNC_SMOOTHERSTEP
#define FNC_SMOOTHERSTEP
inline __host__ __device__ float  smootherstep(float edge0, float edge1, float x) { return quintic( clamp( (x - edge0)/(edge1 - edge0), 0.0f, 1.0f )); }
inline __host__ __device__ float2 smootherstep(const float2& edge0, const float2& edge1, const float2& x) { return quintic( saturate( (x - edge0)/(edge1 - edge0) )); }
inline __host__ __device__ float3 smootherstep(const float3& edge0, const float3& edge1, const float3& x) { return quintic( saturate( (x - edge0)/(edge1 - edge0) )); }
inline __host__ __device__ float4 smootherstep(const float4& edge0, const float4& edge1, const float4& x) { return quintic( saturate( (x - edge0)/(edge1 - edge0) )); }
#endif
``````