cd-interp

## cd-interp cd-interp — Interpolate 2D data using a variety of methods |

## Synopsis

    #define             CD_INTERP_ERROR
    #define             CD_INTERP_TYPE_ERROR
    gboolean            (*prepare)                          (CdInterp *interp,
                                                             GError **error);
    gdouble             (*eval)                             (CdInterp *interp,
                                                             gdouble value,
                                                             GError **error);
    void                (*_cd_interp_reserved1)             (void);
    void                (*_cd_interp_reserved2)             (void);
    void                (*_cd_interp_reserved3)             (void);
    void                (*_cd_interp_reserved4)             (void);
    void                (*_cd_interp_reserved5)             (void);
    void                (*_cd_interp_reserved6)             (void);
    void                (*_cd_interp_reserved7)             (void);
    void                (*_cd_interp_reserved8)             (void);
    enum                CdInterpError;
    enum                CdInterpKind;
    GQuark              cd_interp_error_quark               (void);
    CdInterpKind        cd_interp_get_kind                  (CdInterp *interp);
    GArray *            cd_interp_get_x                     (CdInterp *interp);
    GArray *            cd_interp_get_y                     (CdInterp *interp);
    guint               cd_interp_get_size                  (CdInterp *interp);
    void                cd_interp_insert                    (CdInterp *interp,
                                                             gdouble x,
                                                             gdouble y);
    gboolean            cd_interp_prepare                   (CdInterp *interp,
                                                             GError **error);
    gdouble             cd_interp_eval                      (CdInterp *interp,
                                                             gdouble value,
                                                             GError **error);
    const gchar *       cd_interp_kind_to_string            (CdInterpKind kind);

## Description

This object is a superclass of different interpolation methods.

## Details

### CD_INTERP_ERROR

    #define CD_INTERP_ERROR		(cd_interp_error_quark ())

### CD_INTERP_TYPE_ERROR

    #define CD_INTERP_TYPE_ERROR (cd_interp_error_get_type ())

### prepare ()

    gboolean            (*prepare)                          (CdInterp *interp,
                                                             GError **error);

### eval ()

    gdouble             (*eval)                             (CdInterp *interp,
                                                             gdouble value,
                                                             GError **error);

### _cd_interp_reserved1 ()

    void                (*_cd_interp_reserved1)             (void);

### _cd_interp_reserved2 ()

    void                (*_cd_interp_reserved2)             (void);

### _cd_interp_reserved3 ()

    void                (*_cd_interp_reserved3)             (void);

### _cd_interp_reserved4 ()

    void                (*_cd_interp_reserved4)             (void);

### _cd_interp_reserved5 ()

    void                (*_cd_interp_reserved5)             (void);

### _cd_interp_reserved6 ()

    void                (*_cd_interp_reserved6)             (void);

### _cd_interp_reserved7 ()

    void                (*_cd_interp_reserved7)             (void);

### _cd_interp_reserved8 ()

    void                (*_cd_interp_reserved8)             (void);

### enum CdInterpError

    typedef enum {
    	CD_INTERP_ERROR_FAILED,
    	CD_INTERP_ERROR_LAST
    } CdInterpError;

Errors that can be thrown

`CD_INTERP_ERROR_FAILED` | the method failed for an unknown reason
`CD_INTERP_ERROR_LAST` |

### enum CdInterpKind

    typedef enum {
    	CD_INTERP_KIND_LINEAR,
    	CD_INTERP_KIND_AKIMA,
    	CD_INTERP_KIND_LAST
    } CdInterpKind;

The kind of interpolation.

`CD_INTERP_KIND_LINEAR` |
`CD_INTERP_KIND_AKIMA` |
`CD_INTERP_KIND_LAST` |

### cd_interp_error_quark ()

    GQuark              cd_interp_error_quark               (void);

Returns : | An error quark.

Since 0.1.31

### cd_interp_get_kind ()

    CdInterpKind        cd_interp_get_kind                  (CdInterp *interp);

Gets the kind of INTERP file.

`interp` : | a CdInterp instance.
Returns : | a CdInterpKind, e.g `CD_INTERP_KIND_AKIMA`.

Since 0.1.31

### cd_interp_get_x ()

    GArray *            cd_interp_get_x                     (CdInterp *interp);

Gets the X data used the interpolation.

NOTE: this is only guaranteed to return the data inserted by `cd_interp_insert()` *BEFORE* calling `cd_interp_prepare()`.

After prepating the CdInterp this data should be considered an implementation detail.

`interp` : | a CdInterp instance.
Returns : | The X co-ordinate data. [transfer none][element-type gdouble]

Since 0.1.31

### cd_interp_get_y ()

    GArray *            cd_interp_get_y                     (CdInterp *interp);

Gets the Y data used the interpolation.

NOTE: this is only guaranteed to return the data inserted by `cd_interp_insert()` *BEFORE* calling `cd_interp_prepare()`.

After prepating the CdInterp this data should be considered an implementation detail.

`interp` : | a CdInterp instance.
Returns : | The Y co-ordinate data. [transfer none][element-type gdouble]

Since 0.1.31

### cd_interp_get_size ()

    guint               cd_interp_get_size                  (CdInterp *interp);

Gets the number of items of data added with `cd_interp_insert()`.

NOTE: This method has to be called after `cd_interp_prepare()` and it returns the number of items originally in the array. If you need the updated private size then just use `cd_interp_get_x()` and read the size from that.

`interp` : | a CdInterp instance.
Returns : | The original array size

Since 0.1.31

### cd_interp_insert ()

    void                cd_interp_insert                    (CdInterp *interp,
                                                             gdouble x,
                                                             gdouble y);

Inserts data to be interpolated.

`interp` : | a CdInterp instance.
`x` : | X data
`y` : | Y data

Since 0.1.31

### cd_interp_prepare ()

    gboolean            cd_interp_prepare                   (CdInterp *interp,
                                                             GError **error);

Prepares the data set so that `cd_interp_eval()` can be used.

`interp` : | a CdInterp instance.
Returns : | `TRUE` for success

Since 0.1.31

### cd_interp_eval ()

    gdouble             cd_interp_eval                      (CdInterp *interp,
                                                             gdouble value,
                                                             GError **error);

Evaluate the interpolation function at a specific point. You must have called `cd_interp_insert()` and `cd_interp_prepare()` before calling this method.

`interp` : | a CdInterp instance.
`value` : | The X co-ordinate
`error` : | a GError or `NULL`
Returns : | The Y co-ordinate, or -1 for error

Since 0.1.31

### cd_interp_kind_to_string ()

    const gchar *       cd_interp_kind_to_string            (CdInterpKind kind);