lygia
/v1.1.6
/math
/smootherstep
)quintic polynomial step function
Dependencies:
Use:
smoothstep(<float> in, <float> out, <float> value)
#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:
smoothstep(<float> in, <float> out, <float> value)
#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:
Use:
smoothstep(<float> in, <float> out, <float> value)
#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
LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.
Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).
It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.
Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository