https://www.paulinternet.nl/?page=bicubic

Cubic interpolation

If the values of a function f(x) and its derivative are known at x=0 and x=1, then the function can be interpolated on the interval [0,1] using a third degree polynomial. This is called cubic interpolation. The formula of this polynomial can be easily derived.

A third degree polynomial and its derivative:

The values of the polynomial and its derivative at x=0 and x=1:

The four equations above can be rewritten to this:

And there we have our cubic interpolation formula.

Interpolation is often used to interpolate between a list of values. In that case we don't know the derivative of the function. We could simply use derivative 0 at every point, but we obtain smoother curves when we use the slope of a line between the previous and the next point as the derivative at a point. In that case the resulting polynomial is called a Catmull-Rom spline. Suppose you have the values p0, p1, p2and p3 at respectively x=-1, x=0, x=1, and x=2. Then we can assign the values of f(0), f(1), f'(0) and f'(1) using the formulas below to interpolate between p1 and p2.

Combining the last four formulas and the preceding four, we get:

So our cubic interpolation formula becomes:

For example:

For the green curve:

The first and the last interval

We used the two points left of the interval and the two points right of the inverval as inputs for the interpolation function. But what if we want to interpolate between the first two or last two elements of a list? Then we have no p0 or no p3. The solution is to imagine an extra point at each end of the list. In other words, we have to make up a value for p0 and p3 when interpolating the leftmost and rightmost interval respectively. Two ways to do this are:

    • Repeat the first and the last point.
      Left: p0 = p1
      Right: p3 = p2
    • Let the end point be in the middle of a line between the imaginary point and the point next to the end point.
      Left: p0 = 2p1 - p2
      Right: p3 = 2p2 - p1

最新文章

  1. Jquery遮罩插件,想罩哪就罩哪!
  2. 黑科技装点圣诞节,美国邮政局用AR APP邮寄圣诞包裹
  3. 如何在Visual Studio中开发自己的代码生成器插件
  4. sqlite之WAL模式
  5. windows下PHP5.5.6+Apache2.4.7配置
  6. Docker container network configuration
  7. 【NodeJs】Ctrl+C在Linux平台和Windows平台下的TCP连接中的不同表现
  8. qt 工具栏和菜单栏
  9. vue2.0 配置build项目打包目录、资源文件(assets\static)打包目录
  10. Spring MVC 实现文件的上传和下载 (八)
  11. MFC更换窗口图标
  12. NEXYS 3开发板练手--LED与数码管时钟
  13. node-webkit读取json文件
  14. ElasticSearch 安装root用户启动失败问题解决
  15. git 使用手册
  16. wamp安装两个,数据库丢了,怎么办
  17. Git 克隆指定分支代码
  18. [Eclipse]自动注释功能
  19. 使用random函数实现randint函数的功能
  20. 在razor中使用递归,巧用递归

热门文章

  1. iptables技术入门
  2. opencv —— split、merge 通道的分离与合并
  3. Balanced Lineup POJ - 3264
  4. Android_小账本_筛选功能的实现
  5. Java高级项目实战之CRM系统01:CRM系统概念和分类、企业项目开发流程
  6. Android数据存储之SD卡文件操作
  7. 嵊州D5T2 折纸 folding
  8. win10c盘被下满文件解决办法
  9. PAT (Basic Level) Practice (中文)1047 编程团体赛 (20 分)
  10. A*模板(求K短路)(POJ2449)