Mathematics ★★☆ Moderate

🎯 Bézier Curves

Drag control points to shape smooth curves. Watch De Casteljau's algorithm recursively interpolate them step by step — the same math behind fonts, SVG paths, and CAD tools.

Degree: 3
Control pts: 4
t = 0.500
Curve pt: (–, –)
Bézier curve Control polygon De Casteljau lines B-spline (if toggled)

De Casteljau Algorithm

A degree-n Bézier curve is defined by n+1 control points P₀, P₁, …, Pₙ. For a parameter t ∈ [0, 1], the curve point B(t) is found by n rounds of linear interpolation: Pᵢʲ = (1−t)·Pᵢʲ⁻¹ + t·Pᵢ₊₁ʲ⁻¹. The construction lines shown in yellow trace these intermediate points, converging to the orange dot on the curve.

Drag any control point (blue circles) to reshape the curve. The algorithm guarantees the curve stays within the convex hull of the control polygon and always passes through P₀ and Pₙ.

About Bézier Curves & Splines

A Bézier curve is a smooth parametric curve defined by a set of control points, invented independently by Pierre Bézier at Renault and Paul de Casteljau at Citroën in the 1960s for car body design. The curve of degree n is given by the Bernstein polynomial B(t) = Σ Pᵢ ⋅ C(n,i) ⋅ (1−t)ⁿ⁻ᶦ ⋅ tᶦ, where t ∈ [0,1] and C(n,i) are the binomial coefficients. The de Casteljau algorithm evaluates this geometrically by repeatedly linearly interpolating between pairs of points — an elegant recursive construction that is numerically stable and visually intuitive.

The simulator lets you place control points by clicking, drag them to reshape the curve in real time, chain cubic Bézier segments into smooth splines (C¹ or G¹ continuity), and watch the subdivision polygon at each step of de Casteljau's construction animate as the parameter t sweeps from 0 to 1.

Frequently Asked Questions

What is de Casteljau's algorithm?

De Casteljau's algorithm evaluates a Bézier curve at parameter t by repeatedly linearly interpolating between adjacent control points. For a cubic curve (4 control points P₀–P₃), the first round gives 3 intermediate points, the second gives 2, and the third gives the single curve point B(t). The intermediate points form a triangle of line segments whose hypotenuse is tangent to the curve — visible in the animation as the moving "subdivision polygon".

Why are cubic Bézier curves so widely used?

