I am trying to find the tangent that is common to two quadratic Bezier curves.
Concretely, I want to draw the corner of a bending piece of paper, like this:
Theoretically it looks simple: Given a Bezier curve $B$ through points $P_0$, $P_1$ and $P_2$, and another one $G$ though $Q_0$, $Q_1$, $Q_2$, i.e.: $$ B(t) = (1-t)^2P_0 + 2t(1-t)P_1 + t^2P_2 $$$$ G(r) = (1-r)^2Q_0 + 2r(1-r)Q_1 + r^2Q_2 $$$$ 0 \leq t, r \leq 1 $$ , I am looking for a solution $(r,t)$ of this system: $$ B'(t) \cdot G'(r) = 0 $$$$ (G(r) - B(t)) = \lambda B'(t) $$ , that is: the tangent vectors are parallel and the vector between the tangent points is on the tangent.
I first spent a couple hours on paper isolating $r$ in the first and substituting in the second, but I gave up given the number of terms that came up. Then I used Maple to help me do the calculation, and even it cannot tract it. I found answers online that gave roughly the same idea that I have here, but no calculation is ever done.
My question: It there a more clever way to approach the problem, any transformation that would make the algebra simpler?
N.B.
- A numeric approximation is enough for my application. I tried a Taylor expansion in Maple, with no success.
- I am actually interested in an application where $P_2 = Q_0$, not sure if it really matters.
- I am interested in other ways to draw what I want, but I spent so much time trying to solve the equations above that now I'd like to see a math solution anyway.