/** * Bicubic interpolation of the value at x,y where 0<=x<=1 and 0<=y<=1 given * the values at integer coordinates from (-1,-1) to (3,3). * * @param x * the x position (in 0..1) * @param y * the y position (in 0..1) * @param p * a 4x4 array of known values at (-1,-1) to (3,3) * * @return the interpolated value (x,y) */ public static double bicubicInterp(double x, double y, double[][] p) { final double y0 = cubicInterp(y, p[0]); final double y1 = cubicInterp(y, p[1]); final double y2 = cubicInterp(y, p[2]); final double y3 = cubicInterp(y, p[3]); return cubicInterp(x, y0, y1, y2, y3); }
/** * Bicubic interpolation of the value at x,y where 0<=x<=1 and 0<=y<=1 given * the values at integer coordinates from (-1,-1) to (3,3). * * @param x * the x position (in 0..1) * @param y * the y position (in 0..1) * @param p * a 4x4 array of known values at (-1,-1) to (3,3) * * @return the interpolated value (x,y) */ public static float bicubicInterp(float x, float y, float[][] p) { final float y0 = cubicInterp(y, p[0]); final float y1 = cubicInterp(y, p[1]); final float y2 = cubicInterp(y, p[2]); final float y3 = cubicInterp(y, p[3]); return cubicInterp(x, y0, y1, y2, y3); } }