Point Sequence Interpolation

前端 未结 9 593
广开言路
广开言路 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:58

    Unfortunately the Lagrange or other forms of polynomial interpolation will not work on an arbitrary set of points. They only work on a set where in one dimension e.g. x

    xi < xi+1

    For an arbitary set of points, e.g. an aeroplane flight path, where each point is a (longitude, latitude) pair, you will be better off simply modelling the aeroplane's journey with current longitude & latitude and velocity. By adjusting the rate at which the aeroplane can turn (its angular velocity) depending on how close it is to the next waypoint, you can achieve a smooth curve.

    The resulting curve would not be mathematically significant nor give you bezier control points. However the algorithm would be computationally simple regardless of the number of waypoints and could produce an interpolated list of points at arbitrary granularity. It would also not require you provide the complete set of points up front, you could simply add waypoints to the end of the set as required.

    0 讨论(0)
  • 2021-01-02 08:02

    The Catmull-Rom spline is guaranteed to pass through all the control points. I find this to be handier than trying to adjust intermediate control points for other types of splines.

    This PDF by Christopher Twigg has a nice brief introduction to the mathematics of the spline. The best summary sentence is:

    Catmull-Rom splines have C1 continuity, local control, and interpolation, but do not lie within the convex hull of their control points.

    Said another way, if the points indicate a sharp bend to the right, the spline will bank left before turning to the right (there's an example picture in that document). The tightness of those turns in controllable, in this case using his tau parameter in the example matrix.

    Here is another example with some downloadable DirectX code.

    0 讨论(0)
  • 2021-01-02 08:06

    You should take a look at B-splines. Their advantage over Bezier curves is that each part is only dependent on local points. So moving a point has no effect on parts of the curve that are far away, where "far away" is determined by a parameter of the spline.

    The problem with the Langrange polynomial is that adding a point can have extreme effects on seemingly arbitrary parts of the curve; there's no "localness" like described above.

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