- bookworm 6.1.4-2
- testing 6.1.4-2
- unstable 6.1.4-2
- experimental 6.2.0-1
QwtSpline(3) | Qwt User's Guide | QwtSpline(3) |
NAME¶
QwtSpline - A class for spline interpolation.
SYNOPSIS¶
#include <qwt_spline.h>
Public Types¶
enum SplineType { Natural, Periodic }
Spline type.
Public Member Functions¶
QwtSpline ()
Constructor. QwtSpline (const QwtSpline &)
~QwtSpline ()
Destructor. QwtSpline & operator= (const QwtSpline
&)
void setSplineType (SplineType)
SplineType splineType () const
bool setPoints (const QPolygonF &points)
Calculate the spline coefficients. QPolygonF points () const
void reset ()
Free allocated memory and set size to 0. bool isValid () const
True if valid. double value (double x) const
const QVector< double > & coefficientsA () const
const QVector< double > & coefficientsB () const
const QVector< double > & coefficientsC () const
Protected Member Functions¶
bool buildNaturalSpline (const QPolygonF &)
Determines the coefficients for a natural spline. bool
buildPeriodicSpline (const QPolygonF &)
Determines the coefficients for a periodic spline.
Detailed Description¶
A class for spline interpolation.
The QwtSpline class is used for cubical spline interpolation. Two types of splines, natural and periodic, are supported.
Usage:
- 1.
- First call setPoints() to determine the spline coefficients for a tabulated function y(x).
- 2.
- After the coefficients have been set up, the interpolated function value for an argument x can be determined by calling QwtSpline::value().
Example:
#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; }
Member Enumeration Documentation¶
enum QwtSpline::SplineType¶
Spline type.
Enumerator
Constructor & Destructor Documentation¶
QwtSpline::QwtSpline (const QwtSpline & other)¶
Copy constructor
Parameters:
Member Function Documentation¶
bool QwtSpline::buildNaturalSpline (const QPolygonF & points) [protected]¶
Determines the coefficients for a natural spline.
Returns:
bool QwtSpline::buildPeriodicSpline (const QPolygonF & points) [protected]¶
Determines the coefficients for a periodic spline.
Returns:
const QVector< double > & QwtSpline::coefficientsA () const¶
Returns:
const QVector< double > & QwtSpline::coefficientsB () const¶
Returns:
const QVector< double > & QwtSpline::coefficientsC () const¶
Returns:
QwtSpline & QwtSpline::operator= (const QwtSpline & other)¶
Assignment operator
Parameters:
Returns:
QPolygonF QwtSpline::points () const¶
Returns:
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.
Parameters:
Returns:
Warning:
void QwtSpline::setSplineType (SplineType splineType)¶
Select the algorithm used for calculating the spline
Parameters:
See also:
QwtSpline::SplineType QwtSpline::splineType () const¶
Returns:
See also:
double QwtSpline::value (double x) const¶
Calculate the interpolated function value corresponding to a given argument x.
Parameters:
Returns:
Author¶
Generated automatically by Doxygen for Qwt User's Guide from the source code.
Wed Jan 2 2019 | Version 6.1.4 |