The following is a linear interpolation function:
float lerp (float a, float b, float weight) {
return a + weight * (b - a);
}
The following is a cubic interpolation function:
float cubic (float p1, float p2, float p3, float p4, float weight) {
float m = weight * weight;
float a = p4 - p3 - p1 + p2;
float b = p1 - p2 - a;
float c = p3 - p1;
float d = p2;
return a * weight * m + b * m + c * weight + d;
}
What is the name of the following method?:
float lerp (float a, float b, float weight) {
float v = weight * weigth * (3.0f - 2.0f * weight);
return a + v * (b - a);
}
I've seen some people reference to the above method as "cubic" but, to me, a cubic interpolation needs 4 points.
Also, I've seen the following as well:
float lerp (float a, float b, float weight) {
float v = weight * weight * weight * (weight * (weight * 6.0f - 15.0f) + 10.0f);
return a + v * (b - a);
}
The above code was referenced to as "quintic", but I'm not really sure how can those functions be "cubic" and "quintic" without the necessary additional "points".
What is the name of these operations performed on the "weights"?
float v = weight * weigth * (3.0f - 2.0f * weight);
float v = weight * weight * weight * (weight * (weight * 6.0f - 15.0f) + 10.0f);
"Cubic" is another word for "third degree polynomial".
"Quintic" is another word for "fifth degree polynomial".
The number of parameters does not matter. P(x) = x*x*x is a "cubic" polynomial even though there are no parameters.
What is the name of these operations performed on the "weights"?
...
These functions are called "smoothstep". Smoothstep functions are a family of odd-degree polynomials. The first one is a 3rd degree (or "cubic") smoothstep, the second is a 5th degree (or "quintic") smoothstep.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With