Top | ![]() |
![]() |
![]() |
![]() |
GOCSpline * | go_cspline_init () |
void | go_cspline_destroy () |
double | go_cspline_get_value () |
double | go_cspline_get_deriv () |
double * | go_cspline_get_values () |
double * | go_cspline_get_derivs () |
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.
x |
the x values |
|
y |
the y values |
|
n |
the number of x and y values |
|
limits |
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. |
|
c0 |
the first derivative when using clamped splines, not used in the other limit types. |
|
cn |
the first derivative when using clamped splines, not used in the other limit types. |
void
go_cspline_destroy (GOCSpline *sp
);
Frees the spline structure when done.
double go_cspline_get_value (GOCSpline const *sp
,double x
);
sp must be a valid spline structure as returned by go_cspline_init.
double go_cspline_get_deriv (GOCSpline const *sp
,double x
);
sp must be a valid spline structure as returned by go_cspline_init.
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.
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.