GOffice.CSpline¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
a |
r/w |
||
b |
r/w |
||
c |
r/w |
||
n |
r/w |
||
ref_count |
r/w |
||
x |
r/w |
||
y |
r/w |
Methods¶
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class GOffice.CSpline¶
- classmethod destroyl(sp)¶
- Parameters:
sp (
GOffice.CSplinel
) –
- classmethod init(x, y, n, limits, c0, cn)¶
- Parameters:
x (
float
) – the x valuesy (
float
) – the y valuesn (
int
) – the number of x and y valueslimits (
int
) – how the limits must be treated, four values are allowed:GOffice.CSplineType.NATURAL
: first and least second derivatives are 0.GOffice.CSplineType.PARABOLIC
: the curve will be a parabole arc outside of the limits.GOffice.CSplineType.CUBIC
: the curve will be cubic outside of the limits.GOffice.CSplineType.CLAMPED
: the first and last derivatives are imposed.c0 (
float
) – the first derivative when using clamped splines, not used in the other limit types.cn (
float
) – the first derivative when using clamped splines, not used in the other limit types.
- Returns:
a newly created
GOffice.CSpline
instance which should be destroyed by a call toGOffice.CSpline.destroy
.- Return type:
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.
- destroy()¶
Frees the spline structure when done.
- get_deriv(x)¶
- Parameters:
x (
float
) – theGOffice.value
- Returns:
the interpolated derivative at x, or 0 if an error occurred.
- Return type:
sp must be a valid spline structure as returned by
GOffice.CSpline.init
.
- get_derivs(x, n)¶
- Parameters:
- Returns:
a newly allocated array of the n interpolated derivatives which should be destroyed by a call to
GLib.free
when not anymore needed, orNone
if an error occurred.- Return type:
sp must be a valid spline structure as returned by
GOffice.CSpline.init
. The x values must be sorted in increasing order.
- get_integrals(x, n)¶
- Parameters:
- 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
GLib.free
when not anymore needed, orNone
if an error occurred.- Return type:
sp must be a valid spline structure as returned by
GOffice.CSpline.init
. The x values must be sorted in increasing order.
- get_value(x)¶
- Parameters:
x (
float
) – TheGOffice.value
- Returns:
the interpolated
GOffice.value
for x, or 0 if an error occurred.- Return type:
sp must be a valid spline structure as returned by
GOffice.CSpline.init
.
- get_values(x, n)¶
- Parameters:
- Returns:
a newly allocated array of interpolated values which should be destroyed by a call to
GLib.free
when not anymore needed, orNone
if an error occurred.- Return type:
sp must be a valid spline structure as returned by
GOffice.CSpline.init
. The x values must be sorted in increasing order.