File: QwtSpline.3

package info (click to toggle)
qwt 6.1.2-6
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,848 kB
  • ctags: 15,811
  • sloc: cpp: 57,382; makefile: 41
file content (301 lines) | stat: -rw-r--r-- 5,762 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
.TH "QwtSpline" 3 "Thu Dec 11 2014" "Version 6.1.2" "Qwt User's Guide" \" -*- nroff -*-
.ad l
.nh
.SH NAME
QwtSpline \- 
.PP
A class for spline interpolation\&.  

.SH SYNOPSIS
.br
.PP
.PP
\fC#include <qwt_spline\&.h>\fP
.SS "Public Types"

.in +1c
.ti -1c
.RI "enum \fBSplineType\fP { \fBNatural\fP, \fBPeriodic\fP }"
.br
.RI "\fISpline type\&. \fP"
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBQwtSpline\fP ()"
.br
.RI "\fIConstructor\&. \fP"
.ti -1c
.RI "\fBQwtSpline\fP (const \fBQwtSpline\fP &)"
.br
.ti -1c
.RI "\fB~QwtSpline\fP ()"
.br
.RI "\fIDestructor\&. \fP"
.ti -1c
.RI "\fBQwtSpline\fP & \fBoperator=\fP (const \fBQwtSpline\fP &)"
.br
.ti -1c
.RI "void \fBsetSplineType\fP (\fBSplineType\fP)"
.br
.ti -1c
.RI "\fBSplineType\fP \fBsplineType\fP () const "
.br
.ti -1c
.RI "bool \fBsetPoints\fP (const QPolygonF &\fBpoints\fP)"
.br
.RI "\fICalculate the spline coefficients\&. \fP"
.ti -1c
.RI "QPolygonF \fBpoints\fP () const "
.br
.ti -1c
.RI "void \fBreset\fP ()"
.br
.RI "\fIFree allocated memory and set size to 0\&. \fP"
.ti -1c
.RI "bool \fBisValid\fP () const "
.br
.RI "\fITrue if valid\&. \fP"
.ti -1c
.RI "double \fBvalue\fP (double x) const "
.br
.ti -1c
.RI "const QVector< double > & \fBcoefficientsA\fP () const "
.br
.ti -1c
.RI "const QVector< double > & \fBcoefficientsB\fP () const "
.br
.ti -1c
.RI "const QVector< double > & \fBcoefficientsC\fP () const "
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "bool \fBbuildNaturalSpline\fP (const QPolygonF &)"
.br
.RI "\fIDetermines the coefficients for a natural spline\&. \fP"
.ti -1c
.RI "bool \fBbuildPeriodicSpline\fP (const QPolygonF &)"
.br
.RI "\fIDetermines the coefficients for a periodic spline\&. \fP"
.in -1c
.SH "Detailed Description"
.PP 
A class for spline interpolation\&. 

The \fBQwtSpline\fP class is used for cubical spline interpolation\&. Two types of splines, natural and periodic, are supported\&.
.PP
\fBUsage:\fP
.RS 4

.PD 0

.IP "1." 4
First call \fBsetPoints()\fP to determine the spline coefficients for a tabulated function y(x)\&. 
.IP "2." 4
After the coefficients have been set up, the interpolated function value for an argument x can be determined by calling \fBQwtSpline::value()\fP\&. 
.PP
.RE
.PP
\fBExample:\fP
.RS 4

.PP
.nf
#include <qwt_spline\&.h>

QPolygonF interpolate(const QPolygonF& points, int numValues)
{
    QwtSpline spline;
    if ( !spline\&.setPoints(points) )
        return points;

    QPolygonF interpolatedPoints(numValues);

    const double delta =
        (points[numPoints - 1]\&.x() - points[0]\&.x()) / (points\&.size() - 1);
    for(i = 0; i < points\&.size(); i++)  / interpolate
    {
        const double x = points[0]\&.x() + i * delta;
        interpolatedPoints[i]\&.setX(x);
        interpolatedPoints[i]\&.setY(spline\&.value(x));
    }
    return interpolatedPoints;
}

