Point Sequence Interpolation

前端 未结 9 592
广开言路
广开言路 2021-01-02 07:36

Given an arbitrary sequence of points in space, how would you produce a smooth continuous interpolation between them?

2D and 3D solutions are welcome. Solutions tha

相关标签:
9条回答
  • 2021-01-02 07:44

    Google "orthogonal regression".

    Whereas least-squares techniques try to minimize vertical distance between the fit line and each f(x), orthogonal regression minimizes the perpendicular distances.

    Addendum

    In the presence of noisy data, the venerable RANSAC algorithm is worth checking out too.

    0 讨论(0)
  • 2021-01-02 07:45

    I came up with the same problem and implemented it with some friends the other day. I like to share the example project on github.

    PathInterpolation screenshot

    https://github.com/johnjohndoe/PathInterpolation
    Feel free to fork it.

    0 讨论(0)
  • 2021-01-02 07:46

    There are several algorithms for interpolating (and exrapolating) between an aribtrary (but final) set of points. You should check out numerical recipes, they also include C++ implementations of those algorithms.

    0 讨论(0)
  • 2021-01-02 07:50

    One way is Lagrange polynominal, which is a method for producing a polynominal which will go through all given data points.

    During my first year at university, I wrote a little tool to do this in 2D, and you can find it on this page, it is called Lagrange solver. Wikipedia's page also has a sample implementation.

    How it works is thus: you have a n-order polynominal, p(x), where n is the number of points you have. It has the form a_n x^n + a_(n-1) x^(n-1) + ...+ a_0, where _ is subscript, ^ is power. You then turn this into a set of simultaneous equations:

    p(x_1) = y_1
    p(x_2) = y_2
    ...
    p(x_n) = y_n
    

    You convert the above into a augmented matrix, and solve for the coefficients a_0 ... a_n. Then you have a polynomial which goes through all the points, and you can now interpolate between the points.

    Note however, this may not suit your purpose as it offers no way to adjust the curvature etc - you are stuck with a single solution that can not be changed.

    0 讨论(0)
  • 2021-01-02 07:54

    In the 3D graphics world, NURBS are popular. Further info is easily googled.

    0 讨论(0)
  • 2021-01-02 07:56

    Have you looked at the Unix spline command? Can that be coerced into doing what you want?

    0 讨论(0)
提交回复
热议问题