cosine interpolation formula code example
Example 1: cosine interpolation
def cosineInterpolate(y1, y2, x)
{
xv = (1 - cos(x * 3.1415927)) / 2
return y1 + (y2 - y1) * xv
}
Example 2: cosine interpolation
def linearInterpolate(y1, y2, x):
return y1 + (y2 - y1) * x
Example 3: cosine interpolation
def cosineInterpolate(y1, y2, x):
xv = (1 - cos(x * 3.1415927)) / 2
return y1 + (y2 - y1) * xv