.fi
.PP
 
.RE
.PP

.SH "Member Enumeration Documentation"
.PP 
.SS "enum \fBQwtSpline::SplineType\fP"

.PP
Spline type\&. 
.PP
\fBEnumerator\fP
.in +1c
.TP
\fB\fINatural \fP\fP
A natural spline\&. 
.TP
\fB\fIPeriodic \fP\fP
A periodic spline\&. 
.SH "Constructor & Destructor Documentation"
.PP 
.SS "QwtSpline::QwtSpline (const \fBQwtSpline\fP &other)"
Copy constructor 
.PP
\fBParameters:\fP
.RS 4
\fIother\fP Spline used for initialization 
.RE
.PP

.SH "Member Function Documentation"
.PP 
.SS "bool QwtSpline::buildNaturalSpline (const QPolygonF &points)\fC [protected]\fP"

.PP
Determines the coefficients for a natural spline\&. 
.PP
\fBReturns:\fP
.RS 4
true if successful 
.RE
.PP

.SS "bool QwtSpline::buildPeriodicSpline (const QPolygonF &points)\fC [protected]\fP"

.PP
Determines the coefficients for a periodic spline\&. 
.PP
\fBReturns:\fP
.RS 4
true if successful 
.RE
.PP

.SS "const QVector< double > & QwtSpline::coefficientsA () const"

.PP
\fBReturns:\fP
.RS 4
A coefficients 
.RE
.PP

.SS "const QVector< double > & QwtSpline::coefficientsB () const"

.PP
\fBReturns:\fP
.RS 4
B coefficients 
.RE
.PP

.SS "const QVector< double > & QwtSpline::coefficientsC () const"

.PP
\fBReturns:\fP
.RS 4
C coefficients 
.RE
.PP

.SS "\fBQwtSpline\fP & QwtSpline::operator= (const \fBQwtSpline\fP &other)"
Assignment operator 
.PP
\fBParameters:\fP
.RS 4
\fIother\fP Spline used for initialization 
.RE
.PP
\fBReturns:\fP
.RS 4
*this 
.RE
.PP

.SS "QPolygonF QwtSpline::points () const"

.PP
\fBReturns:\fP
.RS 4
Points, that have been by \fBsetPoints()\fP 
.RE
.PP

.SS "bool QwtSpline::setPoints (const QPolygonF &points)"

.PP
Calculate the spline coefficients\&. Depending on the value of \fIperiodic\fP, this function will determine the coefficients for a natural or a periodic spline and store them internally\&.
.PP
\fBParameters:\fP
.RS 4
\fIpoints\fP Points 
.RE
.PP
\fBReturns:\fP
.RS 4
true if successful 
.RE
.PP
\fBWarning:\fP
.RS 4
The sequence of x (but not y) values has to be strictly monotone increasing, which means \fCpoints[i]\&.x() < points[i+1]\&.x()\fP\&. If this is not the case, the function will return false 
.RE
.PP

.SS "void QwtSpline::setSplineType (\fBSplineType\fPsplineType)"
Select the algorithm used for calculating the spline
.PP
\fBParameters:\fP
.RS 4
\fIsplineType\fP Spline type 
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBsplineType()\fP 
.RE
.PP

.SS "\fBQwtSpline::SplineType\fP QwtSpline::splineType () const"

.PP
\fBReturns:\fP
.RS 4
the spline type 
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBsetSplineType()\fP 
.RE
.PP

.SS "double QwtSpline::value (doublex) const"
Calculate the interpolated function value corresponding to a given argument x\&.
.PP
\fBParameters:\fP
.RS 4
\fIx\fP Coordinate 
.RE
.PP
\fBReturns:\fP
.RS 4
Interpolated coordinate 
.RE
.PP


.SH "Author"
.PP 
Generated automatically by Doxygen for Qwt User's Guide from the source code\&.