<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>Qwt User's Guide: QwtSpline Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.3 --> <div id="top"> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">Qwt User's Guide <span id="projectnumber">6.0.1</span></div> </td> </tr> </tbody> </table> </div> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="classes.html"><span>Class Index</span></a></li> <li><a href="inherits.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#pub-types">Public Types</a> | <a href="#pub-methods">Public Member Functions</a> | <a href="#pro-methods">Protected Member Functions</a> </div> <div class="headertitle"> <h1>QwtSpline Class Reference</h1> </div> </div> <div class="contents"> <!-- doxytag: class="QwtSpline" --> <p>A class for spline interpolation. <a href="#_details">More...</a></p> <p><code>#include <<a class="el" href="qwt__spline_8h_source.html">qwt_spline.h</a>></code></p> <p><a href="class_qwt_spline-members.html">List of all members.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="pub-types"></a> Public Types</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#a2bd2bda128f82acd596348eb8d64231c">SplineType</a> { <br/>   <a class="el" href="class_qwt_spline.html#a2bd2bda128f82acd596348eb8d64231ca506b78ec81ab6d56a4bbce891490c857">Natural</a>, <br/>   <a class="el" href="class_qwt_spline.html#a2bd2bda128f82acd596348eb8d64231ca500c12cdbdef35c62e9fab86c5727acb">Periodic</a> <br/> }</td></tr> <tr><td colspan="2"><h2><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">const QVector< double > & </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#abbc5c1cf6016fc57050f379250da031e">coefficientsA</a> () const </td></tr> <tr><td class="memItemLeft" align="right" valign="top">const QVector< double > & </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#a1de897d6cc2d0d8dac840d15d0bb603e">coefficientsB</a> () const </td></tr> <tr><td class="memItemLeft" align="right" valign="top">const QVector< double > & </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#a27d51429a7447b18a8f05a44b3418f89">coefficientsC</a> () const </td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#a8eb42cf7f0f81bb7b7b885466f8ebbbf">isValid</a> () const </td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_qwt_spline.html">QwtSpline</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#a8a597c34477dd4b5298db2d445b4e596">operator=</a> (const <a class="el" href="class_qwt_spline.html">QwtSpline</a> &)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">QPolygonF </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#a14694e61052933921eda629062554d22">points</a> () const </td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#a5d1e0ba35c637a88c66d9e4cbaf36e93">QwtSpline</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#a2e42391f76d0b3091bf7754239f3ff0d">QwtSpline</a> (const <a class="el" href="class_qwt_spline.html">QwtSpline</a> &)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#afc52fd49e7f00d57a0336059fae299c0">reset</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#a6ed13410b1d5f6b33ba0e3c2b07932cf">setPoints</a> (const QPolygonF &points)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#a222953661f01658a16042d587196aff8">setSplineType</a> (<a class="el" href="class_qwt_spline.html#a2bd2bda128f82acd596348eb8d64231c">SplineType</a>)</td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_qwt_spline.html#a2bd2bda128f82acd596348eb8d64231c">SplineType</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#a36442cbb781422e5b97ae242265dd4b4">splineType</a> () const </td></tr> <tr><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#a1f67187eefe2959f0c902532edf64d41">value</a> (double x) const </td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#a90805882826469c94fdc871f18261bb6">~QwtSpline</a> ()</td></tr> <tr><td colspan="2"><h2><a name="pro-methods"></a> Protected Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#a1cdf09e841dd6a721eb788914273c484">buildNaturalSpline</a> (const QPolygonF &)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#a8184717f8c018e69fabd1e33ac68ef19">buildPeriodicSpline</a> (const QPolygonF &)</td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <div class="textblock"><p>A class for spline interpolation. </p> <p>The <a class="el" href="class_qwt_spline.html" title="A class for spline interpolation.">QwtSpline</a> class is used for cubical spline interpolation. Two types of splines, natural and periodic, are supported.</p> <dl class="user"><dt><b>Usage:</b></dt><dd><ol> <li> First call <a class="el" href="class_qwt_spline.html#a6ed13410b1d5f6b33ba0e3c2b07932cf" title="Calculate the spline coefficients.">setPoints()</a> to determine the spline coefficients for a tabulated function y(x). </li> <li> 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#a1f67187eefe2959f0c902532edf64d41">QwtSpline::value()</a>. </li> </ol> </dd></dl> <dl class="user"><dt><b>Example:</b></dt><dd><div class="fragment"><pre class="fragment"><span class="preprocessor">#include <qwt_spline.h></span> QPolygonF interpolate(<span class="keyword">const</span> QPolygonF& <a class="code" href="class_qwt_spline.html#a14694e61052933921eda629062554d22">points</a>, <span class="keywordtype">int</span> numValues) { <a class="code" href="class_qwt_spline.html" title="A class for spline interpolation.">QwtSpline</a> spline; <span class="keywordflow">if</span> ( !spline.<a class="code" href="class_qwt_spline.html#a6ed13410b1d5f6b33ba0e3c2b07932cf" title="Calculate the spline coefficients.">setPoints</a>(points) ) <span class="keywordflow">return</span> points; QPolygonF interpolatedPoints(numValues); <span class="keyword">const</span> <span class="keywordtype">double</span> delta = (points[numPoints - 1].x() - points[0].x()) / (points.size() - 1); <span class="keywordflow">for</span>(i = 0; i < points.size(); i++) / interpolate { <span class="keyword">const</span> <span class="keywordtype">double</span> x = points[0].x() + i * delta; interpolatedPoints[i].setX(x); interpolatedPoints[i].setY(spline.<a class="code" href="class_qwt_spline.html#a1f67187eefe2959f0c902532edf64d41">value</a>(x)); } <span class="keywordflow">return</span> interpolatedPoints; } </pre></div> </dd></dl> </div><hr/><h2>Member Enumeration Documentation</h2> <a class="anchor" id="a2bd2bda128f82acd596348eb8d64231c"></a><!-- doxytag: member="QwtSpline::SplineType" ref="a2bd2bda128f82acd596348eb8d64231c" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">enum <a class="el" href="class_qwt_spline.html#a2bd2bda128f82acd596348eb8d64231c">QwtSpline::SplineType</a></td> </tr> </table> </div> <div class="memdoc"> <p>Spline type. </p> <dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"><em><a class="anchor" id="a2bd2bda128f82acd596348eb8d64231ca506b78ec81ab6d56a4bbce891490c857"></a><!-- doxytag: member="Natural" ref="a2bd2bda128f82acd596348eb8d64231ca506b78ec81ab6d56a4bbce891490c857" args="" -->Natural</em> </td><td> <p>A natural spline. </p> </td></tr> <tr><td valign="top"><em><a class="anchor" id="a2bd2bda128f82acd596348eb8d64231ca500c12cdbdef35c62e9fab86c5727acb"></a><!-- doxytag: member="Periodic" ref="a2bd2bda128f82acd596348eb8d64231ca500c12cdbdef35c62e9fab86c5727acb" args="" -->Periodic</em> </td><td> <p>A periodic spline. </p> </td></tr> </table> </dd> </dl> </div> </div> <hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="a5d1e0ba35c637a88c66d9e4cbaf36e93"></a><!-- doxytag: member="QwtSpline::QwtSpline" ref="a5d1e0ba35c637a88c66d9e4cbaf36e93" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">QwtSpline::QwtSpline </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Constructor. </p> </div> </div> <a class="anchor" id="a2e42391f76d0b3091bf7754239f3ff0d"></a><!-- doxytag: member="QwtSpline::QwtSpline" ref="a2e42391f76d0b3091bf7754239f3ff0d" args="(const QwtSpline &)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">QwtSpline::QwtSpline </td> <td>(</td> <td class="paramtype">const <a class="el" href="class_qwt_spline.html">QwtSpline</a> & </td> <td class="paramname"><em>other</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Copy constructor </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">other</td><td>Spline used for initilization </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a90805882826469c94fdc871f18261bb6"></a><!-- doxytag: member="QwtSpline::~QwtSpline" ref="a90805882826469c94fdc871f18261bb6" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">QwtSpline::~QwtSpline </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Destructor. </p> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="a1cdf09e841dd6a721eb788914273c484"></a><!-- doxytag: member="QwtSpline::buildNaturalSpline" ref="a1cdf09e841dd6a721eb788914273c484" args="(const QPolygonF &)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool QwtSpline::buildNaturalSpline </td> <td>(</td> <td class="paramtype">const QPolygonF & </td> <td class="paramname"><em>points</em></td><td>)</td> <td><code> [protected]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Determines the coefficients for a natural spline. </p> <dl class="return"><dt><b>Returns:</b></dt><dd>true if successful </dd></dl> </div> </div> <a class="anchor" id="a8184717f8c018e69fabd1e33ac68ef19"></a><!-- doxytag: member="QwtSpline::buildPeriodicSpline" ref="a8184717f8c018e69fabd1e33ac68ef19" args="(const QPolygonF &)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool QwtSpline::buildPeriodicSpline </td> <td>(</td> <td class="paramtype">const QPolygonF & </td> <td class="paramname"><em>points</em></td><td>)</td> <td><code> [protected]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Determines the coefficients for a periodic spline. </p> <dl class="return"><dt><b>Returns:</b></dt><dd>true if successful </dd></dl> </div> </div> <a class="anchor" id="abbc5c1cf6016fc57050f379250da031e"></a><!-- doxytag: member="QwtSpline::coefficientsA" ref="abbc5c1cf6016fc57050f379250da031e" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const QVector< double > & QwtSpline::coefficientsA </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const</td> </tr> </table> </div> <div class="memdoc"> <dl class="return"><dt><b>Returns:</b></dt><dd>A coefficients </dd></dl> </div> </div> <a class="anchor" id="a1de897d6cc2d0d8dac840d15d0bb603e"></a><!-- doxytag: member="QwtSpline::coefficientsB" ref="a1de897d6cc2d0d8dac840d15d0bb603e" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const QVector< double > & QwtSpline::coefficientsB </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const</td> </tr> </table> </div> <div class="memdoc"> <dl class="return"><dt><b>Returns:</b></dt><dd>B coefficients </dd></dl> </div> </div> <a class="anchor" id="a27d51429a7447b18a8f05a44b3418f89"></a><!-- doxytag: member="QwtSpline::coefficientsC" ref="a27d51429a7447b18a8f05a44b3418f89" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const QVector< double > & QwtSpline::coefficientsC </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const</td> </tr> </table> </div> <div class="memdoc"> <dl class="return"><dt><b>Returns:</b></dt><dd>C coefficients </dd></dl> </div> </div> <a class="anchor" id="a8eb42cf7f0f81bb7b7b885466f8ebbbf"></a><!-- doxytag: member="QwtSpline::isValid" ref="a8eb42cf7f0f81bb7b7b885466f8ebbbf" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool QwtSpline::isValid </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const</td> </tr> </table> </div> <div class="memdoc"> <p>True if valid. </p> </div> </div> <a class="anchor" id="a8a597c34477dd4b5298db2d445b4e596"></a><!-- doxytag: member="QwtSpline::operator=" ref="a8a597c34477dd4b5298db2d445b4e596" args="(const QwtSpline &)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="class_qwt_spline.html">QwtSpline</a> & QwtSpline::operator= </td> <td>(</td> <td class="paramtype">const <a class="el" href="class_qwt_spline.html">QwtSpline</a> & </td> <td class="paramname"><em>other</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Assignment operator </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">other</td><td>Spline used for initilization </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a14694e61052933921eda629062554d22"></a><!-- doxytag: member="QwtSpline::points" ref="a14694e61052933921eda629062554d22" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">QPolygonF QwtSpline::points </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const</td> </tr> </table> </div> <div class="memdoc"> <p>Return points passed by setPoints </p> </div> </div> <a class="anchor" id="afc52fd49e7f00d57a0336059fae299c0"></a><!-- doxytag: member="QwtSpline::reset" ref="afc52fd49e7f00d57a0336059fae299c0" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void QwtSpline::reset </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Free allocated memory and set size to 0. </p> </div> </div> <a class="anchor" id="a6ed13410b1d5f6b33ba0e3c2b07932cf"></a><!-- doxytag: member="QwtSpline::setPoints" ref="a6ed13410b1d5f6b33ba0e3c2b07932cf" args="(const QPolygonF &points)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool QwtSpline::setPoints </td> <td>(</td> <td class="paramtype">const QPolygonF & </td> <td class="paramname"><em>points</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Calculate the spline coefficients. </p> <p>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> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">points</td><td>Points </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>true if successful </dd></dl> <dl class="warning"><dt><b>Warning:</b></dt><dd>The sequence of x (but not y) values has to be strictly monotone increasing, which means <code>points[i].x() < points[i+1].x()</code>. If this is not the case, the function will return false </dd></dl> </div> </div> <a class="anchor" id="a222953661f01658a16042d587196aff8"></a><!-- doxytag: member="QwtSpline::setSplineType" ref="a222953661f01658a16042d587196aff8" args="(SplineType)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void QwtSpline::setSplineType </td> <td>(</td> <td class="paramtype"><a class="el" href="class_qwt_spline.html#a2bd2bda128f82acd596348eb8d64231c">SplineType</a> </td> <td class="paramname"><em>splineType</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Select the algorithm used for calculating the spline</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">splineType</td><td>Spline type </td></tr> </table> </dd> </dl> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_qwt_spline.html#a36442cbb781422e5b97ae242265dd4b4">splineType()</a> </dd></dl> </div> </div> <a class="anchor" id="a36442cbb781422e5b97ae242265dd4b4"></a><!-- doxytag: member="QwtSpline::splineType" ref="a36442cbb781422e5b97ae242265dd4b4" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="class_qwt_spline.html#a2bd2bda128f82acd596348eb8d64231c">QwtSpline::SplineType</a> QwtSpline::splineType </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const</td> </tr> </table> </div> <div class="memdoc"> <dl class="return"><dt><b>Returns:</b></dt><dd>the spline type </dd></dl> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_qwt_spline.html#a222953661f01658a16042d587196aff8">setSplineType()</a> </dd></dl> </div> </div> <a class="anchor" id="a1f67187eefe2959f0c902532edf64d41"></a><!-- doxytag: member="QwtSpline::value" ref="a1f67187eefe2959f0c902532edf64d41" args="(double x) const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">double QwtSpline::value </td> <td>(</td> <td class="paramtype">double </td> <td class="paramname"><em>x</em></td><td>)</td> <td> const</td> </tr> </table> </div> <div class="memdoc"> <p>Calculate the interpolated function value corresponding to a given argument x. </p> </div> </div> </div> <hr class="footer"/><address class="footer"><small>Generated by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address> </body> </html>