kml_?_interp2d_get
Return value zij of array zarr at grid point (i, j).
Interface Definition
float kml_float_interp2d_get(const kml_float_interp2d *interp, const float zarr[], const size_t i, const size_t j)
double kml_double_interp2d_get(const kml_double_interp2d *interp, const double zarr[], const size_t i, const size_t j);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
interp |
const kml_float_interp2d* / const kml_double_interp2d* |
Pointer to an interpolation object. |
Input |
zarr |
Float/Double array |
Array that stores the value of z. |
Input |
i |
size_t |
Index in the x direction. |
Input |
j |
size_t |
Index in the y direction. |
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(size_t));
float x = 1;
float y = 1;
float z = 0;
kml_float_interp2d *interp = kml_float_interp2d_alloc(kml_float_interp2d_bicubic, xSize, ySize);
kml_float_interp2d_init(interp, xArr, yArr, zArr, xSize, ySize);
z = kml_float_interp2d_get(interp, zArr, x, y);
Parent topic: interp2d