CdInterp

CdInterp — Interpolate 2D data using a variety of methods

Synopsis

#define             CD_INTERP_ERROR
#define             CD_INTERP_TYPE_ERROR
#define             CD_TYPE_INTERP
struct              CdInterpClass;
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 ())

CD_TYPE_INTERP

#define CD_TYPE_INTERP (cd_interp_get_type ())

struct CdInterpClass

struct CdInterpClass {
	GObjectClass		 parent_class;
};

enum CdInterpError

typedef enum {
	CD_INTERP_ERROR_FAILED,
} CdInterpError;

Errors that can be thrown

CD_INTERP_ERROR_FAILED

the method failed for an unknown reason

enum CdInterpKind

typedef enum {
	CD_INTERP_KIND_LINEAR,
	CD_INTERP_KIND_AKIMA,
} CdInterpKind;

The kind of interpolation.

CD_INTERP_KIND_LINEAR

CD_INTERP_KIND_AKIMA


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