⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spline.h

📁 Class for construction of cubic natural and periodic splines. Allows to construct the spline passing
💻 H
字号:
#ifndef SPLINE_H#define SPLINE_H#include <QPolygonF>#include <QPainter>/*!  \brief A class for spline interpolation  The Spline class is used for cubical spline interpolation.  Two types of splines, natural and periodic, are supported.    \par Usage:  <ol>  <li>First call setPoints() to determine the spline coefficients       for a tabulated function y(x).  <li>After the coefficients have been set up, the interpolated      function value for an argument x can be determined by calling       Spline::value().  </ol>  \par Example:  \code#include <spline.h>QPolygonF interpolate(const QPolygonF& points, int numValues){    Spline 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;}  \endcode*/class Spline{public:    enum SplineType    {        Natural,        Periodic    };    Spline();    Spline(const QPolygonF& points, SplineType t = Natural);    Spline( const Spline & );    ~Spline();    Spline &operator=( const Spline & );    void setSplineType(SplineType);    SplineType splineType() const;    bool setPoints(const QPolygonF& points);    QPolygonF points() const;    void reset();    bool isValid() const;    double value(double x) const;    void draw(QPainter &p);protected:    bool buildNaturalSpline(const QPolygonF &);    bool buildPeriodicSpline(const QPolygonF &);    class PrivateData;    PrivateData *d_data;};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -