kml_?_interp2d_init
Initialize interpolation object interp. For data (xarr, yarr, zarr), xarr and yarr are arrays of sizes xsize and ysize, respectively, and zarr is a function result array of size xsize x ysize. The interpolation object (kml_float_interp2d or kml_double_interp2d) does not store xarr, yarr, and zarr. Instead, it only stores the static states calculated from the data. xarr and yarr must be strictly sorted in ascending order.
Interface Definition
int kml_float_interp2d_init(kml_float_interp2d *interp, const float xarr[], const float yarr[], const float zarr[], const size_t xsize, const size_t ysize)
int kml_double_interp2d_init(kml_double_interp2d *interp, const double xarr[], const double yarr[], const double zarr[],
const size_t xsize, const size_t ysize);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
interp |
kml_float_interp2d* / kml_double_interp2d* |
Pointer to an interpolation object. |
Output |
xarr |
Float/Double array |
Array that stores the value of x. |
Input |
yarr |
Float/Double array |
Array that stores the value of y. |
Input |
zarr |
Float/Double array |
Array that stores the value of z. |
Input |
xsize |
size_t |
Length of the x array. |
Input |
ysize |
size_t |
Length of the y array. |
Input |
Dependencies
#include "kipl.h"
Examples
const size_t xSize = 4;
const size_t ySize = 4;
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));
kml_float_interp2d *interp = kml_float_interp2d_alloc(kml_float_interp2d_bicubic, xSize, ySize);
kml_float_interp2d_init(interp, xArr, yArr, zArr, xSize, ySize);