Feedback

Please leave feedback and comments. I am always interested to hear how people get on using these LScripts!

Sunday 17 February 2013

Library - Interpolation

The Library is where code samples, building blocks of scripts will be shared.

linear1D: n1,n2,i // i = interpolation point (0-1)
{
    return(n1 * (1 - i) + n2 * i);     
}

cosine1D: n1,n2,i // i = interpolation point (0-1)
{
    i2 = (1 - cos(i * 3.1415926535)) * 0.5;
    return(n1 * (1 - i2) + n2 * i2);     
}

bicubic1D: n1,n2,n3,n4,i // i = interpolation point (0-1)
{
    i2 = i * i;
    n_01 = n4 - n3 - n1 + n2;
    n_02 = n1 - n2 - n_01;
    n_03 = n3 - n1;
    n_04 = n2;
    return(n_01 * i * i2 + n_02 * i2 + n_03 * i + n_04);
}

2 comments:

  1. thanks to share your scripts
    could you explan what is for?

    sigmamoon.com

    ReplyDelete
    Replies
    1. I'm currently sorting through old sourcecode and making the functions used available. Basically they can be used as building blocks inside of LScripts. It will be made more clearer as I sort out the library.

      The interpolation library will and does include basic interpolation functions used for constructing new data points within the range of a discrete set of known data points. Such as linear, cosine and bilinear interpolation.

      For a fuller explanation see http://en.wikipedia.org/wiki/Interpolation

      Delete