Qwt User's Guide 6.3.0
Loading...
Searching...
No Matches
qwt_spline.h
1/******************************************************************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10#ifndef QWT_SPLINE_H
11#define QWT_SPLINE_H
12
13#include "qwt_global.h"
14#include "qwt_spline.h"
15
18class QPainterPath;
19class QLineF;
20class QPolygonF;
21
22#if QT_VERSION < 0x060000
23template< typename T > class QVector;
24#endif
25
57class QWT_EXPORT QwtSpline
58{
59 public:
66 {
73
80
92 ClosedPolygon
93 };
94
100 {
103
105 AtEnd
106 };
107
120 {
126
135
144
153 LinearRunout
154 };
155
156 QwtSpline();
157 virtual ~QwtSpline();
158
159 void setParametrization( int type );
160 void setParametrization( QwtSplineParametrization* );
161 const QwtSplineParametrization* parametrization() const;
162
163 void setBoundaryType( BoundaryType );
164 BoundaryType boundaryType() const;
165
166 void setBoundaryValue( BoundaryPosition, double value );
167 double boundaryValue( BoundaryPosition ) const;
168
169 void setBoundaryCondition( BoundaryPosition, int condition );
170 int boundaryCondition( BoundaryPosition ) const;
171
172 void setBoundaryConditions( int condition,
173 double valueBegin = 0.0, double valueEnd = 0.0 );
174
175 virtual QPolygonF polygon( const QPolygonF&, double tolerance ) const;
176 virtual QPainterPath painterPath( const QPolygonF& ) const = 0;
177
178 virtual uint locality() const;
179
180 private:
181 Q_DISABLE_COPY(QwtSpline)
182
183 class PrivateData;
184 PrivateData* m_data;
185};
186
193class QWT_EXPORT QwtSplineInterpolating : public QwtSpline
194{
195 public:
197 virtual ~QwtSplineInterpolating();
198
199 virtual QPolygonF equidistantPolygon( const QPolygonF&,
200 double distance, bool withNodes ) const;
201
202 virtual QPolygonF polygon(
203 const QPolygonF&, double tolerance ) const QWT_OVERRIDE;
204
205 virtual QPainterPath painterPath( const QPolygonF& ) const QWT_OVERRIDE;
206 virtual QVector< QLineF > bezierControlLines( const QPolygonF& ) const = 0;
207
208 private:
209 Q_DISABLE_COPY(QwtSplineInterpolating)
210};
211
216class QWT_EXPORT QwtSplineG1 : public QwtSplineInterpolating
217{
218 public:
219 QwtSplineG1();
220 virtual ~QwtSplineG1();
221};
222
235class QWT_EXPORT QwtSplineC1 : public QwtSplineG1
236{
237 public:
238 QwtSplineC1();
239 virtual ~QwtSplineC1();
240
241 virtual QPainterPath painterPath( const QPolygonF& ) const QWT_OVERRIDE;
242 virtual QVector< QLineF > bezierControlLines( const QPolygonF& ) const QWT_OVERRIDE;
243
244 virtual QPolygonF equidistantPolygon( const QPolygonF&,
245 double distance, bool withNodes ) const QWT_OVERRIDE;
246
247 // these methods are the non parametric part
248 virtual QVector< QwtSplinePolynomial > polynomials( const QPolygonF& ) const;
249 virtual QVector< double > slopes( const QPolygonF& ) const = 0;
250
251 virtual double slopeAtBeginning( const QPolygonF&, double slopeNext ) const;
252 virtual double slopeAtEnd( const QPolygonF&, double slopeBefore ) const;
253};
254
267class QWT_EXPORT QwtSplineC2 : public QwtSplineC1
268{
269 public:
276 {
283 CubicRunout = LinearRunout + 1,
284
292 NotAKnot
293 };
294
295 QwtSplineC2();
296 virtual ~QwtSplineC2();
297
298 virtual QPainterPath painterPath( const QPolygonF& ) const QWT_OVERRIDE;
299 virtual QVector< QLineF > bezierControlLines( const QPolygonF& ) const QWT_OVERRIDE;
300
301 virtual QPolygonF equidistantPolygon( const QPolygonF&,
302 double distance, bool withNodes ) const QWT_OVERRIDE;
303
304 // calculating the parametric equations
305 virtual QVector< QwtSplinePolynomial > polynomials( const QPolygonF& ) const QWT_OVERRIDE;
306 virtual QVector< double > slopes( const QPolygonF& ) const QWT_OVERRIDE;
307 virtual QVector< double > curvatures( const QPolygonF& ) const = 0;
308};
309
310#endif
Base class for spline interpolations providing a first order parametric continuity ( C1 ) between adj...
Definition qwt_spline.h:236
virtual QVector< double > slopes(const QPolygonF &) const =0
Find the first derivative at the control points.
Base class for spline interpolations providing a second order parametric continuity ( C2 ) between ad...
Definition qwt_spline.h:268
virtual QVector< double > curvatures(const QPolygonF &) const =0
Find the second derivative at the control points.
Base class for spline interpolations providing a first order geometric continuity ( G1 ) between adjo...
Definition qwt_spline.h:217
Base class for all splines.
Definition qwt_spline.h:58
@ AtBeginning
the condition is at the beginning of the polynomial
Definition qwt_spline.h:102
virtual QPainterPath painterPath(const QPolygonF &) const =0
@ PeriodicPolygon
Definition qwt_spline.h:79
@ ConditionalBoundaries
Definition qwt_spline.h:72
BoundaryCondition
Boundary condition.
Definition qwt_spline.h:120
Base class for a spline interpolation.
Definition qwt_spline.h:194
virtual QVector< QLineF > bezierControlLines(const QPolygonF &) const =0
Interpolate a curve with Bezier curves.
Curve parametrization used for a spline interpolation.
A cubic polynomial without constant term.