About the Example Programs
I've always been interested in the computerized usage of curves (such as NURBS, Splines, etc.) so I decided to learn a little more about Bézier curves one evening in the school library, and I instantly decided to write a C program to generate renderable curves from control points.
My first program, bezier, generated its curves in static arrays to hold the points. This method was fast, but quite inflexible, and not as portable as I had hoped. My second attempt resulted in an implementation of the Bézier plotter that utilized linked lists to store the point data, called belize.
(bezier + linked list == belize?).
The Mathematical Explanation
Bézier curves are parametric functions which are defined by several control points. A third degree Bézier curve will have four control points, a fourth degree will have five, and so forth. Each control point weights the function to varying degrees during its interpolation, thus changing the shape of the final curve.
A Bézier function is generalized as the following parametric equation, where Pi represents the cartesian coordinate of the ith control point:
(Image credit Wikipedia.org).
A Few Example Rendered Curves
Here are a few images that demonstrate what the program does. The C program reads a control point file, which is formatted to hold the X,Y coordinates of each control point for the curve. Then the program outputs a PostScript file, which can be converted easily (using shell scripts) into a PNG image file.
Source and Binary Downloads
Linux/UNIX:
Windows/DOS:
Mac OSX:
Example Curve Tarball:
- examples: examples-20070810.tar.bz2
Old (bezier) Files:
- linux src: bezier-src.tar.bz2
- win32 src: bezier32-src.zip
- win32 bin: bezier32-bin.zip