Creating continuous splines / Ensuring a smooth transition between splines

I am working on a project that involves creating a spline from a specific set of points (tens of thousands of points).

First, create a spline for the first 1000 points and simulate the โ€œmovementโ€ along this path with an arrow (it is drawn using the tangent and the current point on the spline). When I get to the end of the path, I take the next 1000 points and create a new spline and continue my โ€œdrivingโ€.

The problem I'm experiencing is that the splines (previous spline and current spline) do not match at the end. Without matching, I mean that they do not have the same tangent (the first derivative does not match), and there is a difference between the last point of the previous spline and the first point on the new spline (this is because I do not use an interpolating spline, but a smooth spline - see NOTE 1 below). This makes my arrow jump at the end of the spline when switching to the newly created spline.

NOTE 1. I am NOT using interpolating splines. I use smooth splines. See here and here for more details. This means that the set of points specified as input may not be on the resulting spline (in my case, they are pretty close to the spline, but usually NOT on the spline).

NOTE 2: Using an interpolating spline is out of the question because I have a lot of noise in the data used to calculate the spline.

NOTE 3. The calculation of the spline for the entire set of points takes a lot of time (more than 30 seconds) on a 3Ghz PC with 2 GB of RAM (our target platform for the application); therefore, doing this, too, is out of the question.

I would be interested to overcome this unwanted "jump" when switching splines.

So my questions are:

  • Are there any ways / algorithms for performing a smooth transition / transition to a new spline?
  • Can I do something with a special type of spline to overcome this? (This is what I have tried so far without significant improvement).

Thanks for any ideas,

Julian

+6
source share
1 answer

This is a rather unsophisticated assumption, true, but one obvious hack would be to correspond to overlapping rather than separate subsets of points, and then interpolate between the resulting splines in the overlap area.

For example, generate a smooth spline for points 1-1000. During animation from 1-900, generate the next spline from 901-1900. For a region between 901 and 1000, use a weighted combination of the corresponding positions in both splines, where the weighting is 1: 0 at 901 and 0: 1 at 1000. The same goes for 1801-1900, etc.

I would suggest that simple linear interpolation would be enough, and the fields probably should not be huge, but you could define it empirically.

+4
source

Source: https://habr.com/ru/post/890660/


All Articles