Eneboo - Documentación para desarrolladores
|
A class for spline interpolation. Más...
#include <qwt_spline.h>
Clases | |
class | PrivateData |
Tipos públicos | |
enum | SplineType { Natural, Periodic } |
Métodos públicos | |
QwtSpline () | |
Constructor. | |
QwtSpline (const QwtSpline &) | |
~QwtSpline () | |
Destructor. | |
QwtSpline & | operator= (const QwtSpline &) |
void | setSplineType (SplineType) |
SplineType | splineType () const |
bool | setPoints (const QwtArray< QwtDoublePoint > &points) |
Determine the function table index corresponding to a value x. | |
QwtArray< QwtDoublePoint > | points () const |
void | reset () |
Free allocated memory and set size to 0. | |
bool | isValid () const |
True if valid. | |
double | value (double x) const |
Métodos protegidos | |
bool | buildNaturalSpline (const QwtArray< QwtDoublePoint > &) |
Determines the coefficients for a natural spline. | |
bool | buildPeriodicSpline (const QwtArray< QwtDoublePoint > &) |
Determines the coefficients for a periodic spline. | |
Atributos protegidos | |
PrivateData * | d_data |
A class for spline interpolation.
The QwtSpline class is used for cubical spline interpolation. Two types of splines, natural and periodic, are supported.
#include <qwt_spline.h> QPolygonF interpolate(const QPolygonF& points, int numValues) { QwtSpline spline; if ( !spline.setPoints(points) ) return points; QPolygonF interpolatedPoints(numValues); const double delta = (points[numPoints - 1].x() - points[0].x()) / (points.size() - 1); for(i = 0; i < points.size(); i++) / interpolate { const double x = points[0].x() + i * delta; interpolatedPoints[i].setX(x); interpolatedPoints[i].setY(spline.value(x)); } return interpolatedPoints; }
QwtSpline::QwtSpline | ( | ) |
Constructor.
QwtSpline::QwtSpline | ( | const QwtSpline & | other | ) |
QwtSpline::~QwtSpline | ( | ) |
Destructor.
bool QwtSpline::buildNaturalSpline | ( | const QwtArray< QwtDoublePoint > & | points | ) | [protected] |
Determines the coefficients for a natural spline.
bool QwtSpline::buildPeriodicSpline | ( | const QwtArray< QwtDoublePoint > & | points | ) | [protected] |
Determines the coefficients for a periodic spline.
bool QwtSpline::isValid | ( | void | ) | const |
True if valid.
QwtArray< QwtDoublePoint > QwtSpline::points | ( | ) | const |
Return points passed by setPoints
void QwtSpline::reset | ( | void | ) |
Free allocated memory and set size to 0.
bool QwtSpline::setPoints | ( | const QwtArray< QwtDoublePoint > & | points | ) |
Determine the function table index corresponding to a value x.
Calculate the spline coefficients
Depending on the value of periodic, this function will determine the coefficients for a natural or a periodic spline and store them internally.
x | |
y | points |
size | number of points |
periodic | if true, calculate periodic spline |
x[0] < x[1] < .... < x[n-1]
. If this is not the case, the function will return false void QwtSpline::setSplineType | ( | SplineType | splineType | ) |
QwtSpline::SplineType QwtSpline::splineType | ( | ) | const |
double QwtSpline::value | ( | double | x | ) | const |
Calculate the interpolated function value corresponding to a given argument x.
PrivateData* QwtSpline::d_data [protected] |