Cubic Spline class for Obj C or C?
I need to use natural cubic spline interpolation in an iPhone app. Does anyone know of a class for Obj C or C that resembles this: http://www.ee.ucl.ac.uk/~mflanaga/java/CubicSpline.html
"performing 开发者_如何转开发an interpolation within a one dimensional array of data points, y = f(x), using a cubic spline."
Look at this article
This is a sample for Curve Fitting. It uses Cubic Spline Interpolation, and Bezier Spline Curve.
I have implemented it in Javascript. Since there are only several functions (2 "public" functions + internal Gauss-Jordano elimination), conversion to C is pretty straightforward (replace "var" with "int"/"float" etc.).
Article: http://blog.ivank.net/interpolation-with-cubic-splines.html
Code: http://www.ivank.net/blogspot/cspline/CSPL.js
Hope it helps :)
Check out the Docs for UIBezierPath
精彩评论