33 Type = UserType + Spline
58 SplineItem(
int degree = 3,
int derivOrder = 0,
double xLow = 0,
59 unsigned color = 0,
Symbol symbol = SolidLine,
double fx = 1,
60 double fy = 1, QGraphicsItem* parent =
nullptr,
double xMin = 0,
61 double xMax = 0,
double deltaX = 0,
bool visible =
true,
62 FillStyle fillStyle = NoBrush,
double xOffset = 0,
63 double yOffset = 0,
double relSize = 1);
74 Symbol symbol = SolidLine, QGraphicsItem* parent =
nullptr);
94 int calcTable(
const double* x,
double* values,
int n = 1,
int derivOrder = 0,
95 double xLow = 0)
const;
102 inline int degree()
const {
return m_degree; };
104 inline double deltaX()
const {
return m_deltaX; };
115 void exponent(
int& expX,
int& expY,
double& fx,
double& fy,
bool logX)
const;
123 void exportTable(QTextStream& stream,
char separator,
char format,
124 int precision)
const;
138 double* chiSquare =
nullptr,
int* numKnots =
nullptr,
140 double* avgErr =
nullptr);
156 int fit(
const double* x,
const double* y,
const double* errors,
int n,
157 double xMin,
double xMax,
double* chiSquare =
nullptr,
158 int* numKnots =
nullptr,
double smooth = 0,
179 void limits(
double& xMin,
double& xMax,
double& yMin,
double& yMax,
182 inline int numKnots()
const {
return m_numKnots; };
184 virtual void paint(QPainter* painter,
const QStyleOptionGraphicsItem* option,
185 QWidget* widget =
nullptr)
override;
193 int roots(QVector<double>& zero,
int derivOrder = 0,
194 double offset = 0)
const;
201 inline void setDegree(
int degree) { m_degree = degree; };
206 inline void setDeltaX(
double deltaX) { m_deltaX = deltaX; };
216 inline void setXLow(
double xLow) { m_xLow = xLow; };
221 inline void setXMax(
double xMax) { m_xMax = xMax; };
226 inline void setXMin(
double xMin) { m_xMin = xMin; };
228 virtual QPainterPath
shape()
const override;
242 const double* errors0,
int& n,
246 virtual int type()
const override {
return Type; };
253 void writePlo(KConfigGroup* plo,
char format,
int precision)
const;
255 inline double xLow()
const {
return m_xLow; };
257 inline double xMax()
const {
return m_xMax; };
259 inline double xMin()
const {
return m_xMin; };
272 int m_degree, m_numKnots, m_derivOrder;
273 mutable int degreeo, numKnotso, derivOrdero;
274 double m_xMin, m_xMax, m_deltaX, m_xLow;
275 mutable double xMino, xMaxo, deltaXo, xLowo;
276 mutable QVector<double> m_xValues, m_yValues, t, c;
Array item class.
Definition arrayitem.h:37
FillStyle
Fill styles.
Definition kplitem.h:45
Symbol
Symbol types.
Definition kplitem.h:83
Scaled item class.
Definition scaleditem.h:25
Spline item class.
Definition splineitem.h:29
virtual int type() const override
Returns specific QGraphicsItem type number.
Definition splineitem.h:246
double * yValues() const
Returns pointer to y function value array.
double xMax() const
Returns maximum argument value.
Definition splineitem.h:257
int degree() const
Returns degree of spline.
Definition splineitem.h:102
double * xValues() const
Returns pointer to x function value array.
int numKnots() const
Returns number of knots.
Definition splineitem.h:182
void copySpline(const SplineItem *a)
Copies spline data.
void setXMax(double xMax)
Sets maximum argument value.
Definition splineitem.h:221
virtual QPainterPath shape() const override
Returns the shape of the plot item.
int interpolation(const double *x, const double *y, int n, double xMin, double xMax)
Performs interpolating (non-smoothing) spline fit.
double xLow() const
Returns lower x limit for spline integral.
Definition splineitem.h:255
double deltaX() const
Returns argument step size.
Definition splineitem.h:104
double xMin() const
Returns minimum argument value.
Definition splineitem.h:259
int fit(const ArrayItem *ai, double xMin, double xMax, double *chiSquare=nullptr, int *numKnots=nullptr, double smooth=0, FunItem::DataErrorStruct *err=nullptr, double *avgErr=nullptr)
Performs smoothing spline fit.
static int sortArrays(const double *x0, const double *y0, const double *errors0, int &n, FunItem::DataErrorStruct *err, double *x, double *y, double *errors)
Sorts arrays and calculates error column.
void setXMin(double xMin)
Sets minimum argument value.
Definition splineitem.h:226
virtual QRectF boundingRect() const override
Calculates bounding rectangle.
SplineItem(int degree=3, int derivOrder=0, double xLow=0, unsigned color=0, Symbol symbol=SolidLine, double fx=1, double fy=1, QGraphicsItem *parent=nullptr, double xMin=0, double xMax=0, double deltaX=0, bool visible=true, FillStyle fillStyle=NoBrush, double xOffset=0, double yOffset=0, double relSize=1)
Constructor.
SplineItem(const SplineItem &a)
Copy constructor.
int fit(const double *x, const double *y, const double *errors, int n, double xMin, double xMax, double *chiSquare=nullptr, int *numKnots=nullptr, double smooth=0, FunItem::DataErrorStruct *err=nullptr, double *avgErr=nullptr)
Performs smoothing spline fit.
virtual ~SplineItem()
Destructor.
void exportTable(QTextStream &stream, char separator, char format, int precision) const
Exports spline value table to file.
void setDerivOrder(int derivOrder)
Sets order of derivative.
Definition splineitem.h:211
void writePlo(KConfigGroup *plo, char format, int precision) const
Writes into plot file.
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) override
Paints item.
void exponent(int &expX, int &expY, double &fx, double &fy, bool logX) const
Calculates normalization factors.
void paintCond(QPainter *painter) const
Paints or calculates bounding area.
SplineItem(const KConfigGroup *plo, unsigned color=0, Symbol symbol=SolidLine, QGraphicsItem *parent=nullptr)
Constructor.
int derivOrder() const
Returns order of derivative.
Definition splineitem.h:106
void setDegree(int degree)
Sets degree of spline.
Definition splineitem.h:201
void setDashOffset()
Sets offset for dashed lines.
void setDeltaX(double deltaX)
Sets argument step size.
Definition splineitem.h:206
int roots(QVector< double > &zero, int derivOrder=0, double offset=0) const
Finds roots of a cubic spline or its derivatives.
void setXLow(double xLow)
Sets lower x limit for spline integral.
Definition splineitem.h:216
int calcTable(const double *x, double *values, int n=1, int derivOrder=0, double xLow=0) const
Calculates spline value table.
int calcTable(bool logX) const
Calculates spline value table.
void limits(double &xMin, double &xMax, double &yMin, double &yMax, bool logX) const
Calculates minimum and maximum values.
Data error structure.
Definition funitem.h:52