7 #include "FittingCurveCoefficients.h" 8 #include "FittingCurve.h" 11 #include <QPainterPath> 13 #include "Transformation.h" 22 const int NUM_POINTS = 1000;
23 const double Z_LINE = 500;
26 setPen (QPen (QColor (Qt::red)));
32 for (
int i = 0; i < NUM_POINTS; i++) {
35 double s = (double) i / (
double) (NUM_POINTS - 1);
36 double x = xMin + s * (xMax - xMin);
37 double y = yFromCoefficientsAndX (fittingCoef,
50 QPointF posGraph (x, y);
57 path.moveTo (posScreen);
59 path.lineTo (posScreen);
67 FittingCurve::~FittingCurve()
71 double FittingCurve::yFromCoefficientsAndX (
const FittingCurveCoefficients &fittingCoef,
76 for (
int order = 0; order < fittingCoef.size(); order++) {
77 sum += fittingCoef [order] * qPow (x, order);
FittingCurve(const FittingCurveCoefficients &fittingCoef, double xMin, double xMax, bool isLogXTheta, bool isLogYRadius, const Transformation &transformation)
Single constructor.