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

Data interpolation is usually pixel-like in Gwyddion, not function-like. That means the contribution of individual data saples is preserved on scaling.

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);

Computes interpolated value from 2 or 4 equidistant values.

For GWY_INTERPOLATION_NONE no data value is actually used, and zero is returned.

For GWY_INTERPOLATION_ROUND or GWY_INTERPOLATION_BILINEAR it is enough to set middle two data values, that to use data in format {0, data[i], data[i+1], 0} and function computes value at data[i+x] (the outer values are not used).

For four value interpolations you have to prepare 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, that is a number from interval [0,1).
data : Array of 4 values to interpolate between (see below).
interpolation : Interpolation type to use.
Returns : Interpolated value.