# Converting variable-interval input to fixed-interval output

Hi all,

When calculating animation-paths I use a numerical differential equation solver (ODE). Currently I’m trying to simulate particles, springs and other physics related stuff in real time.
The solver produces results in varying intervals, depending on the required accuracy and the complexity of the used equations.
How can I post-process these results efficiently so I get a nice sequence of values equally spaced in time.

Example:

ODE results at t=0.0, 0.5, 0.6, 0.63, 0.66, 0.7, 0.9, …

should be converted to

Animation frames at t=0.0, 0.2, 0.4, 0.6, 0.8, 1.0 etc.

I’m trying to build some code from scratch, but I think I really need some more info on how to do this kind of animation stuff. Pointers would be welcome.

The thing I’m currently stuck with is this: how do I keep the input (ODE) and output (OpenGL frames) reasonably synchronised. I do not want the ODE running too far ahead of the actual rendering, but far enough so that when complex calculations start to occur in the ODE the buffer gets empty…

Other issues are:

• how to decide when and what results should be skipped to re-synchronise if the buffer gets overloaded
• what kind of storage mechanism is efficient for this task

Jean-Marc.

Hi,
I think that you can use NURBS here to interpolate the solutions from the solver and then to sample them at the uniform points.
NURBS have two important properties, which will help you here. First you can use them with non-uniform knots, like these received from ODE solver, and second, they have local support, which means that you need to update only the last part of interpolation function, when you receive the solutions.
I imagine it so:
You have [t0, t1, …, tn] – knots where you know the solution (from the solver)
You need the solution at [p0, p1, …, pk] – uniform distributed knots
Lets say the NURBS order (which you will choose) is l.
Then when you receive additional solution at t(n+1), you need to recalculate only the interpolation function dependent of the last l+1 knots – in fact from the nodes [t(n-l), t(n-l +1),…,t(n+1)]. The previous part of the interpolating spline function will remain unchanged. This means that you can use the interpolated values for every pk, where pk <= t(n-l). With other words you’ll need to have at least l+1 solutions, before you can start with the animation.
I hope I didn’t express myself too illegible You can find everything for NURBS in the net.

Regards
Martin

Well, you could interpolate !