Bezier Curve Demo Selected by PC Webopaedia

By Mark Hoefer. See instructions below. Also see his other demos.

Just click four times anywhere on the screen, these are the control points. A bezier curve will be drawn for you. Now you can click on any of the four points that you have already created and drag it around. Notice how the Bezier curve is redrawn according to the new control points. Toggle the "Polygon" button in order to draw the curve with or without its control polygon and points.

Bezier curves are created by taking a time-varying linear combination of the control points. The Bernstein polynomials are used to calculate this linear combination given by the following equation where Pi is the ith control point:

P(t) = (1-t)^3P0 + 3(1-t)^2tP1 + 3(1-t)t^2P2 + t^3P3 with t running from 0 to 1.

Note: This and the related demos were written some time ago by then-student Mark Hoefer. For mathematical background, see course handouts on Lagrange interpolation , cubic Bezier curves , cubic spline curves , and nonuniform splines . (A couple of diagrams are not included, as they were physically pasted into the handouts.)

JAVA SOURCE CODE