inverse distance weighting interpolation

核能气质少年 提交于 2019-12-04 20:34:19

I don't see any way besides piecewise - you need a different function than reciprocal distance for small distances. The simplest thing would be to just chop off the top:

modified_dist[i] = dist[i] < MIN_DIST ? MIN_DIST : dist[i]

but you could replace that with something still decreasing if you want, like (MIN_DIST + dist[i])/2.

If there is a zero-distance, there is no need of interpolation since you have a perfect match!

inside the for-loop:

if(dist[i] == 0.) return values[i];

Come up with definitions of "dominant", "very small" and "deal with it". Then, translate them into code.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!