@Override public float interpolate(float x, float y, FImage image, Object workingSpace) { final float[][] working = (float[][]) workingSpace; final int sx = (int) Math.floor(x) - 1; final int sy = (int) Math.floor(y) - 1; final int ex = sx + 3; final int ey = sy + 3; for (int yy = sy, i = 0; yy <= ey; yy++, i++) { for (int xx = sx, j = 0; xx <= ex; xx++, j++) { final int px = xx < 0 ? 0 : xx >= image.width ? image.width - 1 : xx; final int py = yy < 0 ? 0 : yy >= image.height ? image.height - 1 : yy; working[i][j] = image.pixels[py][px]; } } final float dx = (float) (x - Math.floor(x)); final float dy = (float) (y - Math.floor(y)); return Interpolation.bicubicInterp(dx, dy, working); }
dy = 1 + dy; return Interpolation.bilerp(dx, dy, f00, f01, f10, f11);
dy = 1 + dy; final float interpVal = Interpolation.bilerpf(dx, dy, f00, f01, f10, f11); return interpVal;
private double linePointInterp(Line2d line, Point2d point, double lineBeginValue, double lineEndValue) { final double l1Len = line.calculateLength(); final double l1Prop = Line2d.distance(line.begin, point); final double p1Value = Interpolation.lerp(l1Prop, 0, lineBeginValue, l1Len, lineEndValue); return p1Value; }
/** * 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); } }
descriptor[i] = Interpolation.lerp(i, angle[index1], distances[index1], angle[index2], distances[index2]); count += descriptor[i];
/** * 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); }
descriptor[i] = Interpolation.lerp(i, angle[index1], distances[index1], angle[index2], distances[index2]); count += descriptor[i];
dy = 1 + dy; return Interpolation.bilerp(dx, dy, f00, f01, f10, f11);
@Override public float interpolate(float x, float y, FImage image, Object workingSpace) { final float[][] working = (float[][]) workingSpace; final int sx = (int) Math.floor(x) - 1; final int sy = (int) Math.floor(y) - 1; final int ex = sx + 3; final int ey = sy + 3; for (int yy = sy, i = 0; yy <= ey; yy++, i++) { for (int xx = sx, j = 0; xx <= ex; xx++, j++) { final int px = xx < 0 ? 0 : xx >= image.width ? image.width - 1 : xx; final int py = yy < 0 ? 0 : yy >= image.height ? image.height - 1 : yy; working[i][j] = image.pixels[py][px]; } } final float dx = (float) (x - Math.floor(x)); final float dy = (float) (y - Math.floor(y)); return Interpolation.bicubicInterp(dx, dy, working); }
dy = 1 + dy; final float interpVal = Interpolation.bilerpf(dx, dy, f00, f01, f10, f11); return interpVal;
final double n = Interpolation.lerp(offset, 0, begin.getOrdinate(j).doubleValue(), lastLength, end .getOrdinate(j).doubleValue()); np.setOrdinate(j, n);
dy = 1 + dy; final double interpVal = Interpolation.bilerp(dx, dy, f00, f01, f10, f11); return (float) interpVal;
this.sbout.set( i, Interpolation.lerp( (float)(i*scalar), inputSampleX, sbin.get(inputSampleX), inputSampleX+1, sbin.get(inputSampleX+1) ) );
dy = 1 + dy; final double interpVal = Interpolation.bilerp(dx, dy, f00, f01, f10, f11); return (float) interpVal;
this.sbout.set( i, Interpolation.lerp( (float)(i*scalar), inputSampleX, sbin.get(inputSampleX), inputSampleX+1, sbin.get(inputSampleX+1) ) );