9 #include "qwt_polar_fitter.h"
11 #include <qpainterpath.h>
13 class QwtPolarFitter::PrivateData
33 m_data =
new PrivateData;
62 return m_data->stepCount;
74 if ( m_data->stepCount <= 0 || points.size() <= 1 )
77 QPolygonF fittedPoints;
79 int numPoints = points.size() + ( points.size() - 1 ) * m_data->stepCount;
81 fittedPoints.resize( numPoints );
84 fittedPoints[index++] = points[0];
85 for (
int i = 1; i < points.size(); i++ )
87 const QPointF& p1 = points[i - 1];
88 const QPointF& p2 = points[i];
90 const double dx = ( p2.x() - p1.x() ) / m_data->stepCount;
91 const double dy = ( p2.y() - p1.y() ) / m_data->stepCount;
92 for (
int j = 1; j <= m_data->stepCount; j++ )
94 const double x = p1.x() + j * dx;
95 const double y = p1.y() + j * dy;
97 fittedPoints[index++] = QPointF( x, y );
100 fittedPoints.resize( index );
113 path.addPolygon(
fitCurve( points ) );
Abstract base class for a curve fitter.
A simple curve fitter for polar points.
void setStepCount(int size)
virtual QPainterPath fitCurvePath(const QPolygonF &) const override
QwtPolarFitter(int stepCount=5)
virtual QPolygonF fitCurve(const QPolygonF &) const override
virtual ~QwtPolarFitter()
Destructor.