I'm not mathematically inclined, so please be patient with my question.


  • $(x_0, y_0)$ and $(x_1, y_1)$ as the endpoints of a cubic Bezier curve.

  • $(c_x, c_y)$ and r as the centerpoint and the radius of a circle.

  • $(x_0, y_0)$ and $(x_1, y_1)$ are on the circle.

  • if it makes the calculation simpler, it's safe to assume the arc is less than or equal to $\frac{\pi}{2}$.

How do I calculate the two control points of the Bezier curve that best fits the arc of the circle from $(x_0, y_0)$ to $(x_1, y_1)$?


Let $(x,y)^R=(-y,x)$ represent rotation by $\pi/2$ counterclockwise and $$ \gamma(t)=(1-t)^3p_0+3t(1-t)^2p_1+3t^2(1-t)p_2+t^3p_3 $$ define a cubic bezier with control points $\{p_0,p_1,p_2,p_3\}$.

Suppose $p_0=(x_0,y_0)$, $p_3=(x_1,y_1)$, and $c=(c_x,c_y)$ are given so that $|p_0-c|=|p_3-c|=r$ ($p_3$ is counterclockwise from $p_0$). Then $p_1=p_0+\alpha(p_0-c)^R$ and $p_2=p_3-\alpha(p_3-c)^R$ where $$ \alpha=\frac43\tan\left(\frac14\cos^{-1}\left(\frac{(p_0-c)\cdot(p_3-c)}{r^2}\right)\right) $$ For a quarter of a circle, $\alpha=\frac43(\sqrt2-1)$, and $\gamma$ is no more than $0.00027$ of the radius of the circle off.

Here is a plot of $\gamma$ in red over the quarter circle in black. We really don't see the circle since it is no more than $0.1$ pixels off from $\gamma$ when the radius is $400$ pixels.

$\hspace{3.5cm}$enter image description here

Computation of $\boldsymbol{\alpha}$

Looking at an arc with an angle of $\theta=\cos^{-1}\left(\frac{(p_0-c)\cdot(p_3-c)}{r^2}\right)$

$\hspace{1.5cm}$enter image description here

we see that the distance from $c$ to the middle of the arc is $$ r\cos(\theta/2)+\frac34\alpha r\sin(\theta/2) $$ we wish to choose $\alpha$ so that this is equal to $r$. Solving for $\alpha$ gives $$ \begin{align} \alpha &=\frac43\frac{1-\cos(\theta/2)}{\sin(\theta/2)}\\ &=\frac43\tan(\theta/4) \end{align} $$

A Slight Improvement

Using a circle of radius $1$, the maximum error in radius produced using $\alpha=\frac43\tan(\theta/4)$ is approximately $$ 0.0741\cos^4(\theta/4)\tan^6(\theta/4) $$ and the error is always positive; that is, the cubic spline never passes inside the circle. Reducing $\alpha$ reduces the midpoint distance by $\frac34\sin(\theta/2)=\frac32\tan(\theta/4)\cos^2(\theta/4)$ times as much, so to distribute the error evenly between the positive and negative, a first guess, assuming that the amplitude of the radius is unchanged, would be to reduce $\alpha$ by $0.0247\cos^2(\theta/4)\tan^5(\theta/4)$.

A bit of investigation shows that, when equalizing the positive and negative swings of the radius, the amplitude increases and that $$ \alpha=\frac43\tan(\theta/4)-0.03552442\cos^2(\theta/4)\tan^5(\theta/4) $$ gives pretty even distribution of the error between positive and negative for $\theta\le\pi/2$. The maximum error, both positive and negative, is approximately $$ 0.0533\cos^4(\theta/4)\tan^6(\theta/4) $$ When $\theta=\pi/2$, this agrees with the article mentioned by bubba in comments.

Note however, that in minimizing the radial error from the circle, the actual variation in radius is increased. Using the simple formula for $\alpha$, which puts the cubic bezier outside the circle, the radius varies by $0.0741\cos^4(\theta/4)\tan^6(\theta/4)$. However, when we minimize the error, the radial variation increases to $0.1066\cos^4(\theta/4)\tan^6(\theta/4)$.

  • $\begingroup$ This is a very good approximation of a circular arc, and it's the one that's most often used. However, it produces a curve that is everywhere outside the true circular arc. You can get a slightly better approximation by reducing the length of $\alpha$. In fact, the error for a unit radius quarter circle is reduced from 0.00027 to 0.00019. The details are here: spencermortensen.com/articles/bezier-circle $\endgroup$ – bubba Jul 22 '14 at 6:09
  • $\begingroup$ @bubba: the image in that article is 72 pixels in radius. Using the $\alpha=\frac43(\sqrt2-1)$ would yield a maximum error of $\frac1{500}$ of a pixel, so I don't think the error from either approximation would be noticeable. $\endgroup$ – robjohn Jul 22 '14 at 17:29
  • 2
    $\begingroup$ Would the downvoter care to comment? $\endgroup$ – robjohn Jul 22 '14 at 19:15
  • $\begingroup$ @bubba: I have added a section in which I adjust $\alpha$ so that the positive and negative errors are equalized. $\endgroup$ – robjohn Jul 23 '14 at 0:03
  • $\begingroup$ Nice. I agree that the accuracy of the original approximation would be fine for almost all applications. To get better approximations, you can apply the same sort of equi-oscillatory construction with higher degree polynomials (though it gets much harder). The accepted answer to this question has the details: math.stackexchange.com/questions/271319/… $\endgroup$ – bubba Jul 23 '14 at 11:03

As a different way to choose where the error falls, one could pick the control points such that the enclosed area matches that of the circle.

If we consider the first quarter of a circle (the same as the first image in the other answer), then the area should be $\pi/4$, so we need the integral

$$ \begin{align} \pi/4 &= \int_{0}^{1} y(t)x'(t)dt \\ &= \int_{0}^{1} ( (1-t)^3 + 3(1-t)^2t + 3(1-t)t^2c )( 3(1-t)^2c + 6(1-t)t(1-c) ) dt \\ &= -\frac{3c^2}{20}+\frac{3c}{5} + \frac12 \\ c &= 2 - \sqrt{\frac13(22-5\pi)} \\ &≈ 0.5517784778... \end{align} $$

That's slightly smaller than the other two answers, as it attempts to even out the error between over- and under-shooting the circle, rather than minimizing the maximum error.

Aside: Edits appreciated to add a solution for angles other than 90°. My maths are rusty.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.