How to interpolate N points that do not describe a function

隐身守侯 提交于 2021-02-08 02:01:59

问题


Suppose i have n points, also suppose that this points have an order, and not necessary this points make a function. I'm wondering how to interpolate them if the points do not describe a function? For example this will be the original points: Points to Interpolate

And i hope this result:

Interpolated Points

Note that only using splines do not works because the points do not make a function, and also using Bezier curves do not works because them do not interpolate the points (only pass near of them). How can i do for get this? Is there an algorithm for that?


Just an update. Since the accepted answer’s link that I took as a reference is down, I’m going to share an article I wrote based on that for helping others with this issue.

Interpolate 2D points, usign Bezier curves in WPF


回答1:


  1. There are a lot of kinds of splines, and, for example, Catmull-Rom splines are applicable here.

  2. Simple and interesting method for interpolation by Bezier curves has been proposed by Maxim Shemanarev




回答2:


This answer addresses some conceptual problems with the question itself. I don't intend it as a complete answer.

The first is that in the situation given there's always a function. Mathematically, you describe a curve as a function from the real numbers, roughly representing "time", to your space. This is often called a parametric representation of the curve. We write the function as f(t) =( x(t), y(t) ), where x(t) and y(t) are the individual parameter functions.

The problem is that the function you have may not be the function you want. Every problem of this type, in order to have hope of an answer, has to state explicitly what class of functions are admissible as an answer. Just saying "functions" has little meaning. The question is missing a statement of admissible classes of functions are viable. There's a mention of splines, though, so let's pursue that. Given a class of splines (bi-cubic ones are common), in general you can only fit to so many points on the spline, not an arbitrary number. So what you want is the class of piecewise spline functions, that is, a sequence of splines.

Once you have an admissible class of function, you also have to decide how to pick them. The condition you seem to have stated is that you want the spline to pass through the given points. That's a common condition, but not the only one. Others are to minimize curvature, to minimize length, to minimize the total distance of the points to the curve, etc. The fitting condition is also part of the statement of the problem.

Summarizing, it sounds like you want to fit a piecewise spline curve to pass through a sequence of points. Now see the other answers, because that's the question they're answering.



来源:https://stackoverflow.com/questions/13312834/how-to-interpolate-n-points-that-do-not-describe-a-function

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