Interpolating Points for 2D Water Simulation

A demo of interpolation between points for a work-in-progress simple water simulation.

Click and drag points to see the effect of the interpolation, small movements are best. Press space to toggle interpolated and linear points. Using the spring system I've showcased before I'm working on a simple 2D water simulation that could be put into a game. The effect isn't done yet, there is a lot of tweaking to do, I intend to explain the effect in another post. In short there are a bunch of verticle springs that compress and expand. By default I'd draw a straight line between each set of points, but for a water effect this looks ugly. As the effect is based on real physics, I could increase the density of the springs, but the spring approximation to water breaks down quickly, not to mention an increase of resource usage. An easier option was to interpolate between the two points, using the Catmull-Rom splines method. The Catmull-Rom method ensures the curve goes through all the control points which is important to the simulation.

I'd recommend this and this for a guide on interpolation implementation.