I have two quadratic bezier curves and I want to find whether they have a common tangent, and if so where it is.
If the first bezier is defined by points $(x_1, y_1)$, $(x_2, y_2)$, $(x_3, y_3)$, then the points on the curve have coordinates:
$x = (x_1 - 2x_2 + x_3)t^2 + (2x_2 - 2x_1)t + x_1 \\ y = (y_1 - 2y_2 + y_3)t^2 + (2y_2 - 2y_1)t + y_1$
Or to simplify things:
$x = A_xt^2 + B_xt + C_x \\ y = A_yt^2 + B_yt + C_y$
Likewise, I can get an equation for the second bezier:
$x = D_xs^2 + E_xs + F_x \\ y = D_ys^2 + E_ys + F_y$
The gradient of the tangent, $m$, to the first curve at $t$ is $\dfrac{2A_yt + B_y}{2A_xt + B_x}$,
which must be equal to the tangent to the second curve at $s$, $\dfrac{2D_ys + E_y}{2D_xs + E_x}$.
So $m = \dfrac{2A_yt + B_y}{2A_xt + B_x} = \dfrac{2D_ys + E_y}{2D_xs + E_x}$
Which I rearranged to get:
$t = \dfrac{2(B_yD_x - D_yB_x)s + B_yE_x - B_xE_y}{4(A_xD_y - A_yD_x)s + 2(A_xE_y - A_yE_x)}$
The gradient of the tangent is also equal to the difference in the y-coordinates over the difference in x-coordinates:
$m = \dfrac{D_ys^2 + E_ys + F_y - (A_yt^2 + B_yt + C_y)}{D_xs^2 + E_xs + F_x - (A_xt^2 + B_xt + C_x)}$
But that's as far as I got. The algebra looks too messy from here. Can anyone solve this, or is there a better approach?