新增平滑曲线demo

This commit is contained in:
feiyangqingyun
2021-03-08 09:29:47 +08:00
parent 6282e879b3
commit cd0029a6de
10 changed files with 342 additions and 1 deletions

27
smoothcurve/smoothcurve.h Normal file
View File

@@ -0,0 +1,27 @@
#ifndef SMOOTHCURVE_H
#define SMOOTHCURVE_H
#include <QObject>
#include <QVector>
#include <QPointF>
#include <QPainterPath>
#ifdef quc
class Q_DECL_EXPORT SmoothCurve : public QObject
#else
class SmoothCurve : public QObject
#endif
{
public:
//创建平滑曲线路径
static QPainterPath createSmoothCurve(const QVector<QPointF> &points);
private:
static void calculateFirstControlPoints(double *&result, const double *rhs, int n);
static void calculateControlPoints(const QVector<QPointF> &datas,
QVector<QPointF> *firstControlPoints,
QVector<QPointF> *secondControlPoints);
};
#endif // SMOOTHCURVE_H