1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3
<title>Qwt User's Guide: QwtSpline Class Reference</title>
4
<link href="doxygen.css" rel="stylesheet" type="text/css">
5
<link href="tabs.css" rel="stylesheet" type="text/css">
7
<!-- Generated by Doxygen 1.4.6 -->
10
<li><a href="index.html"><span>Main Page</span></a></li>
11
<li id="current"><a href="classes.html"><span>Classes</span></a></li>
12
<li><a href="files.html"><span>Files</span></a></li>
13
<li><a href="pages.html"><span>Related Pages</span></a></li>
17
<li><a href="classes.html"><span>Alphabetical List</span></a></li>
18
<li><a href="annotated.html"><span>Class List</span></a></li>
19
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
20
<li><a href="functions.html"><span>Class Members</span></a></li>
22
<h1>QwtSpline Class Reference</h1><!-- doxytag: class="QwtSpline" --><a href="class_qwt_spline-members.html">List of all members.</a><hr><a name="_details"></a><h2>Detailed Description</h2>
23
A class for spline interpolation.
25
The <a class="el" href="class_qwt_spline.html">QwtSpline</a> class is used for cubical spline interpolation. Two types of splines, natural and periodic, are supported.<p>
26
<dl compact><dt><b>Usage:</b></dt><dd><ol>
28
First call <a class="el" href="class_qwt_spline.html#6ed13410b1d5f6b33ba0e3c2b07932cf">setPoints()</a> to determine the spline coefficients for a tabulated function y(x). </li>
30
After the coefficients have been set up, the interpolated function value for an argument x can be determined by calling <a class="el" href="class_qwt_spline.html#1f67187eefe2959f0c902532edf64d41">QwtSpline::value()</a>. </li>
33
<dl compact><dt><b>Example:</b></dt><dd><div class="fragment"><pre class="fragment"><span class="preprocessor">#include <qwt_spline.h></span>
35
QPolygonF interpolate(<span class="keyword">const</span> QPolygonF& <a class="code" href="class_qwt_spline.html#14694e61052933921eda629062554d22">points</a>, <span class="keywordtype">int</span> numValues)
37
<a class="code" href="class_qwt_spline.html">QwtSpline</a> spline;
38
<span class="keywordflow">if</span> ( !spline.<a class="code" href="class_qwt_spline.html#6ed13410b1d5f6b33ba0e3c2b07932cf">setPoints</a>(points) )
39
<span class="keywordflow">return</span> points;
41
QPolygonF interpolatedPoints(numValues);
43
<span class="keyword">const</span> <span class="keywordtype">double</span> delta =
44
(points[numPoints - 1].x() - points[0].x()) / (points.size() - 1);
45
<span class="keywordflow">for</span>(i = 0; i < points.size(); i++) / interpolate
47
<span class="keyword">const</span> <span class="keywordtype">double</span> x = points[0].x() + i * delta;
48
interpolatedPoints[i].setX(x);
49
interpolatedPoints[i].setY(spline.<a class="code" href="class_qwt_spline.html#1f67187eefe2959f0c902532edf64d41">value</a>(x));
51
<span class="keywordflow">return</span> interpolatedPoints;
53
</pre></div> </dd></dl>
58
Definition at line <a class="el" href="qwt__spline_8h-source.html#l00077">77</a> of file <a class="el" href="qwt__spline_8h-source.html">qwt_spline.h</a>.<table border="0" cellpadding="0" cellspacing="0">
60
<tr><td colspan="2"><br><h2>Public Types</h2></td></tr>
61
<tr><td class="memItemLeft" nowrap align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#2bd2bda128f82acd596348eb8d64231c">SplineType</a> { <br>
62
<b>Natural</b>,
64
<b>Periodic</b>
68
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
69
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#5d1e0ba35c637a88c66d9e4cbaf36e93">QwtSpline</a> ()</td></tr>
71
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="2e42391f76d0b3091bf7754239f3ff0d"></a><!-- doxytag: member="QwtSpline::QwtSpline" ref="2e42391f76d0b3091bf7754239f3ff0d" args="(const QwtSpline &)" -->
72
</td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#2e42391f76d0b3091bf7754239f3ff0d">QwtSpline</a> (const <a class="el" href="class_qwt_spline.html">QwtSpline</a> &)</td></tr>
74
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#90805882826469c94fdc871f18261bb6">~QwtSpline</a> ()</td></tr>
76
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="8a597c34477dd4b5298db2d445b4e596"></a><!-- doxytag: member="QwtSpline::operator=" ref="8a597c34477dd4b5298db2d445b4e596" args="(const QwtSpline &)" -->
77
<a class="el" href="class_qwt_spline.html">QwtSpline</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#8a597c34477dd4b5298db2d445b4e596">operator=</a> (const <a class="el" href="class_qwt_spline.html">QwtSpline</a> &)</td></tr>
79
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="222953661f01658a16042d587196aff8"></a><!-- doxytag: member="QwtSpline::setSplineType" ref="222953661f01658a16042d587196aff8" args="(SplineType)" -->
80
void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#222953661f01658a16042d587196aff8">setSplineType</a> (<a class="el" href="class_qwt_spline.html#2bd2bda128f82acd596348eb8d64231c">SplineType</a>)</td></tr>
82
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="36442cbb781422e5b97ae242265dd4b4"></a><!-- doxytag: member="QwtSpline::splineType" ref="36442cbb781422e5b97ae242265dd4b4" args="() const " -->
83
<a class="el" href="class_qwt_spline.html#2bd2bda128f82acd596348eb8d64231c">SplineType</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#36442cbb781422e5b97ae242265dd4b4">splineType</a> () const </td></tr>
85
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#6ed13410b1d5f6b33ba0e3c2b07932cf">setPoints</a> (const QPolygonF &points)</td></tr>
87
<tr><td class="memItemLeft" nowrap align="right" valign="top">QPolygonF </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#14694e61052933921eda629062554d22">points</a> () const </td></tr>
89
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#fc52fd49e7f00d57a0336059fae299c0">reset</a> ()</td></tr>
91
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#8eb42cf7f0f81bb7b7b885466f8ebbbf">isValid</a> () const </td></tr>
93
<tr><td class="memItemLeft" nowrap align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#1f67187eefe2959f0c902532edf64d41">value</a> (double x) const </td></tr>
95
<tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr>
96
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#1cdf09e841dd6a721eb788914273c484">buildNaturalSpline</a> (const QPolygonF &)</td></tr>
98
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#8184717f8c018e69fabd1e33ac68ef19">buildPeriodicSpline</a> (const QPolygonF &)</td></tr>
100
<tr><td colspan="2"><br><h2>Protected Attributes</h2></td></tr>
101
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="784545391f14c014684f391c6d92fd27"></a><!-- doxytag: member="QwtSpline::d_data" ref="784545391f14c014684f391c6d92fd27" args="" -->
102
PrivateData * </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#784545391f14c014684f391c6d92fd27">d_data</a></td></tr>
105
<hr><h2>Constructor & Destructor Documentation</h2>
106
<a class="anchor" name="5d1e0ba35c637a88c66d9e4cbaf36e93"></a><!-- doxytag: member="QwtSpline::QwtSpline" ref="5d1e0ba35c637a88c66d9e4cbaf36e93" args="()" --><p>
107
<table class="mdTable" cellpadding="2" cellspacing="0">
110
<table cellpadding="0" cellspacing="0" border="0">
112
<td class="md" nowrap valign="top">QwtSpline::QwtSpline </td>
113
<td class="md" valign="top">( </td>
114
<td class="mdname1" valign="top" nowrap> </td>
115
<td class="md" valign="top"> ) </td>
116
<td class="md" nowrap></td>
122
<table cellspacing="5" cellpadding="0" border="0">
134
Definition at line <a class="el" href="qwt__spline_8cpp-source.html#l00073">73</a> of file <a class="el" href="qwt__spline_8cpp-source.html">qwt_spline.cpp</a>.
136
References <a class="el" href="qwt__spline_8h-source.html#l00121">d_data</a>. </td>
139
<a class="anchor" name="90805882826469c94fdc871f18261bb6"></a><!-- doxytag: member="QwtSpline::~QwtSpline" ref="90805882826469c94fdc871f18261bb6" args="()" --><p>
140
<table class="mdTable" cellpadding="2" cellspacing="0">
143
<table cellpadding="0" cellspacing="0" border="0">
145
<td class="md" nowrap valign="top">QwtSpline::~QwtSpline </td>
146
<td class="md" valign="top">( </td>
147
<td class="mdname1" valign="top" nowrap> </td>
148
<td class="md" valign="top"> ) </td>
149
<td class="md" nowrap></td>
155
<table cellspacing="5" cellpadding="0" border="0">
167
Definition at line <a class="el" href="qwt__spline_8cpp-source.html#l00090">90</a> of file <a class="el" href="qwt__spline_8cpp-source.html">qwt_spline.cpp</a>.
169
References <a class="el" href="qwt__spline_8h-source.html#l00121">d_data</a>. </td>
172
<hr><h2>Member Function Documentation</h2>
173
<a class="anchor" name="1cdf09e841dd6a721eb788914273c484"></a><!-- doxytag: member="QwtSpline::buildNaturalSpline" ref="1cdf09e841dd6a721eb788914273c484" args="(const QPolygonF &)" --><p>
174
<table class="mdTable" cellpadding="2" cellspacing="0">
177
<table cellpadding="0" cellspacing="0" border="0">
179
<td class="md" nowrap valign="top">bool QwtSpline::buildNaturalSpline </td>
180
<td class="md" valign="top">( </td>
181
<td class="md" nowrap valign="top">const QPolygonF & </td>
182
<td class="mdname1" valign="top" nowrap> <em>points</em> </td>
183
<td class="md" valign="top"> ) </td>
184
<td class="md" nowrap><code> [protected]</code></td>
190
<table cellspacing="5" cellpadding="0" border="0">
198
Determines the coefficients for a natural spline.
200
<dl compact><dt><b>Returns:</b></dt><dd>true if successful </dd></dl>
203
Definition at line <a class="el" href="qwt__spline_8cpp-source.html#l00209">209</a> of file <a class="el" href="qwt__spline_8cpp-source.html">qwt_spline.cpp</a>. </td>
206
<a class="anchor" name="8184717f8c018e69fabd1e33ac68ef19"></a><!-- doxytag: member="QwtSpline::buildPeriodicSpline" ref="8184717f8c018e69fabd1e33ac68ef19" args="(const QPolygonF &)" --><p>
207
<table class="mdTable" cellpadding="2" cellspacing="0">
210
<table cellpadding="0" cellspacing="0" border="0">
212
<td class="md" nowrap valign="top">bool QwtSpline::buildPeriodicSpline </td>
213
<td class="md" valign="top">( </td>
214
<td class="md" nowrap valign="top">const QPolygonF & </td>
215
<td class="mdname1" valign="top" nowrap> <em>points</em> </td>
216
<td class="md" valign="top"> ) </td>
217
<td class="md" nowrap><code> [protected]</code></td>
223
<table cellspacing="5" cellpadding="0" border="0">
231
Determines the coefficients for a periodic spline.
233
<dl compact><dt><b>Returns:</b></dt><dd>true if successful </dd></dl>
236
Definition at line <a class="el" href="qwt__spline_8cpp-source.html#l00292">292</a> of file <a class="el" href="qwt__spline_8cpp-source.html">qwt_spline.cpp</a>. </td>
239
<a class="anchor" name="8eb42cf7f0f81bb7b7b885466f8ebbbf"></a><!-- doxytag: member="QwtSpline::isValid" ref="8eb42cf7f0f81bb7b7b885466f8ebbbf" args="() const " --><p>
240
<table class="mdTable" cellpadding="2" cellspacing="0">
243
<table cellpadding="0" cellspacing="0" border="0">
245
<td class="md" nowrap valign="top">bool QwtSpline::isValid </td>
246
<td class="md" valign="top">( </td>
247
<td class="mdname1" valign="top" nowrap> </td>
248
<td class="md" valign="top"> ) </td>
249
<td class="md" nowrap> const</td>
255
<table cellspacing="5" cellpadding="0" border="0">
267
Definition at line <a class="el" href="qwt__spline_8cpp-source.html#l00181">181</a> of file <a class="el" href="qwt__spline_8cpp-source.html">qwt_spline.cpp</a>.
269
References <a class="el" href="qwt__spline_8h-source.html#l00121">d_data</a>. </td>
272
<a class="anchor" name="14694e61052933921eda629062554d22"></a><!-- doxytag: member="QwtSpline::points" ref="14694e61052933921eda629062554d22" args="() const " --><p>
273
<table class="mdTable" cellpadding="2" cellspacing="0">
276
<table cellpadding="0" cellspacing="0" border="0">
278
<td class="md" nowrap valign="top">QPolygonF QwtSpline::points </td>
279
<td class="md" valign="top">( </td>
280
<td class="mdname1" valign="top" nowrap> </td>
281
<td class="md" valign="top"> ) </td>
282
<td class="md" nowrap> const</td>
288
<table cellspacing="5" cellpadding="0" border="0">
296
Return points passed by setPoints
298
Definition at line <a class="el" href="qwt__spline_8cpp-source.html#l00164">164</a> of file <a class="el" href="qwt__spline_8cpp-source.html">qwt_spline.cpp</a>. </td>
301
<a class="anchor" name="fc52fd49e7f00d57a0336059fae299c0"></a><!-- doxytag: member="QwtSpline::reset" ref="fc52fd49e7f00d57a0336059fae299c0" args="()" --><p>
302
<table class="mdTable" cellpadding="2" cellspacing="0">
305
<table cellpadding="0" cellspacing="0" border="0">
307
<td class="md" nowrap valign="top">void QwtSpline::reset </td>
308
<td class="md" valign="top">( </td>
309
<td class="mdname1" valign="top" nowrap> </td>
310
<td class="md" valign="top"> ) </td>
311
<td class="md" nowrap></td>
317
<table cellspacing="5" cellpadding="0" border="0">
325
Free allocated memory and set size to 0.
329
Definition at line <a class="el" href="qwt__spline_8cpp-source.html#l00172">172</a> of file <a class="el" href="qwt__spline_8cpp-source.html">qwt_spline.cpp</a>.
331
References <a class="el" href="qwt__spline_8h-source.html#l00121">d_data</a>. </td>
334
<a class="anchor" name="6ed13410b1d5f6b33ba0e3c2b07932cf"></a><!-- doxytag: member="QwtSpline::setPoints" ref="6ed13410b1d5f6b33ba0e3c2b07932cf" args="(const QPolygonF &points)" --><p>
335
<table class="mdTable" cellpadding="2" cellspacing="0">
338
<table cellpadding="0" cellspacing="0" border="0">
340
<td class="md" nowrap valign="top">bool QwtSpline::setPoints </td>
341
<td class="md" valign="top">( </td>
342
<td class="md" nowrap valign="top">const QPolygonF & </td>
343
<td class="mdname1" valign="top" nowrap> <em>points</em> </td>
344
<td class="md" valign="top"> ) </td>
345
<td class="md" nowrap></td>
351
<table cellspacing="5" cellpadding="0" border="0">
359
Determine the function table index corresponding to a value x Calculate the spline coefficients.
361
Depending on the value of <em>periodic</em>, this function will determine the coefficients for a natural or a periodic spline and store them internally.<p>
362
<dl compact><dt><b>Parameters:</b></dt><dd>
363
<table border="0" cellspacing="2" cellpadding="0">
364
<tr><td valign="top"></td><td valign="top"><em>x</em> </td><td></td></tr>
365
<tr><td valign="top"></td><td valign="top"><em>y</em> </td><td>points </td></tr>
366
<tr><td valign="top"></td><td valign="top"><em>size</em> </td><td>number of points </td></tr>
367
<tr><td valign="top"></td><td valign="top"><em>periodic</em> </td><td>if true, calculate periodic spline </td></tr>
370
<dl compact><dt><b>Returns:</b></dt><dd>true if successful </dd></dl>
371
<dl compact><dt><b>Warning:</b></dt><dd>The sequence of x (but not y) values has to be strictly monotone increasing, which means <code>x[0] < x[1] < .... < x[n-1]</code>. If this is not the case, the function will return false </dd></dl>
374
Definition at line <a class="el" href="qwt__spline_8cpp-source.html#l00126">126</a> of file <a class="el" href="qwt__spline_8cpp-source.html">qwt_spline.cpp</a>. </td>
377
<a class="anchor" name="1f67187eefe2959f0c902532edf64d41"></a><!-- doxytag: member="QwtSpline::value" ref="1f67187eefe2959f0c902532edf64d41" args="(double x) const " --><p>
378
<table class="mdTable" cellpadding="2" cellspacing="0">
381
<table cellpadding="0" cellspacing="0" border="0">
383
<td class="md" nowrap valign="top">double QwtSpline::value </td>
384
<td class="md" valign="top">( </td>
385
<td class="md" nowrap valign="top">double </td>
386
<td class="mdname1" valign="top" nowrap> <em>x</em> </td>
387
<td class="md" valign="top"> ) </td>
388
<td class="md" nowrap> const</td>
394
<table cellspacing="5" cellpadding="0" border="0">
402
Calculate the interpolated function value corresponding to a given argument x.
404
Definition at line <a class="el" href="qwt__spline_8cpp-source.html#l00190">190</a> of file <a class="el" href="qwt__spline_8cpp-source.html">qwt_spline.cpp</a>.
406
References <a class="el" href="qwt__spline_8h-source.html#l00121">d_data</a>. </td>
409
<hr size="1"><address style="align: right;"><small>Generated on Mon Jun 11 07:42:59 2007 for Qwt User's Guide by
410
<a href="http://www.doxygen.org/index.html">
411
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.6 </small></address>