Suppose
0<= x <= 1, and a function f is defined on f(0), f(1). We want to define it for f(x) so that f(x) is smooth.
If we do this by averaging neighbors, we have:
f(x) = g(x)*f(0) + g(1-x)f(1). Then we want a function g that is
smooth, and in which
g(0) = 1 and g(1) = 0, and in which g is symmetric so that g(x) + g(1-x) = 1.
With
linear interpolation g(x) = 1-x.
This fits the second two criteria, but this g is not smooth. There is a discontinuity at f(0), since
we suddenly switch between averaging
f(0) and f(1) and averaging f(0) and f(-1)
So
instead, we want f(x) near f(0) to be based mostly on the value of f(0), and only to gradually average in f(1) as we get closer
to it.
A nice
function that does this is 1 – 3*d*d +2*|d*d*d|
Note that
g(1-x) = 1 – 3*(1-x)(1-x) +2(1-x)(1-x)(1-x)
= 1 –
3 + 6x –3x*x + 2 – 6x + 6x*x – 2x*x*x = 3x*x – 2*x*x*x
= 1 –
(1 – 3x*x + 2x*x*x)