/**
 * Based on code from reddit https://www.reddit.com/r/javascript/comments/jxa8x/bicubic_interpolation/
 * @param {number} t ratio
 * @param {number} a position -2
 * @param {number} b position -1
 * @param {number} c position +1
 * @param {number} d position +2
 * @returns {number}
 */
export function interpolate_bicubic(t, a, b, c, d) {
    return 0.5 * (c - a + (2.0 * a - 5.0 * b + 4.0 * c - d + (3.0 * (b - c) + d - a) * t) * t) * t + b;
}