TITLE: Calculate control points of cubic bezier curve approximating a part of a circle
QUESTION [6 upvotes]: I'm not mathematically inclined, so please be patient with my question.
Given 

$(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)$?

REPLY [2 votes]: 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.