Steer a curve with a few points
Bézier curves are the smooth curves behind every font, SVG icon and vector drawing, steered by a handful of control points. Drag the points and watch de Casteljau's construction find each point of the curve by nothing more than repeated interpolation, see the Bernstein polynomials that weigh the points, split the curve in two, raise its degree, make it rational for an exact circle, and join pieces into a path with corners or smooth joins. Drag the control points P₀ … Pₙ and watch the curve follow. Play moves t from 0 to 1 and back: the coloured segments are de Casteljau's construction, each level dividing the segments of the level above in the ratio t : (1 − t), until one point is left, B(t), with the last segment along the tangent. Drag along the curve or in the basis graph to set t yourself, and use Step and Back to move it by 0.05. The graph shows the Bernstein polynomials Bᵢ,ₙ(t), the weights with which each control point pulls on B(t); they always add up to 1. Double-click empty space to add a control point (up to degree 7) and double-click a point to remove it, or use Add point and Remove point (adding raises the degree without changing the curve). Pick a mode to subdivide the curve at t into two curves with their own control polygons, to elevate its degree, or to apply an affine map to the control points. Choose quadratic or cubic segments to build a path, as fonts and vector drawings do, with corners (C0), aligned handles (G1), mirrored handles (C1) or a C2 spline at the joins. The weight makes the curve rational: a quadratic with w = cos(θ/2) is an exact circular arc. Copy SVG path gives the path for any SVG file; Save image, record a video or open the picture in the photo editor with the pencil, where the control polygon, the hull, the construction, the curve, the points, the basis graph and the labels are layers of their own.
How it works
- Drag the control points and watch the curve follow; Play moves t from 0 to 1 and back while the coloured segments of de Casteljau's construction close in on B(t) and its tangent.
- Read the degree, t, B(t), the arc length and the curvature in the tiles, and the Bernstein polynomials in the graph; drag along the curve or the graph to set t.
- Pick a mode to split the curve at t, raise its degree or map it affinely; double-click to add or remove points, change the weight, or build a path of quadratic or cubic segments with C0, G1, C1 or C2 joins.
- Try the examples, from a straight line to a loop, a cusp, a circle, a heart and a letter outline, then copy the SVG path, save the picture, record a video or edit it in the photo editor.
A curve steered by points
A Bézier curve of degree n is fixed by n + 1 control points. Its point at the parameter t between 0 and 1 is B(t) = Σ Bᵢ,ₙ(t)·Pᵢ, a weighted average of the control points with the Bernstein polynomials Bᵢ,ₙ(t) = C(n, i)·tⁱ·(1 − t)ⁿ⁻ⁱ as weights. The curve starts at the first point and ends at the last; the points in between pull it towards themselves without lying on it. Degree 1 is a straight segment, degree 2 an arc of a parabola, and degree 3, the cubic, is the curve of nearly all design software.
De Casteljau's construction
To find B(t), divide each leg of the control polygon in the ratio t : (1 − t), join the new points and repeat: each level has one point fewer, and the last point left is B(t). The two points of the level before span the tangent at B(t), and the velocity is n times their difference. Paul de Casteljau found this at Citroën in 1959; it needs only interpolation, is numerically stable, and its triangle of points also splits the curve at t into two Bézier curves with their own control polygons.
Why they behave so well
The Bernstein polynomials are never negative and add up to 1, so the curve stays inside the convex hull of its control points, leaves the first point along the first leg and arrives along the last, and follows any rotation, scaling, shear or shift of its control points exactly. A curve of degree n can be rewritten with n + 2 control points without changing it (degree elevation), which is how quadratic font outlines become cubics. Giving the points weights makes a rational curve: a quadratic with w = cos(θ/2) is an exact circular arc, while four ordinary cubics with handles 0.5523 times the radius come within 0.027 %.
Paths, fonts and SVG
Real shapes are paths of low-degree segments joined end to end. At a join the curve can turn a corner (C0), keep its direction with aligned handles (G1), keep its velocity with mirrored handles (C1) or also its second derivative (C2, a cubic spline). TrueType fonts use quadratic segments, PostScript and OpenType CFF fonts and most drawing programs cubic ones, and SVG writes them as L, Q and C commands. The app measures the continuity at every join, shows a curvature comb, and copies the path as an SVG path string.
Frequently asked questions
What is a Bézier curve?
A smooth curve defined by a few control points: B(t) = Σ Bᵢ,ₙ(t)·Pᵢ for t from 0 to 1, a weighted average of the n + 1 control points with the Bernstein polynomials as weights. It starts at the first control point and ends at the last, and the inner points pull it towards themselves. Quadratic (3 points) and cubic (4 points) curves are used in fonts, SVG paths, CSS animations and every vector drawing program.
How does de Casteljau's algorithm work?
Divide each leg of the control polygon in the ratio t : (1 − t), giving one point fewer; join those points and divide again, and repeat until a single point is left: that point is B(t). The last segment before it is the tangent to the curve there. The app colours each level, so you can watch the nested segments slide as t changes. The same triangle of points gives the control polygons of the two halves when the curve is split at t.
What are Bernstein polynomials?
The weights Bᵢ,ₙ(t) = C(n, i)·tⁱ·(1 − t)ⁿ⁻ⁱ with which each control point contributes to B(t). They are never negative, they add up to 1 for every t, and Bᵢ,ₙ peaks at t = i/n. Because of this the curve lies in the convex hull of its control points and follows affine maps of them exactly. The app graphs the basis with the current t marked.
Can a Bézier curve draw a perfect circle?
Not with ordinary polynomial curves: four cubics with handles k·r, where k = 4(√2 − 1)/3 ≈ 0.5523, deviate from a circle by at most 0.027 % of the radius, which is close enough for screens and printers. A rational quadratic Bézier curve, whose middle point has the weight w = cos(θ/2), is an exact circular arc of angle θ; the app's exact circle example uses four of them with w = 0.707.
What do C0, G1, C1 and C2 continuity mean?
They describe how two curve segments meet in a path. C0: the ends touch, but there may be a corner. G1: the tangent direction is the same, because the handles on both sides of the join line up. C1: the velocity is the same, because the handles are mirror images. C2: the second derivative matches too, so the curvature changes smoothly, as in a cubic spline. The app keeps the chosen continuity while you drag and measures the weakest join.
Can I use the curve in my own files?
Yes. Copy SVG path puts the path on the clipboard as an SVG path string in a 1000 × 600 view box (exact L, Q and C commands for degrees 1 to 3; higher degrees and rational curves as close cubic pieces), Save / Open JSON keeps the control points, Save gives a PNG, Record films the construction, and the pencil opens the picture in the PictorX photo editor with the control polygon, the convex hull, the construction lines, the curve, the points, the basis graph and the labels on layers of their own. In the editor itself it is under Apps ▸ Science ▸ Mathematics ▸ Bézier Curves. Everything runs in your browser.
Bézier Curves: how do I record a video?
Press the red Record button in the playback bar: it films what the stage shows. Press it again to stop, and the video is saved to your device. Recording is free; you only need to sign in. Without a subscription the video carries a small PictorX logo in a corner. The button beside Record opens the video options: the shape (as shown, square, story 9:16 or wide 16:9), the length (until you stop, or 5, 10, 15 or 30 seconds for social media) and the file: MP4, WebM or an animated GIF. For the sound, choose the app's own sounds or one of three music tracks: calm, bright or beat.
Ready to try it?
Open PictorX in your browser — no install, no credit card required to start.
Go to Editor