Bézier curves
A cubic Bézier curve is the curve in every drawing program: four control points, of which it passes through only the first and the last. De Casteljau's construction draws it with nothing but mixing. Mix each pair of neighboring control points t of the way along, then mix the three points that gives, then the two after that. The last point lands on the curve, and as t runs from 0 to 1, it traces all of it.
Things to notice
- The weights always add up to 1. Each number in the formula is how much of one control point is in the mix. At t = 0 it's all P₀, and at t = 1 all P₃.
- The curve never leaves the dashed outline. Every mix lands between the points it mixes, so the curve stays inside the shape the control points span.
- The ends point at the middle control points. The curve leaves P₀ heading for P₁, and arrives at P₃ coming from P₂. Drawing programs show these as the handles.
- Crossed handles bend the curve back. With P₁ past P₂, the curve turns sharply, and with the two far enough past each other it loops over itself.
How it's built
- The board holds the geometry. The four control points are ordinary JSXGraph points, so the board keeps track of them and the page doesn't. Dragging the dashed outline moves two at once.
- One variable drives the construction.
tis a<t-var>, shown by the\tangle{t}in the<t-math>. Every mixed point and the drawn part of the curve readtinside a function, so<t-jsxgraph>updates them when it changes. - The formula and the board agree. The weights in the formula are
\val{}s of the same expressions the curve uses. - Play is an animation. The button sets
ton every animation frame. The board doesn't know it's an animation: it's just a variable changing.
Open the source panels above for the full markup, script and styles.