kml_?_interp2d_eval_extrap
Return the interpolation result z for a given point (x, y). The interpolation object interp, data arrays xarr, yarr, and zarr, and accelerators xacc and yacc are used in the calculation. The function does not perform out-of-bounds checks for maximum and minimum values. Therefore, when x is outside the range of xarr or y is outside the range of yarr, extrapolation is used.
Interface Definition
float kml_float_interp2d_eval_extrap(const kml_float_interp2d *interp, const float xarr[], const float yarr[], const float zarr[], const float x, const float y, kml_interp_accel *xa, kml_interp_accel *ya)
int kml_float_interp2d_eval_extrap_e(const kml_float_interp2d *interp, const float xarr[], const float yarr[], const float zarr[], const float x, const float y, kml_interp_accel *xa, kml_interp_accel *ya, float *z)
double kml_double_interp2d_eval_extrap(const kml_double_interp2d *interp, const double xarr[], const double yarr[],
const double zarr[], const double x, const double y, kml_interp_accel *xa,
kml_interp_accel *ya);
int kml_double_interp2d_eval_extrap_e(const kml_double_interp2d *interp, const double xarr[], const double yarr[],
const double zarr[], const double x, const double y, kml_interp_accel *xa,
kml_interp_accel *ya, double *z);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
interp |
kml_float_interp2d*, kml_double_interp2d* |
Pointer to an interpolation object. |
Input |
xarr |
float, double |
Array that stores the value of x. |
Input |
yarr |
float, double |
Array that stores the value of y. |
Input |
zarr |
float, double |
Array that stores the value of z. |
Input |
x |
float, double |
Value of the solution point x. |
Input |
y |
float, double |
Value of the solution point y. |
Input |
xa |
kml_interp_accel * |
Pointer to an accelerator object. |
Input |
ya |
kml_interp_accel * |
Pointer to an accelerator object. |
Input |
z |
float *, double * |
Calculation result at the interpolation point. |
Output |
Dependencies
#include "kipl.h"
Examples
const size_t xMin = 4;
const size_t xMax = 2048;
const size_t xSize = 4;
const size_t yMin = 4;
const size_t yMax = 2048;
const size_t ySize = 4;
const float xValLo = 1;
const float xValHi = 2;
const float yValLo = 1;
const float yValHi = 2;
float xArr[4] = {1,1.33,1.67,2};
float yArr[4] = {1,1.33,1.67,2};
float* zArr = (float*)malloc(xSize * ySize * sizeof(float));
float x = 1;
float y = 1;
float z = 0;
kml_float_interp2d *interp = kml_float_interp2d_alloc(kml_float_interp2d_bicubic, xSize, ySize);
kml_interp_accel *xacc = kml_interp_accel_alloc();
kml_interp_accel *yacc = kml_interp_accel_alloc();
kml_float_interp2d_init(interp, xArr, yArr, zArr, xSize, ySize);
z = kml_float_interp2d_eval_extrap(interp, xArr, yArr, zArr, x, y, xacc, yacc);