quadratic bezier
cubic bezier
bezier curves
curve conversion
mathematical algorithms

Convert a quadratic bezier to a cubic one

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

A quadratic Bezier curve uses three control points, while a cubic Bezier curve uses four. If you need to export a quadratic curve into a system that only accepts cubics, you do not need an approximation. You can convert it exactly by choosing the cubic control points carefully.

The Original Quadratic Curve

Let the quadratic curve use points P0, P1, and P2.

Its parametric form is:

B(t) = (1 - t)^2 P0 + 2(1 - t)t P1 + t^2 P2, for t in [0, 1].

A cubic Bezier uses points Q0, Q1, Q2, and Q3:

C(t) = (1 - t)^3 Q0 + 3(1 - t)^2 t Q1 + 3(1 - t)t^2 Q2 + t^3 Q3.

The goal is to choose Q0 through Q3 so that C(t) traces exactly the same curve as B(t).

Exact Conversion Formula

The endpoints stay the same:

  • 'Q0 = P0'
  • 'Q3 = P2'

The interior cubic control points are:

  • 'Q1 = P0 + (2/3) * (P1 - P0)'
  • 'Q2 = P2 + (2/3) * (P1 - P2)'

This is the standard exact conversion.

Why does it work? The cubic must preserve the same start point, end point, and endpoint tangents as the quadratic. Those conditions are enough to make the curves identical because a quadratic is a special case of a cubic.

Intuition Behind the Formula

The derivative of the quadratic at the start is proportional to P1 - P0, and at the end it is proportional to P2 - P1.

For the cubic, the start tangent depends on Q1 - Q0, and the end tangent depends on Q3 - Q2.

By placing Q1 two thirds of the way from P0 to P1, and Q2 two thirds of the way from P2 back toward P1, the cubic gets exactly the same tangent directions and magnitudes at both ends.

A Small Numeric Example

Suppose the quadratic points are:

  • 'P0 = (0, 0)'
  • 'P1 = (3, 6)'
  • 'P2 = (9, 0)'

Then the cubic points become:

  • 'Q0 = (0, 0)'
  • 'Q1 = (2, 4)'
  • 'Q2 = (5, 4)'
  • 'Q3 = (9, 0)'

That cubic traces the same geometric curve as the original quadratic.

Runnable Conversion Code

Here is a short Python helper for 2D points.

python
1def quadratic_to_cubic(p0, p1, p2):
2    q0 = p0
3    q1 = (
4        p0[0] + (2.0 / 3.0) * (p1[0] - p0[0]),
5        p0[1] + (2.0 / 3.0) * (p1[1] - p0[1]),
6    )
7    q2 = (
8        p2[0] + (2.0 / 3.0) * (p1[0] - p2[0]),
9        p2[1] + (2.0 / 3.0) * (p1[1] - p2[1]),
10    )
11    q3 = p2
12    return q0, q1, q2, q3
13
14
15p0 = (0.0, 0.0)
16p1 = (3.0, 6.0)
17p2 = (9.0, 0.0)
18print(quadratic_to_cubic(p0, p1, p2))

If you are working in three dimensions, the same formula applies component-wise.

Why Designers and Graphics Libraries Do This

Many vector formats and rendering APIs standardize on cubic curves because cubics are more general and easier to compose into a single representation. Quadratics still appear in font formats, simple editors, and educational material, so exact conversion is useful when bridging systems.

This is also why SVG importers, font tools, and graphics engines often include a quadratic-to-cubic conversion pass during parsing.

Approximation Versus Exact Conversion

For this specific case, you are not approximating one shape with another. A quadratic Bezier is already representable as a cubic. The conversion becomes an approximation problem only when you move in the other direction, such as trying to reduce an arbitrary cubic into a single quadratic.

That distinction matters because some articles describe the formula as a "close fit." It is not merely close. It is exact.

Common Pitfalls

A common mistake is using one third instead of two thirds when computing Q1 and Q2. That changes the tangents and produces the wrong curve.

Another issue is forgetting that the formula assumes Bezier control points, not sampled points on the curve. If P1 is not the quadratic control point, the conversion will be meaningless.

Developers also sometimes compare parameterization rather than geometry after conversion. Small floating-point differences are normal, but the mathematical curve is the same.

Summary

  • A quadratic Bezier can be converted to a cubic exactly.
  • Keep the same endpoints and place the cubic control points at two-thirds positions.
  • The formula preserves the quadratic's endpoint tangents.
  • The conversion works component-wise in 2D or 3D.
  • This is an exact representation change, not an approximation.

Course illustration
Course illustration

All Rights Reserved.