kml_?_spline2d_init
Initialize interpolation object spline. 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_spline2d or kml_double_spline2d) 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_spline2d_init(kml_float_spline2d *spline, const float xarr[], const float yarr[], const float zarr[], size_t xsize, size_t ysize)
int kml_double_spline2d_init(kml_double_spline2d *spline, const double xarr[], const double yarr[], const double zarr[],
size_t xsize, size_t ysize);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
spline |
kml_float_spline2d* / kml_double_spline2d* |
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_spline2d *spline = kml_float_spline2d_alloc(kml_float_interp2d_bicubic, xSize, ySize);
kml_float_spline2d_init(spline, xArr, yArr, zArr, xSize, ySize);