1. 样条函数(spline function)
分段插值与样条插值 为了避免高次插值可能出现的大幅度波动现象,在实际应用中通常采用分段低次插值来提高近似程度,比如可用分段线性插值或分段三次埃尔米特插值来逼近已知函 数,但它们的总体光滑性较差。为了克服这一缺点,一种全局化的分段插值方法——三次样条插值成为比较理想的工具。
一类分段(片)光滑、并且在各段交接处也有一定光滑性的函数。简称样条。样条一词来源于工程绘 图人员为了将一些指定点连接成一条光顺曲线所使用的工具,即富有弹性的细木条或薄钢条。由这样的样条形成的曲线在连接点处具有连续的坡度与曲率。分段低次 多项式、在分段处具有一定光滑性的函数插值就是模拟以上原理发展起来的,它克服了高次多项式插值可能出现的振荡现象,具有较好的数值稳定性和收敛性,由这 种插值过程产生的函数就是多项式样条函数。
2. Catmull-Rom 样条插值
Catmull-Rom splines are a family of cubic interpolating splines formulated such that the tangent at each point pi is calculated using the previous and next point on the spline, (pi+1 −pi−1).
Consider the ith Catmull-Rom segment, p(s). Suppose it is defined by 4 control points, pi−2, pi−1, pi, and pi+1, as in figure 3. We know that since it is cubic, it can be expressed by the polynomial form,
p(s) = c0 + c1u + c2u^2 + c3u^3
Catmull-Rom splines have C1 continuity, local control, and interpolation, but do not lie within the convexhull of their control points. Note that the tangent at point p0 is not clearly defined; oftentimes we set this to (p1 − p0) although this is not necessary for the assignment (you can just assume the curve does not interpolate its endpoints).
The parameter is known as “tension” and it affects how sharply the curve bends at the (interpolated) control points (figure 2). It is often set to 1/2 but you can use any reasonable value for this assignment.