<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;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.5.8 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <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 class="tabs"> <ul> <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="hierarchy.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> </div> <div class="contents"> <h1>QwtSpline Class Reference</h1><!-- doxytag: class="QwtSpline" -->A class for spline interpolation. <a href="#_details">More...</a> <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><table border="0" cellpadding="0" cellspacing="0"> <tr><td></td></tr> <tr><td colspan="2"><br><h2>Public Types</h2></td></tr> <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> <b>Natural</b>, <br> <b>Periodic</b> <br> }</td></tr> <tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr> <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> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </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> <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> <tr><td class="memItemLeft" nowrap 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#8a597c34477dd4b5298db2d445b4e596">operator=</a> (const <a class="el" href="class_qwt_spline.html">QwtSpline</a> &)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">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> <tr><td class="memItemLeft" nowrap align="right" valign="top"><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> <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> <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> <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> <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> <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> <tr><td class="memItemLeft" nowrap align="right" valign="top">const QwtArray< double > & </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#aed3d0738d5df96169a427c728771ed3">coefficientsA</a> () const </td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">const QwtArray< double > & </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#a199126e9ecf390cbabd3e39cb064177">coefficientsB</a> () const </td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">const QwtArray< double > & </td><td class="memItemRight" valign="bottom"><a class="el" href="class_qwt_spline.html#09861deaddc5fdeac736e999bcced155">coefficientsC</a> () const </td></tr> <tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr> <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> <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> <tr><td colspan="2"><br><h2>Protected Attributes</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="784545391f14c014684f391c6d92fd27"></a><!-- doxytag: member="QwtSpline::d_data" ref="784545391f14c014684f391c6d92fd27" args="" --> PrivateData * </td><td class="memItemRight" valign="bottom"><b>d_data</b></td></tr> </table> <hr><a name="_details"></a><h2>Detailed Description</h2> A class for spline interpolation. <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" compact><dt><b>Usage:</b></dt><dd><ol> <li> First call <a class="el" href="class_qwt_spline.html#6ed13410b1d5f6b33ba0e3c2b07932cf" 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#1f67187eefe2959f0c902532edf64d41">QwtSpline::value()</a>. </li> </ol> </dd></dl> <dl class="user" compact><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#14694e61052933921eda629062554d22">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#6ed13410b1d5f6b33ba0e3c2b07932cf" 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#1f67187eefe2959f0c902532edf64d41">value</a>(x)); } <span class="keywordflow">return</span> interpolatedPoints; } </pre></div> </dd></dl> <hr><h2>Member Enumeration Documentation</h2> <a class="anchor" name="2bd2bda128f82acd596348eb8d64231c"></a><!-- doxytag: member="QwtSpline::SplineType" ref="2bd2bda128f82acd596348eb8d64231c" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">enum <a class="el" href="class_qwt_spline.html#2bd2bda128f82acd596348eb8d64231c">QwtSpline::SplineType</a> </td> </tr> </table> </div> <div class="memdoc"> <p> Spline type. <p> </div> </div><p> <hr><h2>Constructor & Destructor Documentation</h2> <a class="anchor" name="5d1e0ba35c637a88c66d9e4cbaf36e93"></a><!-- doxytag: member="QwtSpline::QwtSpline" ref="5d1e0ba35c637a88c66d9e4cbaf36e93" 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><p> <a class="anchor" name="2e42391f76d0b3091bf7754239f3ff0d"></a><!-- doxytag: member="QwtSpline::QwtSpline" ref="2e42391f76d0b3091bf7754239f3ff0d" 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 <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>other</em> </td><td>Spline used for initilization </td></tr> </table> </dl> </div> </div><p> <a class="anchor" name="90805882826469c94fdc871f18261bb6"></a><!-- doxytag: member="QwtSpline::~QwtSpline" ref="90805882826469c94fdc871f18261bb6" 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><p> <hr><h2>Member Function Documentation</h2> <a class="anchor" name="1cdf09e841dd6a721eb788914273c484"></a><!-- doxytag: member="QwtSpline::buildNaturalSpline" ref="1cdf09e841dd6a721eb788914273c484" 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" compact><dt><b>Returns:</b></dt><dd>true if successful </dd></dl> </div> </div><p> <a class="anchor" name="8184717f8c018e69fabd1e33ac68ef19"></a><!-- doxytag: member="QwtSpline::buildPeriodicSpline" ref="8184717f8c018e69fabd1e33ac68ef19" 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" compact><dt><b>Returns:</b></dt><dd>true if successful </dd></dl> </div> </div><p> <a class="anchor" name="aed3d0738d5df96169a427c728771ed3"></a><!-- doxytag: member="QwtSpline::coefficientsA" ref="aed3d0738d5df96169a427c728771ed3" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const QwtArray< double > & QwtSpline::coefficientsA </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td> const</td> </tr> </table> </div> <div class="memdoc"> <p> <dl class="return" compact><dt><b>Returns:</b></dt><dd>A coefficients </dd></dl> </div> </div><p> <a class="anchor" name="a199126e9ecf390cbabd3e39cb064177"></a><!-- doxytag: member="QwtSpline::coefficientsB" ref="a199126e9ecf390cbabd3e39cb064177" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const QwtArray< double > & QwtSpline::coefficientsB </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td> const</td> </tr> </table> </div> <div class="memdoc"> <p> <dl class="return" compact><dt><b>Returns:</b></dt><dd>B coefficients </dd></dl> </div> </div><p> <a class="anchor" name="09861deaddc5fdeac736e999bcced155"></a><!-- doxytag: member="QwtSpline::coefficientsC" ref="09861deaddc5fdeac736e999bcced155" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const QwtArray< double > & QwtSpline::coefficientsC </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td> const</td> </tr> </table> </div> <div class="memdoc"> <p> <dl class="return" compact><dt><b>Returns:</b></dt><dd>C coefficients </dd></dl> </div> </div><p> <a class="anchor" name="8eb42cf7f0f81bb7b7b885466f8ebbbf"></a><!-- doxytag: member="QwtSpline::isValid" ref="8eb42cf7f0f81bb7b7b885466f8ebbbf" 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><p> <a class="anchor" name="8a597c34477dd4b5298db2d445b4e596"></a><!-- doxytag: member="QwtSpline::operator=" ref="8a597c34477dd4b5298db2d445b4e596" 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 <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>other</em> </td><td>Spline used for initilization </td></tr> </table> </dl> </div> </div><p> <a class="anchor" name="14694e61052933921eda629062554d22"></a><!-- doxytag: member="QwtSpline::points" ref="14694e61052933921eda629062554d22" 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 </div> </div><p> <a class="anchor" name="fc52fd49e7f00d57a0336059fae299c0"></a><!-- doxytag: member="QwtSpline::reset" ref="fc52fd49e7f00d57a0336059fae299c0" 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><p> <a class="anchor" name="6ed13410b1d5f6b33ba0e3c2b07932cf"></a><!-- doxytag: member="QwtSpline::setPoints" ref="6ed13410b1d5f6b33ba0e3c2b07932cf" 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> 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 compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>x</em> </td><td></td></tr> <tr><td valign="top"></td><td valign="top"><em>y</em> </td><td>points </td></tr> <tr><td valign="top"></td><td valign="top"><em>size</em> </td><td>number of points </td></tr> <tr><td valign="top"></td><td valign="top"><em>periodic</em> </td><td>if true, calculate periodic spline </td></tr> </table> </dl> <dl class="return" compact><dt><b>Returns:</b></dt><dd>true if successful </dd></dl> <dl class="warning" 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> </div> </div><p> <a class="anchor" name="222953661f01658a16042d587196aff8"></a><!-- doxytag: member="QwtSpline::setSplineType" ref="222953661f01658a16042d587196aff8" 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#2bd2bda128f82acd596348eb8d64231c">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 compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>splineType</em> </td><td>Spline type </td></tr> </table> </dl> <dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="class_qwt_spline.html#36442cbb781422e5b97ae242265dd4b4">splineType()</a> </dd></dl> </div> </div><p> <a class="anchor" name="36442cbb781422e5b97ae242265dd4b4"></a><!-- doxytag: member="QwtSpline::splineType" ref="36442cbb781422e5b97ae242265dd4b4" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="class_qwt_spline.html#2bd2bda128f82acd596348eb8d64231c">QwtSpline::SplineType</a> QwtSpline::splineType </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td> const</td> </tr> </table> </div> <div class="memdoc"> <p> <dl class="return" compact><dt><b>Returns:</b></dt><dd>the spline type </dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="class_qwt_spline.html#222953661f01658a16042d587196aff8">setSplineType()</a> </dd></dl> </div> </div><p> <a class="anchor" name="1f67187eefe2959f0c902532edf64d41"></a><!-- doxytag: member="QwtSpline::value" ref="1f67187eefe2959f0c902532edf64d41" 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. </div> </div><p> </div> <hr size="1"><address style="text-align: right;"><small>Generated on Sun Mar 22 16:41:27 2009 for Qwt User's Guide by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address> </body> </html>