/** * Interpolate 4 values using the offset between value1 and value2 * * @param values * coverage data values * @param offset * offset between the middle two pixels * @return value coverage data value */ protected Double getCubicInterpolationValue(Double[] values, double offset) { Double value = null; if (values != null) { value = getCubicInterpolationValue(values[0], values[1], values[2], values[3], offset); } return value; }
/** * Get the bicubic interpolation coverage data value from the 4 x 4 coverage * data values * * @param values * coverage data values * @param offsetX * x source pixel offset * @param offsetY * y source pixel offset * @return bicubic coverage data value */ protected Double getBicubicInterpolationValue(Double[][] values, float offsetX, float offsetY) { Double value = null; Double[] rowValues = new Double[4]; for (int y = 0; y < 4; y++) { Double rowValue = getCubicInterpolationValue(values[y][0], values[y][1], values[y][2], values[y][3], offsetX); if (rowValue == null) { rowValues = null; break; } rowValues[y] = rowValue; } if (rowValues != null) { value = getCubicInterpolationValue(rowValues, offsetY); } return value; }