Qwt User's Guide 6.2.0

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
16 class QwtSplineParametrization;
17 class QwtSplinePolynomial;
18 class QPainterPath;
19 class QLineF;
20 class QPolygonF;
21
22 #if QT_VERSION < 0x060000
23 template< typename T > class QVector;
24 #endif
25
57 class QWT_EXPORT QwtSpline
58 {
59 public:
65 enum BoundaryType
66 {
72 ConditionalBoundaries,
73
79 PeriodicPolygon,
80
92 ClosedPolygon
93 };
94
99 enum BoundaryPosition
100 {
102 AtBeginning,
103
105 AtEnd
106 };
107
119 enum BoundaryCondition
120 {
125 Clamped1,
126
134 Clamped2,
135
143 Clamped3,
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
193 class QWT_EXPORT QwtSplineInterpolating : public QwtSpline
194 {
195 public:
196 QwtSplineInterpolating();
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
216 class QWT_EXPORT QwtSplineG1 : public QwtSplineInterpolating
217 {
218 public:
219 QwtSplineG1();
220 virtual ~QwtSplineG1();
221 };
222
235 class 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
267 class QWT_EXPORT QwtSplineC2 : public QwtSplineC1
268 {
269 public:
275 enum BoundaryConditionC2
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
QVector
Definition: qwt_clipper.h:23
QwtSplineC1
Base class for spline interpolations providing a first order parametric continuity ( C1 ) between adj...
Definition: qwt_spline.h:236
QwtSplineC1::slopes
virtual QVector< double > slopes(const QPolygonF &) const =0
Find the first derivative at the control points.
QwtSplineC2
Base class for spline interpolations providing a second order parametric continuity ( C2 ) between ad...
Definition: qwt_spline.h:268
QwtSplineC2::curvatures
virtual QVector< double > curvatures(const QPolygonF &) const =0
Find the second derivative at the control points.
QwtSplineC2::BoundaryConditionC2
BoundaryConditionC2
Definition: qwt_spline.h:276
QwtSplineG1
Base class for spline interpolations providing a first order geometric continuity ( G1 ) between adjo...
Definition: qwt_spline.h:217
QwtSpline
Base class for all splines.
Definition: qwt_spline.h:58
QwtSpline::BoundaryPosition
BoundaryPosition
Definition: qwt_spline.h:100
QwtSpline::AtBeginning
@ AtBeginning
the condition is at the beginning of the polynomial
Definition: qwt_spline.h:102
QwtSpline::painterPath
virtual QPainterPath painterPath(const QPolygonF &) const =0
QwtSpline::BoundaryType
BoundaryType
Definition: qwt_spline.h:66
QwtSpline::PeriodicPolygon
@ PeriodicPolygon
Definition: qwt_spline.h:79
QwtSpline::ConditionalBoundaries
@ ConditionalBoundaries
Definition: qwt_spline.h:72
QwtSpline::BoundaryCondition
BoundaryCondition
Boundary condition.
Definition: qwt_spline.h:120
QwtSpline::Clamped2
@ Clamped2
Definition: qwt_spline.h:134
QwtSpline::Clamped3
@ Clamped3
Definition: qwt_spline.h:143
QwtSpline::Clamped1
@ Clamped1
Definition: qwt_spline.h:125
QwtSplineInterpolating
Base class for a spline interpolation.
Definition: qwt_spline.h:194
QwtSplineInterpolating::bezierControlLines
virtual QVector< QLineF > bezierControlLines(const QPolygonF &) const =0
Interpolate a curve with Bezier curves.
QwtSplineParametrization
Curve parametrization used for a spline interpolation.
Definition: qwt_spline_parametrization.h:45
QwtSplinePolynomial
A cubic polynomial without constant term.
Definition: qwt_spline_polynomial.h:31