使用Cubic Spline通过一组2D点绘制平滑曲线
原文 Draw a smooth curve through a set of 2D points with Cubic Spline I would like to provide you with the code to draw a smooth curve through a set of 2D points with cubic spline. If we have some tabulated function y i =f(x i ) it's easy to get its cubic spline interpolant with some library code. For example, you could use the code from "Numerical Recipes in C, 2-nd Edition" book - proved source of a lot of math algorithms. Cubic spline gives an excellent interpolation in the most cases. Cubic spline is comprised from a sequence of cubic polynomials, so to draw the curve we have to approximate