interpolation

interpolation — General interpolation functions

Synopsis




gdouble     gwy_interpolation_get_dval      (gdouble x,
                                             gdouble x1_,
                                             gdouble y1_,
                                             gdouble x2_,
                                             gdouble y2_,
                                             GwyInterpolationType interpolation);
gdouble     gwy_interpolation_get_dval_of_equidists
                                            (gdouble x,
                                             gdouble *data,
                                             GwyInterpolationType interpolation);

Description

Details

gwy_interpolation_get_dval ()

gdouble     gwy_interpolation_get_dval      (gdouble x,
                                             gdouble x1_,
                                             gdouble y1_,
                                             gdouble x2_,
                                             gdouble y2_,
                                             GwyInterpolationType interpolation);

This function uses two-point interpolation methods to get interpolated value between two arbitrary data points.

x : requested value coordinate
x1_ : x coordinate of first value
y1_ : y coordinate of first value
x2_ : x coordinate of second value
y2_ : y coordinate of second value
interpolation : interpolation type
Returns : interpolated value

gwy_interpolation_get_dval_of_equidists ()

gdouble     gwy_interpolation_get_dval_of_equidists
                                            (gdouble x,
                                             gdouble *data,
                                             GwyInterpolationType interpolation);

Function computes interpolateed value bettween 2 or 4 equidistant values. For using GWY_INTERPOLATION_NONE, GWY_INTERPOLATION_ROUND or GWY_INTERPOLATION_BILINEAR it is enough to use data in format {0, data[i], data[i+1], 0} and function computes value at data[i+x]. For four value interpolations you have to prapare data as {data[i-1], data[i], data[i+1], data[i+2]} and function again returns value at data[i+x].

x : noninteger part of requested x
data : array of 4 gdoubles (see below)
interpolation : interpolation type
Returns : interpolated value