LYGIA Shader Library

cubicMix (lygia/math/cubicMix)

cubic polynomial interpolation between two values

Dependencies:

Use:

<float|vec2|vec3|vec4> cubicMix(<float|vec2|vec3|vec4> A, <float|vec2|vec3|vec4> B, float t)

Check it on Github



#ifndef FNC_CUBICMIX
#define FNC_CUBICMIX
float cubicMix(float A, float B, float t) { return A + (B - A) * cubic(t); }
vec2 cubicMix(vec2 A, vec2 B, float t) { return A + (B - A) * cubic(t); }
vec2 cubicMix(vec2 A, vec2 B, vec2 t) { return A + (B - A) * cubic(t); }
vec3 cubicMix(vec3 A, vec3 B, float t) { return A + (B - A) * cubic(t); }
vec3 cubicMix(vec3 A, vec3 B, vec3 t) { return A + (B - A) * cubic(t); }
vec4 cubicMix(vec4 A, vec4 B, float t) { return A + (B - A) * cubic(t); }
vec4 cubicMix(vec4 A, vec4 B, vec4 t) { return A + (B - A) * cubic(t); }
#endif

Dependencies:

Use:

<float|float2|float3|float4> cubicMix(<float|float2|float3|float4> A, <float|float2|float3|float4> B, float t)

Check it on Github



#ifndef FNC_CUBICMIX
#define FNC_CUBICMIX
float cubicMix(float A, float B, float t) { return A + (B - A) * cubic(t); }
float2 cubicMix(float2 A, float2 B, float t) { return A + (B - A) * cubic(t); }
float2 cubicMix(float2 A, float2 B, float2 t) { return A + (B - A) * cubic(t); }
float3 cubicMix(float3 A, float3 B, float t) { return A + (B - A) * cubic(t); }
float3 cubicMix(float3 A, float3 B, float3 t) { return A + (B - A) * cubic(t); }
float4 cubicMix(float4 A, float4 B, float t) { return A + (B - A) * cubic(t); }
float4 cubicMix(float4 A, float4 B, float4 t) { return A + (B - A) * cubic(t); }
#endif

Dependencies:

Use:

<float|float2|float3|float4> cubicMix(<float|float2|float3|float4> A, <float|float2|float3|float4> B, float t)

Check it on Github



#ifndef FNC_CUBICMIX
#define FNC_CUBICMIX
float cubicMix(float A, float B, float t) { return A + (B - A) * cubic(t); }
float2 cubicMix(float2 A, float2 B, float t) { return A + (B - A) * cubic(t); }
float2 cubicMix(float2 A, float2 B, float2 t) { return A + (B - A) * cubic(t); }
float3 cubicMix(float3 A, float3 B, float t) { return A + (B - A) * cubic(t); }
float3 cubicMix(float3 A, float3 B, float3 t) { return A + (B - A) * cubic(t); }
float4 cubicMix(float4 A, float4 B, float t) { return A + (B - A) * cubic(t); }
float4 cubicMix(float4 A, float4 B, float4 t) { return A + (B - A) * cubic(t); }
#endif

Dependencies:

Use:

<float|vec2|vec3|vec4> cubicMix(<float|vec2|vec3|vec4> A, <float|vec2|vec3|vec4> B, float t)

Check it on Github



fn cubicMix(A: f32, B: f32, t: f32) -> { return A + (B - A) * cubic(t); }
fn cubicMix2(A: vec2f, B: vec2f, t: vec2f) { return A + (B - A) * cubic2(t); }
fn cubicMix3(A: vec3f, B: vec3f, t: vec3f) { return A + (B - A) * cubic3(t); }
fn cubicMix4(A: vec4f, B: vec4f, t: vec4f) { return A + (B - A) * cubic4(t); }

Examples

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.

Get the latest news and releases

Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository