CPSC 170 Post Lab 6
Bézier Curves
Due Before Class on Tuesday, February 24th


A Bézier curve is a method for representing curves popularized by the French engineer Pierre Bézier in the 1960's. Bézier used the curves in the design automobiles. The curves are still popular today in drawing and animation applications because they offer an intuitive control over curve shape. Bézier curves can also be approximated very easily using a recursive algorithm developed another Frenchman, Paul de Casteljau. You are going to create a program that allows users to draw a Bézier curve.


Modify your drawing program from post-lab 2 to include a Bézier curve tool. If you would prefer, you can modify the drawing program in the tar file Drawing.tar.gz. You can also use the icon images in the tar file DrawingIcons.tgz. When the Bézier curve tool is selected, clicks on the drawing area should add control points. Each time a control point is added the display should update to reflect the changes in the Bézier curve currently being drawn. If the user double clicks (or just clicks in the same location twice in a row), no more points should be added to the curve currently being drawn. If the user clicks again, after the double click, while the Bézier curve tool is selected, a new Bézier curve should be created.

In order to draw a Bézier curve, you need to calculate a series of points on the curve. You can use the de Casteljau method you created in the sub-post-lab to calculate an arbitrary number of evenly spaced points on the curve. Then, draw lines between each pair of consecutive points, to draw the curve.

Submission: Tar and submit your code on the course Inquire site.