Convert quadratic bezier curve to parabola
A quadratic Bézier curve is a segment of a parabola. If the $3$ control points and the quadratic Bézier curve are known, how do you calculate the equation of the parabola (which is an $y=f(x)$ function) that this Bézier curve is a part of? (algebraically)
So in the image, the red curve is known, how do you find the equation $y=ax^{2}+bx+c$ for the black curve?
This is accidentally a special case because the control polygon is a horizontal & a vertical segment, but a general solution can be worked out I hope.
It's actually the opposite direction of this question.
Solution 1:
In Theorem $3.4$ of this paper, a more general algorithm for finding the the conic associated with a rational quadatic spline is derived. Specialized for non-rational quadratic splines and parabolas, we get the equation for the parabola $$ \begin{bmatrix}x&y&1\end{bmatrix}Q\begin{bmatrix}x\\y\\1\end{bmatrix}=0 $$ where $$ Q=2\left(uw^T+wu^T\right)-vv^T $$ and, using $a=p_0$, $b=p_1$, and $c=p_2$, $$ u=\begin{bmatrix}b_y-c_y\\c_x-b_x\\b_xc_y-b_yc_x\end{bmatrix}\\ v=\begin{bmatrix}c_y-a_y\\a_x-c_x\\c_xa_y-c_ya_x\end{bmatrix}\\ w=\begin{bmatrix}a_y-b_y\\b_x-a_x\\a_xb_y-a_yb_x\end{bmatrix} $$
Solution 2:
If your quadratic Bezier curve is indeed a segment between $[x_1, x_3]$ of function $f(x)=ax^2+bx+c$, then there must be a relationship between the three control points as
$P_1=(x_1,y_1)=(x_1,f(x_1))$
$P_2=(x_2, y_2)=(\frac{x_1+x_3}{2}, \frac{x_3-x_1}{2}(2ax_1+b)+y_1)$
$P_3=(x_3,y_3)=(x_3,f(x_3))$.
Although all quadric Bezier curve is part of a certain parabola, not all parabola can be represented as $f(x)=ax^2+bx+c$ (for example, the black curve shown in your picture). So, the first thing you need to do is check if $x_2 =\frac{x_1+x_3}{2}$. If this check fails, then your quadratic Bezier curve is not a segment of $f(x)=ax^2+bx+c$.
Now, we can try to find the values of $a$ and $b$ from the facts that
$\frac{y_2-y_1}{x_2-x_1}=f'(x_1)=2ax_1+b$,
$\frac{y_3-y_2}{x_3-x_2}=f'(x_3)=2ax_3+b$
After some algebra, we can find
$a=\frac{y_1-2y_2+y_3}{(x_3-x_1)^2}$
$b=\frac{2}{(x_3-x_1)^2}[x_3(y_2-y_1)+x_1(y_2-y_3)]$
and you can find $c$ easily with known $a$ and $b$.