I need an interpolation function for interpolating a point:
var times = new List<double>();
var offsets = new List<double>();
..
..
..//I fill times and offsets arrays with some points
..
var newTime= splineInterpolate(cursorOffset, offsets.ToArray(), times.ToArray())
It depends on what kind of interpolation you want. If you don't want the interpolation function to pass through the control points, you can use a Bezier curve (you can choose the order of the curve).
If you want the curve to pass through the control points, a popular choice is a cubic Hermite spline . There are many types of hermite splines like cardinal and catmull-rom splines (which are C1 and C2 continuous).
If you just do a simple Google search, you will come across thousands of results for splines with their implementation in C# provided.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.