Curve through midpoints of the largest circles between two curves I have two continuous differentiable curves in the interval $0 \leq x \leq 105$. I would like to fit the largest possible circle between the two curves for every x-value and make a curve through the center points.
This figure shows an approximation of what I am trying to accomplish.
I have tried to fit a circle for one x-value, but even this is trickier than I first thought.
The distance from one point to another is $d=\sqrt{(x_2-x_1)^2+(g(x_2)-f(x_1))^2}$.
By differentiating this, setting it equal to zero and solving for $x_2$, I am able to find the shortest distance from $x_1$ to $g(x)$. However, the problem with this is, that the circle might not be tangent to the curves at both these points. I really don't know how to proceed from here.
Any help is appreciated.
 A: You may want to look into parallel curves. Let $P_f(a,t)=\bigl(X_f(a,t),Y_f(a,t)\bigr)$ resp. $P_g(a,t)=\bigl(X_g(a,t),Y_g(a,t)\bigr)$ be parametric expressions for parallel curves to $f$ resp. $g$ at symbolic oriented distance $a$.
Now consider the set of equations
$$X_f(a,t_1)=x\quad\text{and}\quad X_g(-a,t_2)=x\quad\text{and}\quad
Y_f(a,t_1)=y\quad\text{and}\quad Y_g(-a,t_2)=y$$
If you manage to eliminate the three variables $a,t_1,t_2$ from those four
equations, you are left with one equation involving only $x$ and $y$.
That equation implicitly describes the curve you are after.
Even for nice enough (algebraic, low-degree) $f$ and $g$,
this will probably require the assistance of a computer algebra system.
Update: I tried that for two parabolas $f(t)=2t^2-1$ and $g(t)=1-t^2$.
The result is a product of four polynomial expressions in $x,y$,
corresponding to the possible choices of sides relative to $f$ and $g$.
Each polynomial has degree $13$ in $y$ and degree $12$ in $x$ and a combined
degree of $15$, with coefficients up to 14 digits long.
This approach seems unpractical.
If a numerical approximation is satisfactory, Rahul's comment proposing
the use of Voronoi diagrams seems much more feasible.
