| Goffice Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
GOCSpline; enum GOCSplineType; GOCSpline * go_cspline_init (double const *x,double const *y,int n,unsigned limits,double c0,double cn); void go_cspline_destroy (GOCSpline *sp); double go_cspline_get_value (GOCSpline const *sp,double x); double go_cspline_get_deriv (GOCSpline const *sp,double x); double * go_cspline_get_values (GOCSpline const *sp,double const *x,int n); double * go_cspline_get_derivs (GOCSpline const *sp,double const *x,int n); double * go_cspline_get_integrals (GOCSpline const *sp,double const *x,int n); GOCSplinel; GOCSplinel * go_cspline_initl (long double const *x,long double const *y,int n,unsigned limits,long double a0,long double a1); void go_cspline_destroyl (GOCSplinel *sp); long double go_cspline_get_valuel (GOCSplinel const *sp,long double x); long double go_cspline_get_derivl (GOCSplinel const *sp,long double x); long double * go_cspline_get_valuesl (GOCSplinel const *sp,long double const *x,int n); long double * go_cspline_get_derivsl (GOCSplinel const *sp,long double const *x,int n); long double * go_cspline_get_integralsl (GOCSplinel const *sp,long double const *x,int n);
typedef enum {
GO_CSPLINE_NATURAL,
GO_CSPLINE_PARABOLIC,
GO_CSPLINE_CUBIC,
GO_CSPLINE_CLAMPED,
GO_CSPLINE_MAX
} GOCSplineType;
GOCSpline * go_cspline_init (double const *x,double const *y,int n,unsigned limits,double c0,double cn);
Creates a spline structure, and computes the coefficients associated with the polynoms. The ith polynome (between x[i-1] and x[i] is: y(x) = y[i-1] + (c[i-1] + (b[i-1] + a[i] * (x - x[i-1])) * (x - x[i-1])) * (x - x[i-1]) where a[i-1], b[i-1], c[i-1], x[i-1] and y[i-1] are the corresponding members of the new structure.
|
the x values |
|
the y values |
|
the number of x and y values |
|
how the limits must be treated, four values are allowed: GO_CSPLINE_NATURAL: first and least second derivatives are 0. GO_CSPLINE_PARABOLIC: the curve will be a parabole arc outside of the limits. GO_CSPLINE_CUBIC: the curve will be cubic outside of the limits. GO_CSPLINE_CLAMPED: the first and last derivatives are imposed. |
|
the first derivative when using clamped splines, not used in the other limit types. |
|
the first derivative when using clamped splines, not used in the other limit types. |
Returns : |
a newly created GOCSpline instance which should be destroyed by a call to go_bezier_spline_destroy. |
void go_cspline_destroy (GOCSpline *sp);
Frees the spline structure when done.
|
a spline structure returned by go_cspline_init. |
double go_cspline_get_value (GOCSpline const *sp,double x);
sp must be a valid spline structure as returned by go_cspline_init.
|
a spline structure returned by go_cspline_init. |
|
The value |
Returns : |
the interpolated value for x, or 0 if an error occurred. |
double go_cspline_get_deriv (GOCSpline const *sp,double x);
sp must be a valid spline structure as returned by go_cspline_init.
|
a spline structure returned by go_cspline_init. |
|
the value |
Returns : |
the interpolated derivative at x, or 0 if an error occurred. |
double * go_cspline_get_values (GOCSpline const *sp,double const *x,int n);
sp must be a valid spline structure as returned by go_cspline_init. The x values must be sorted in increasing order.
|
a spline structure returned by go_cspline_init. |
|
a vector a values at which interpolation is requested. |
|
the number of interpolation requested. |
Returns : |
a newly allocated array of interpolated values which should be destroyed by a call to g_free when not anymore needed, or NULL if an error occurred. |
double * go_cspline_get_derivs (GOCSpline const *sp,double const *x,int n);
sp must be a valid spline structure as returned by go_cspline_init. The x values must be sorted in increasing order.
|
a spline structure returned by go_cspline_init. |
|
a vector a values at which interpolation is requested. |
|
the number of interpolation requested. |
Returns : |
a newly allocated array of the n interpolated derivatives which should be destroyed by a call to g_free when not anymore needed, or NULL if an error occurred. |
double * go_cspline_get_integrals (GOCSpline const *sp,double const *x,int n);
sp must be a valid spline structure as returned by go_cspline_init. The x values must be sorted in increasing order.
|
a spline structure returned by go_cspline_init. |
|
a vector a values at which interpolation is requested. |
|
the number of interpolation requested. |
Returns : |
a newly allocated array of the n-1 integrals on the intervals between two consecutive values stored in x. which should be destroyed by a call to g_free when not anymore needed, or NULL if an error occurred. |
GOCSplinel * go_cspline_initl (long double const *x,long double const *y,int n,unsigned limits,long double a0,long double a1);
|
|
|
|
|
|
|
|
|
|
|
|
Returns : |
long double go_cspline_get_valuel (GOCSplinel const *sp,long double x);
|
|
|
|
Returns : |
long double go_cspline_get_derivl (GOCSplinel const *sp,long double x);
|
|
|
|
Returns : |
long double * go_cspline_get_valuesl (GOCSplinel const *sp,long double const *x,int n);
|
|
|
|
|
|
Returns : |
long double * go_cspline_get_derivsl (GOCSplinel const *sp,long double const *x,int n);
|
|
|
|
|
|
Returns : |
long double * go_cspline_get_integralsl (GOCSplinel const *sp,long double const *x,int n);
|
|
|
|
|
|
Returns : |