# Approximate a circle with cubic Bézier curves

A good cubic Bézier approximation to a circular arc is:

\(\mathbf{P}_0 = (0,1)\), \(\mathbf{P}_1 = (c,1)\), \(\mathbf{P}_2 = (1,c)\), \(\mathbf{P}_3 = (1,0)\)

\(c = 0.551915024494\)

This yields an arc on the unit circle centered about the origin, starting at \(\mathbf{P}_0\) and and ending at \(\mathbf{P}_3\), with the least amount of radial drift.

Bézier curves are often used to generate smooth curves because Bézier curves are computationally inexpensive and produce high-quality results. The circle is a common shape that needs to be drawn, but how can the circle be approximated with Bézier curves?

The standard approach is to divide the circle into four equal sections, and fit each section to a cubic Bézier curve. This reduces the problem to a matter of fitting a cubic Bézier curve to a right circular arc.

The standard approach imposes the following constraints:

- The endpoints of the cubic Bézier curve must coincide with the endpoints of the circular arc, and their first derivatives must agree there.
- The midpoint of the cubic Bézier curve must lie on the circle.

The general formula of a cubic Bézier curve is:

\(\mathbf{B}(t) = \left(1-t\right)^3 \mathbf{P}_0 + 3 (1-t)^2 t \mathbf{P}_1 + 3 (1-t) t^2 \mathbf{P}_2 + t^3 \mathbf{P}_3\), \(t \in [0,1]\)

The first constraint implies that:

\(\mathbf{P}_0 = (0,1), \mathbf{P}_1 = (c,1), \mathbf{P}_2 = (1,c), \mathbf{P}_3 = (1,0)\)

The second constraint provides the value of \(c\):

\(c = \frac{4}{3} \left(\sqrt 2 - 1\right)\)

This gives the approximation:

\(c \approx 0.5522847498\)

The maximum radial drift is \(0.027253\%\) with this approximation.

In this approximation, the Bézier curve always falls outside the circle, except momentarily when it dips in to touch the circle at the midpoint and endpoints.

- Figure 2. The radial distance from the arc to the standard Bézier approximation.

## A better approximation

However, a better approximation is possible if we replace the final constraint with a new constraint:

- The endpoints of the cubic Bézier curve must coincide with the endpoints of the circular arc, and their first derivatives must agree there.
*The maximum radial distance from the circle to the Bézier curve must be as small as possible.*

This new constraint explicitly requires the Bézier curve to stay near the circle—resulting in a better fit.

The first constraint yields the parametric form of the Bézier curve:

\(\mathbf{B}(t) = \left(x, y\right)\), where:

\(x(t) = 3 c \left(1-t\right)^2 t + 3 \left(1-t\right) t^2 + t^3\)

\(y(t) = 3 c \: t^2 \left(1-t\right) + 3 \: t \left(1-t\right)^2 + \left(1-t\right)^3\)

The radial distance from the arc to the Bézier curve is:

\(d(t) = \sqrt{x^2 + y^2} - 1\)

- Figure 3. The radial distance from the arc to the ideal Bézier approximation.

This radial distance function, \(d(t)\), has minima at \(t = 0, \frac{1}{2}, 1\), and maxima at \(t = \frac{1}{2} \pm \frac{\sqrt{12 - 20c - 3c^2}}{4 - 6c}\).

Because the Bézier curve is symmetric about \(t = \frac{1}{2}\), the two maxima have the same value. The radial deviation is minimized when the magnitude of this maximum is equal to the magnitude of the minimum at \(t = \frac{1}{2}\).

This gives the ideal value for \(c\):

\(c \approx 0.551915024494\)

The maximum radial drift is \(0.019608\%\) with this approximation. This is \(28\%\) better than the standard approximation.

Here is the final result:

- Figure 4. The Bézier approximation is almost indistinguishable from a circle.

Figure 4 was created using the Bézier curves:

\(\mathbf{P}_0 = (0,1), \mathbf{P}_1 = (c,1), \mathbf{P}_2 = (1,c), \mathbf{P}_3 = (1,0)\)

\(\mathbf{P}_0 = (1,0), \mathbf{P}_1 = (1,-c), \mathbf{P}_2 = (c,-1), \mathbf{P}_3 = (0,-1)\)

\(\mathbf{P}_0 = (0,-1), \mathbf{P}_1 = (-c,-1), \mathbf{P}_3 = (-1,-c), \mathbf{P}_4 = (-1,0)\)

\(\mathbf{P}_0 = (-1,0), \mathbf{P}_1 = (-1,c), \mathbf{P}_2 = (-c, 1), \mathbf{P}_3 = (0,1)\)

with \(c = 0.551915024494\).