Cubic curves (degree 3, 4 control points) offer the minimum degree needed to specify both endpoints and both tangent directions independently, giving full shape control with the fewest parameters. Higher-degree curves can oscillate (Runge's phenomenon) and are harder to edit intuitively. Virtually every vector graphics format — SVG, PDF, PostScript, TrueType/OpenType fonts, and CSS animations — uses cubic Bézier curves as the fundamental shape primitive.

What is a B-spline, and how does it differ from a Bézier curve?

A B-spline (basis spline) is a piecewise polynomial curve defined by a knot vector that determines where polynomial segments join. Unlike a Bézier curve, each control point in a B-spline only influences a local region of the curve (the support is finite), so moving one point does not reshape the entire curve — a property called local control. NURBS (Non-Uniform Rational B-Splines) extend B-splines with weights and are the standard representation in CAD software like AutoCAD and SolidWorks.

How do you ensure smooth joins between cubic segments?

For C¹ continuity (matching first derivatives), the last control point of segment k, the first control point of segment k+1, and the shared endpoint must be collinear, with the distances from the endpoint equal. This ensures the tangent direction and magnitude are identical across the join. For G¹ continuity (matching tangent direction but not necessarily magnitude) only collinearity is required — a weaker but visually smooth condition used in font design.

What are Bernstein basis polynomials?

The Bernstein polynomials B(i,n,t) = C(n,i)⋅tᶦ⋅(1−t)ⁿ⁻ᶦ form a basis for polynomials of degree n on [0,1]. They are non-negative, sum to 1, and each achieves a unique maximum at t = i/n. Because the curve is a weighted average of control points (weights = Bernstein polynomials), the curve always lies within the convex hull of the control polygon — a key geometric property that makes Bézier curves easy to clip and intersect.

How are Bézier curves used in typography?

TrueType fonts use quadratic Bézier curves (3 control points per segment) stored as compact numerical data to define glyph outlines. OpenType fonts can use either quadratic (as in TrueType) or cubic (as in PostScript Type 1) Bézier segments. At display time, the rasteriser evaluates the curves at the appropriate resolution and fills the interior — this is why scalable fonts look crisp at any size. A single ASCII character might be composed of 10–30 Bézier segments.

What is the convex hull property?

The convex hull of a set of points is the smallest convex region containing all of them — think of it as the shape made by stretching a rubber band around the points. Because Bézier curves are convex combinations of their control points (Bernstein weights are non-negative and sum to 1), the curve always stays within the convex hull of its control polygon. This property is used in collision detection and ray-curve intersection algorithms: if a ray misses the convex hull, it cannot hit the curve.

How is the Bézier curve related to animation easing?

CSS and SVG use cubic Bézier curves to define animation easing functions, specified as cubic-bezier(x₁, y₁, x₂, y₂) where the two control points (with endpoints fixed at (0,0) and (1,1)) determine how quickly the animated value changes over time. The familiar "ease-in-out" function is approximately cubic-bezier(0.42, 0, 0.58, 1). The curve maps normalised time (t) to normalised progress, so a steep section means rapid change while a flat section means slow change.

Can Bézier curves represent circles exactly?

No — rational Bézier curves (NURBS with non-unit weights) can represent conic sections including circles exactly, but polynomial Bézier curves cannot. However, a single quadrant of a circle can be approximated very accurately by a cubic Bézier curve with control points at (R, kR) and (kR, R) where k ≈ 0.5523. The maximum error of this approximation is about 0.00027R, making it imperceptible for typical display resolutions.

What is degree elevation in Bézier curves?

Degree elevation is the process of representing the same geometric curve with one more control point (and degree), without changing the curve's shape. A linear segment can be elevated to a quadratic, then to a cubic, etc. This is useful in algorithms that require all curves to have the same degree — for example, when merging curves from different sources. The new control points are computed as weighted averages of the original ones, and the process is always exact (no approximation involved).

About this simulation

This simulator visualises how a Bézier curve is built from a handful of control points using the De Casteljau algorithm, the same recursive interpolation method used throughout computer graphics. You can choose a curve degree from 1 (linear) to 5 (quintic), drag each control point around the canvas, and scrub the parameter t to watch the construction lines converge on the curve. A toggle also overlays a uniform cubic B-spline so you can compare the two techniques directly. Everything on screen is drawn live from the same Bernstein-polynomial mathematics that lies behind fonts, SVG paths and CAD software.

🔬 What it shows

The blue dots are control points P₀…Pₙ, and the dashed grey line is the control polygon joining them. At the chosen parameter t, coloured construction lines show each round of the De Casteljau algorithm's linear interpolation, converging on a single orange point that traces out the orange Bézier curve as t sweeps from 0 to 1. The curve always starts at P₀, ends at Pₙ, and never strays outside the control polygon's convex hull.

🎮 How to use

Drag any blue control point to reshape the curve in real time. The Degree selector switches between 2 and 6 control points (linear through quintic); the t slider moves a single point along the curve, and Play animates t back and forth automatically. Construction toggles the yellow De Casteljau lines on or off, the checkboxes hide the control polygon or the curve itself, and Compare B-spline overlays a green uniform cubic B-spline through the same points. Reset restores the default layout for whichever degree is selected.

💡 Did you know?

Bézier curves were developed independently in the early 1960s by Pierre Bézier at Renault and Paul de Casteljau at Citroën, both hunting for a way to describe car body panels mathematically for computer-aided design — decades before the very same maths ended up defining the letterforms on this page.

Frequently asked questions

What is the De Casteljau algorithm?

The De Casteljau algorithm evaluates a Bézier curve at a given t by repeatedly interpolating linearly between neighbouring control points. For a cubic curve (4 points) it takes three rounds of interpolation to collapse the points down to the single point B(t) on the curve; the coloured lines in the simulation show each of those rounds as they happen.

Why does the curve pass through the first and last control points but not the middle ones?

The curve is a weighted average of all the control points, and those weights (the Bernstein polynomials) fall to zero at every point except P₀ at t=0 and Pₙ at t=1. Every other control point only pulls the curve towards it without the curve ever touching it directly, which is why P₁ through Pₙ₋₁ sit off the curve while P₀ and Pₙ sit on it.

What does changing the degree actually do?

The Degree selector sets how many control points define the curve: degree 1 uses 2 points and draws a straight line, degree 2 uses 3 points for a gentle arc, and degrees 3 to 5 add progressively more points and more possible bends. Higher-degree curves can wiggle more but become harder to shape predictably, which is one reason cubic curves (degree 3) became the industry standard.

How is the Bézier curve different from the B-spline shown here?

The orange curve is a true Bézier curve, where every control point influences the whole shape — a property called global control. The green B-spline shown by the comparison toggle is built from the same points using a different technique, a uniform cubic B-spline, where each point only affects a local stretch of curve, so moving one point leaves the rest largely unchanged.

What does the parameter t actually represent?

t is the curve's parameter, running from 0 to 1. It is not time or distance travelled along the curve; it is simply an input to the interpolation formula. Moving the slider from 0 to 1 sweeps the point B(t) from the first control point to the last, although it does not necessarily move at constant speed along the curve itself.