That is the math behind interpolating circle using Bezier curve

bezier-curve

This is a basic circle build by a graphic editor using Bézier spline. The X here is 0.552125R:

enter image description here

But how this value had been gotten? I mean reverse engineering, the mathematical equation which results to this value

Best Answer

Suppose we have a smooth function $$\begin{align} f: [t_0, t_1] &\;\to\; \Bbb R^2 \\ t &\;\mapsto\; (x(t),\,y(t)) \\ \end{align}$$ that we want to approximate by means of a cubic Bézier curve $b=b_{[P0,P1,P2,P3]}$ where the $P_i$ are the so called control points:

$$\begin{align} b(t) &= (1-t)^3 P_0 + 3(1-t)^2t P_1 + 3(1-t)t^2 P_2 + t^3 P_3 \end{align}$$

A reasonable choice for the control points is then:

$$\begin{align} P_0 &= f_0\\ P_1 &= f_0 + \alpha \cdot \dot f_0\\ P_2 &= f_1 - \beta \cdot \dot f_1\\ P_3 &= f_1\\ \end{align}$$ where $f_i = f(t_i)$ and similar notation for the derivatives.

  • The 1st and 4th equation mean that $b$ and $f$ have the same starting point and the same end point.

  • The 2nd and 3rd equation mean that $b$ is tangent to $f$ in the starting point and in the end point.

This means we have still a 2-dimensional space from which we can chose $b$, which is parameterized by the two parameters $\alpha$ and $\beta$. Now there are different approaches to narrow down these two parameters; one of which is to pick a point $Q\in f$ and require $b$ to run through $Q$.

The usual parametrization of the unit circle is $f(t) = (\cos t, \sin t)$ which traverses the circle at constant speed. So we chose $Q = f(t_{1/2}) = (1,1)/\sqrt{2}$.

Adding the requirement that $Q = f_t \stackrel!= b(t)$ to the 4 conditions from above yields the following linear system for $\alpha$ and $\beta$:

$$\begin{align} &\binom{x_t-x_0}{y_t-y_0} + (2t^3-3t^2)\binom{x_1-x_0}{y_1-y_0} \\&\qquad\qquad= 3t(1-t)\binom{(1-t) \dot x_0 \quad -t \dot x_1}{(1-t) \dot y_0 \quad -t \dot y_1}\binom \alpha\beta \end{align}$$

Solving that system is straight forward, and with $t = 1/2$ the solution reads $$ \binom \alpha\beta = \frac 43\, \frac{1}{\dot x_1\dot y_0 - \dot x_0\dot y_1} \binom{\dot y_1 \quad -\dot x_1}{\dot y_0 \quad -\dot x_0} \binom{x_0+x_1-2x_{1/2}}{y_0+y_1-2y_{1/2}} $$ Plugging in values according to $f$ being a quarter of the unit circle, finally yields

$$ \alpha=\beta=\frac43(\sqrt2-1) \approx 0.55228475 $$

which is what you found by reverse engineering.


Notice: As I said above, there is more than one way to approach this. A different way would be to require that the distance between $f$ and $b$ be minimal, like

$$ \max_t |f(t)-b(t)| \stackrel!= \text{minimal} $$ One problem is that $f$ and $b$ are traversed at diferent speeds, so that the $b$ you'll get from this is not the best one. Anyway, with almost certainty you'll get different control points $P_1$ and $P_2$ an thus a different value for your $x$.

Related Question