|
Qwt User's Guide 5.2.2
|
A class for spline interpolation. More...
#include <qwt_spline.h>
Public Types | |
| enum | SplineType { Natural, Periodic } |
Public Member Functions | |
| const QwtArray< double > & | coefficientsA () const |
| const QwtArray< double > & | coefficientsB () const |
| const QwtArray< double > & | coefficientsC () const |
| bool | isValid () const |
| QwtSpline & | operator= (const QwtSpline &) |
| QPolygonF | points () const |
| QwtSpline () | |
| QwtSpline (const QwtSpline &) | |
| void | reset () |
| bool | setPoints (const QPolygonF &points) |
| void | setSplineType (SplineType) |
| SplineType | splineType () const |
| double | value (double x) const |
| ~QwtSpline () | |
Protected Member Functions | |
| bool | buildNaturalSpline (const QPolygonF &) |
| bool | buildPeriodicSpline (const QPolygonF &) |
Protected Attributes | |
| 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; }
Spline type.
| QwtSpline::QwtSpline | ( | ) |
Constructor.
| QwtSpline::QwtSpline | ( | const QwtSpline & | other | ) |
Copy constructor
| other | Spline used for initilization |
| QwtSpline::~QwtSpline | ( | ) |
Destructor.
| bool QwtSpline::buildNaturalSpline | ( | const QPolygonF & | points | ) | [protected] |
Determines the coefficients for a natural spline.
| bool QwtSpline::buildPeriodicSpline | ( | const QPolygonF & | points | ) | [protected] |
Determines the coefficients for a periodic spline.
| const QwtArray< double > & QwtSpline::coefficientsA | ( | ) | const |
| const QwtArray< double > & QwtSpline::coefficientsB | ( | ) | const |
| const QwtArray< double > & QwtSpline::coefficientsC | ( | ) | const |
| bool QwtSpline::isValid | ( | ) | const |
True if valid.
Assignment operator
| other | Spline used for initilization |
| QPolygonF QwtSpline::points | ( | ) | const |
Return points passed by setPoints
| void QwtSpline::reset | ( | ) |
Free allocated memory and set size to 0.
| bool QwtSpline::setPoints | ( | const QPolygonF & | points | ) |
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.
| points | Points |
points[i].x() < points[i+1].x(). If this is not the case, the function will return false | void QwtSpline::setSplineType | ( | SplineType | splineType | ) |
Select the algorithm used for calculating the spline
| splineType | Spline type |
| QwtSpline::SplineType QwtSpline::splineType | ( | ) | const |
| double QwtSpline::value | ( | double | x | ) | const |
Calculate the interpolated function value corresponding to a given argument x.
1.7.3