*Edit: This post is quite long and explains a couple of things but the second one shows a much simpler result that even performs better.*
A while ago, I found those papers about C∞
-interpolation, by going into the limit of b-Splines, when you have an infinite amount of knots.
The resulting splines are called ERBS (Corresponding paper as PDF
In that paper, they stated, that you basically need to solve an integral numerically, as else, you wont get all the traits to work.
So that meant, no closed-form expression is available.
The limit basically converged into an exponential of a rational function (as opposed to the rational function, found in NURBS)
So I wondered, whether I could combine Exponential-based rational functions (such as tan(x)) into something that has at least some of the traits but is closed form.
What I found, is this:
The blue graph is the function itself, and the purple and yellow ones are the first and second derivative, respectively.
If you use this function in a linear-interpolation-manner, e.g.
r(x) (1-f(x))+s(x) f(x)
You interpolate smoothly - PERFECTLY smoothly - between the (potentially vector-valued) functions r and s.
Outside of the interval [0,1], you'd just go on with the actual functions.
With the parameter k, I added, you can toggle, how "fast" you want this interpolation to happen.
All it needs to basically work just as well as the "default" Beziér-Interpolation, is a trivially add-able offset parameter, so you can use it multiple times for one big function.
The version, they did in the ERBS has a couple of other advantages, where I'm not sure, whether my found solution satisfy them.
If you look at the first derivative, the function could potentially be improved by making the middle portion flat as well. But I wasn't able to think of an easy "fix" for that...
Multidimensional interpolation should work just like multilinear interpolation., but instead of using the parameter t, as it's usually called, use the function given above.
Maybe, the "flat" section is too long to make this method overal useful, but in some cases it might be useful...
Here is an extreme case: Interpolating between tan(x) and cot(x) over two Intervals (0 - 2π), compared to simple linear interpolation. The function I'm using here fits the curves much closer...
As you can see, linear interpolation already fails due to the pole. At x=0, it returns a value of 1/(2π) instead of, as expected, 0.
Not very well visible is, that linear interpolation will add a break in the function, due to not being C2
Bezier-Interpolation wouldn't have such a problem, but after a couple of derivatives, such a break would appear once again.
The function I'm using here will never have this problem. It's, as already mentioned, C∞
So if you ever need REALLY smooth interpolation and you don't want to bother with the implementation of ERBS, use this.
There is only one major problem:
The nature of this interpolation function is by construction an exponential one. I'm exploiting a function that goes to 1 at ∞ and to 0 at -∞ and put in a function, that goes to exactly those places in finite time. Thus, beware of overflow and underflow...
(For maximum costumizablity, also check out GERBS
(pdf) - the extension of ERBS that also allows deliberate breaks in the function and such...)