QwtSpline.3 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. .TH "QwtSpline" 3 "Mon Dec 28 2020" "Version 6.1.6" "Qwt User's Guide" \" -*- nroff -*-
  2. .ad l
  3. .nh
  4. .SH NAME
  5. QwtSpline \- A class for spline interpolation\&.
  6. .SH SYNOPSIS
  7. .br
  8. .PP
  9. .PP
  10. \fC#include <qwt_spline\&.h>\fP
  11. .SS "Public Types"
  12. .in +1c
  13. .ti -1c
  14. .RI "enum \fBSplineType\fP { \fBNatural\fP, \fBPeriodic\fP }"
  15. .br
  16. .RI "Spline type\&. "
  17. .in -1c
  18. .SS "Public Member Functions"
  19. .in +1c
  20. .ti -1c
  21. .RI "\fBQwtSpline\fP ()"
  22. .br
  23. .RI "Constructor\&. "
  24. .ti -1c
  25. .RI "\fBQwtSpline\fP (const \fBQwtSpline\fP &)"
  26. .br
  27. .ti -1c
  28. .RI "\fB~QwtSpline\fP ()"
  29. .br
  30. .RI "Destructor\&. "
  31. .ti -1c
  32. .RI "\fBQwtSpline\fP & \fBoperator=\fP (const \fBQwtSpline\fP &)"
  33. .br
  34. .ti -1c
  35. .RI "void \fBsetSplineType\fP (\fBSplineType\fP)"
  36. .br
  37. .ti -1c
  38. .RI "\fBSplineType\fP \fBsplineType\fP () const"
  39. .br
  40. .ti -1c
  41. .RI "bool \fBsetPoints\fP (const QPolygonF &\fBpoints\fP)"
  42. .br
  43. .RI "Calculate the spline coefficients\&. "
  44. .ti -1c
  45. .RI "QPolygonF \fBpoints\fP () const"
  46. .br
  47. .ti -1c
  48. .RI "void \fBreset\fP ()"
  49. .br
  50. .RI "Free allocated memory and set size to 0\&. "
  51. .ti -1c
  52. .RI "bool \fBisValid\fP () const"
  53. .br
  54. .RI "True if valid\&. "
  55. .ti -1c
  56. .RI "double \fBvalue\fP (double x) const"
  57. .br
  58. .ti -1c
  59. .RI "const QVector< double > & \fBcoefficientsA\fP () const"
  60. .br
  61. .ti -1c
  62. .RI "const QVector< double > & \fBcoefficientsB\fP () const"
  63. .br
  64. .ti -1c
  65. .RI "const QVector< double > & \fBcoefficientsC\fP () const"
  66. .br
  67. .in -1c
  68. .SS "Protected Member Functions"
  69. .in +1c
  70. .ti -1c
  71. .RI "bool \fBbuildNaturalSpline\fP (const QPolygonF &)"
  72. .br
  73. .RI "Determines the coefficients for a natural spline\&. "
  74. .ti -1c
  75. .RI "bool \fBbuildPeriodicSpline\fP (const QPolygonF &)"
  76. .br
  77. .RI "Determines the coefficients for a periodic spline\&. "
  78. .in -1c
  79. .SH "Detailed Description"
  80. .PP
  81. A class for spline interpolation\&.
  82. The \fBQwtSpline\fP class is used for cubical spline interpolation\&. Two types of splines, natural and periodic, are supported\&.
  83. .PP
  84. \fBUsage:\fP
  85. .RS 4
  86. .PD 0
  87. .IP "1." 4
  88. First call \fBsetPoints()\fP to determine the spline coefficients for a tabulated function y(x)\&.
  89. .IP "2." 4
  90. After the coefficients have been set up, the interpolated function value for an argument x can be determined by calling \fBQwtSpline::value()\fP\&.
  91. .PP
  92. .RE
  93. .PP
  94. \fBExample:\fP
  95. .RS 4
  96. .PP
  97. .nf
  98. #include <qwt_spline\&.h>
  99. QPolygonF interpolate(const QPolygonF& points, int numValues)
  100. {
  101. QwtSpline spline;
  102. if ( !spline\&.setPoints(points) )
  103. return points;
  104. QPolygonF interpolatedPoints(numValues);
  105. const double delta =
  106. (points[numPoints - 1]\&.x() - points[0]\&.x()) / (points\&.size() - 1);
  107. for(i = 0; i < points\&.size(); i++) / interpolate
  108. {
  109. const double x = points[0]\&.x() + i * delta;
  110. interpolatedPoints[i]\&.setX(x);
  111. interpolatedPoints[i]\&.setY(spline\&.value(x));
  112. }
  113. return interpolatedPoints;
  114. }
  115. .fi
  116. .PP
  117. .RE
  118. .PP
  119. .SH "Member Enumeration Documentation"
  120. .PP
  121. .SS "enum \fBQwtSpline::SplineType\fP"
  122. .PP
  123. Spline type\&.
  124. .PP
  125. \fBEnumerator\fP
  126. .in +1c
  127. .TP
  128. \fB\fINatural \fP\fP
  129. A natural spline\&.
  130. .TP
  131. \fB\fIPeriodic \fP\fP
  132. A periodic spline\&.
  133. .SH "Constructor & Destructor Documentation"
  134. .PP
  135. .SS "QwtSpline::QwtSpline (const \fBQwtSpline\fP & other)"
  136. Copy constructor
  137. .PP
  138. \fBParameters\fP
  139. .RS 4
  140. \fIother\fP Spline used for initialization
  141. .RE
  142. .PP
  143. .SH "Member Function Documentation"
  144. .PP
  145. .SS "bool QwtSpline::buildNaturalSpline (const QPolygonF & points)\fC [protected]\fP"
  146. .PP
  147. Determines the coefficients for a natural spline\&.
  148. .PP
  149. \fBReturns\fP
  150. .RS 4
  151. true if successful
  152. .RE
  153. .PP
  154. .SS "bool QwtSpline::buildPeriodicSpline (const QPolygonF & points)\fC [protected]\fP"
  155. .PP
  156. Determines the coefficients for a periodic spline\&.
  157. .PP
  158. \fBReturns\fP
  159. .RS 4
  160. true if successful
  161. .RE
  162. .PP
  163. .SS "const QVector< double > & QwtSpline::coefficientsA () const"
  164. .PP
  165. \fBReturns\fP
  166. .RS 4
  167. A coefficients
  168. .RE
  169. .PP
  170. .SS "const QVector< double > & QwtSpline::coefficientsB () const"
  171. .PP
  172. \fBReturns\fP
  173. .RS 4
  174. B coefficients
  175. .RE
  176. .PP
  177. .SS "const QVector< double > & QwtSpline::coefficientsC () const"
  178. .PP
  179. \fBReturns\fP
  180. .RS 4
  181. C coefficients
  182. .RE
  183. .PP
  184. .SS "\fBQwtSpline\fP & QwtSpline::operator= (const \fBQwtSpline\fP & other)"
  185. Assignment operator
  186. .PP
  187. \fBParameters\fP
  188. .RS 4
  189. \fIother\fP Spline used for initialization
  190. .RE
  191. .PP
  192. \fBReturns\fP
  193. .RS 4
  194. *this
  195. .RE
  196. .PP
  197. .SS "QPolygonF QwtSpline::points () const"
  198. .PP
  199. \fBReturns\fP
  200. .RS 4
  201. Points, that have been by \fBsetPoints()\fP
  202. .RE
  203. .PP
  204. .SS "bool QwtSpline::setPoints (const QPolygonF & points)"
  205. .PP
  206. 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\&.
  207. .PP
  208. \fBParameters\fP
  209. .RS 4
  210. \fIpoints\fP Points
  211. .RE
  212. .PP
  213. \fBReturns\fP
  214. .RS 4
  215. true if successful
  216. .RE
  217. .PP
  218. \fBWarning\fP
  219. .RS 4
  220. 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
  221. .RE
  222. .PP
  223. .SS "void QwtSpline::setSplineType (\fBSplineType\fP splineType)"
  224. Select the algorithm used for calculating the spline
  225. .PP
  226. \fBParameters\fP
  227. .RS 4
  228. \fIsplineType\fP Spline type
  229. .RE
  230. .PP
  231. \fBSee also\fP
  232. .RS 4
  233. \fBsplineType()\fP
  234. .RE
  235. .PP
  236. .SS "\fBQwtSpline::SplineType\fP QwtSpline::splineType () const"
  237. .PP
  238. \fBReturns\fP
  239. .RS 4
  240. the spline type
  241. .RE
  242. .PP
  243. \fBSee also\fP
  244. .RS 4
  245. \fBsetSplineType()\fP
  246. .RE
  247. .PP
  248. .SS "double QwtSpline::value (double x) const"
  249. Calculate the interpolated function value corresponding to a given argument x\&.
  250. .PP
  251. \fBParameters\fP
  252. .RS 4
  253. \fIx\fP Coordinate
  254. .RE
  255. .PP
  256. \fBReturns\fP
  257. .RS 4
  258. Interpolated coordinate
  259. .RE
  260. .PP
  261. .SH "Author"
  262. .PP
  263. Generated automatically by Doxygen for Qwt User's Guide from the source code\&.