Let's say your graphics library has the ability to draw cubic Bezier curves (specified with the usual 4 control points). But what you want to do is draw a smooth curve through any number of points. You can draw a Bezier curve between the first 2 points, another Bezier curve between the next 2 points, and so on, but the trick is in working out the values of the two interior control points between each 2 points so as to make each Bezier curve smoothly join with its neighbouring Bezier curves. It's a tricky mathematical problem (at least for someone as mathematically naive as myself).

I have written a small demo which allows you to specify a bunch of points on the screen, and as each point is added, a Bezier curve is drawn, the end result being a smooth curve through the points you have specified. I can see this being useful in games, maybe you want a smooth path for some purpose (like a racetrack). I know there are other (maybe easier) methods for creating smooth paths between points, but I wanted to utilise the Bezier drawing capability of my graphics library (OpenGL in this case). Here is a screenshot:

http://www.ludicity.org/images/bezierss.png

I wrote the program with Free Pascal (using JEDI-SDL headers), and you compile it with:

fpc -Mobjfpc bezier.pp

When you run the program, hit the F1 key to get help (there's a bunch of options). I have tested it under Linux, but it should work under Windows (I hope!) Here is the source download (98 KB):

http://www.ludicity.org/files/bezier.tar.gz