logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

QwtSpline - A class for spline interpolation.

Author

       Generated automatically by Doxygen for Qwt User's Guide from the source code.

Version 6.1.4                                    Wed Jan 2 2019                                     QwtSpline(3)

Constructor & Destructor Documentation

QwtSpline::QwtSpline(constQwtSpline&other)
       Copy constructor
       Parameters:other Spline used for initialization

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

enumQwtSpline::SplineType
       Spline type.
       EnumeratorNatural
              A natural spline.
       Periodic
              A periodic spline.

Member Function Documentation

boolQwtSpline::buildNaturalSpline(constQPolygonF&points)[protected]
       Determines the coefficients for a natural spline.
       Returns:
           true if successful
   boolQwtSpline::buildPeriodicSpline(constQPolygonF&points)[protected]
       Determines the coefficients for a periodic spline.
       Returns:
           true if successful
   constQVector<double>&QwtSpline::coefficientsA()constReturns:
           A coefficients
   constQVector<double>&QwtSpline::coefficientsB()constReturns:
           B coefficients
   constQVector<double>&QwtSpline::coefficientsC()constReturns:
           C coefficients
   QwtSpline&QwtSpline::operator=(constQwtSpline&other)
       Assignment operator
       Parameters:other Spline used for initialization
       Returns:
           *this
   QPolygonFQwtSpline::points()constReturns:
           Points, that have been by setPoints()boolQwtSpline::setPoints(constQPolygonF&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:points Points
       Returns:
           true if successful
       Warning:
           The sequence of  x  (but  not  y)  values  has  to  be  strictly  monotone  increasing,  which  means
           points[i].x() < points[i+1].x(). If this is not the case, the function will return false
   voidQwtSpline::setSplineType(SplineTypesplineType)
       Select the algorithm used for calculating the spline
       Parameters:splineType Spline type
       Seealso:splineType()QwtSpline::SplineTypeQwtSpline::splineType()constReturns:
           the spline type
       Seealso:setSplineType()doubleQwtSpline::value(doublex)const
       Calculate the interpolated function value corresponding to a given argument x.
       Parameters:x Coordinate
       Returns:
           Interpolated coordinate

Name

       QwtSpline - A class for spline interpolation.

Synopsis

       #include <qwt_spline.h>

   PublicTypes
       enum SplineType { Natural, Periodic }
           Spline type.

   PublicMemberFunctionsQwtSpline ()
           Constructor.
       QwtSpline (const QwtSpline &)
       ~QwtSpline ()
           Destructor.
       QwtSpline & operator= (const QwtSpline &)
       void setSplineType (SplineType)
       SplineTypesplineType () 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

   ProtectedMemberFunctions
       bool buildNaturalSpline (const QPolygonF &)
           Determines the coefficients for a natural spline.
       bool buildPeriodicSpline (const QPolygonF &)
           Determines the coefficients for a periodic spline.

See Also