This problem appeared in a coding project im in the middle of and its driving me crazy. The problem is as follows:
Assume there are two circles $c_1$ and $c_2$, with known position vectors $p_1$, $p_2$ known radii $r_1$, $r_2$ and known velocity vectors $v_1$, $v_2$. The velocities and radii do not change. Also assume that these circles are on a collision course. In "frame 1" We know the position, velocity and radii of both circles before collision and in "frame 2" we know the new positions, velocity and radii of both circles after collision. That is, after both circles have clipped into each each other.
Given this information, what is the position of $c_1$ and $c_2$ at the moment the two circles make contact?
In other words, in "frame 1", $\text{dist}(c_1,c_2)>r_1+r_2$ and in "frame 2" $\text{dist}(c_1,c_2)<r_1+r_2$. What are the positions of $c_1$ and $c_2$ such that $\text{dist}(c_1,c_2)=r_1+r_2$?
I have tried using techniques such as parametric equations, related rates problems and good ol vector calculus to try and find a closed form solution but I keep getting stuck. Its frustrating since I feel like all the information I need is right there but I cant quite figure it out. Im uncertain if there is an analytical solution.
$x_i(t) = p_i+v_it,$ $i\in\{1,2\},$ is the position of the center of $c_i$ at time $t.$ We are looking for the smallest value $t$ for which $\|x_1(t)-x_2(t)\|_2=r_1+r_2$ holds. We have $\|x_1(t)-x_2(t)\|_2 = \|p_1-p_2 + (v_1-v_2)\,t\,\|_2=r_1+r_2.$
Squaring both sides: $$ \|v_1-v_2\|^2_2\,\,t^2+2\left\langle v_1-v_2, p_1-p_2\right\rangle t +\|p_1-p_2\|^2_2 = (r_1+r_2)^2 $$ or $$ \|v_1-v_2\|^2_2\,\,t^2+2\left\langle v_1-v_2, p_1-p_2\right\rangle t +\|p_1-p_2\|^2_2 - (r_1+r_2)^2 = 0 $$ This is an ordinary quadratic equation which can be solved with the quadratic formula. $$ t = \frac{-\left\langle v_1-v_2, p_1-p_2\right\rangle \pm\sqrt{\left\langle v_1-v_2, p_1-p_2\right\rangle^2 -\|v_1-v_2\|^2_2\left(\|p_1-p_2\|^2_2 - (r_1+r_2)^2\right)}} {\|v_1-v_2\|^2_2} $$ As we know that the circles are going to collide, we will get two positive real values for $t,$ the smaller of which is the time of the first contact, while the larger one is the time when the circles leave each other after having passed through each other.
Now that we know the time $t_0$ of the collision, we also know the locations of the centers of the circles at that time: $x_i(t_0) = p_i+v_it_0,$ $i\in\{1,2\}.$
In order to get the point of contact $x_c$ on the circumferences of the circles, we have to go $r_1$ "steps" from $x_1(t_0)$ towards $x_2(t_0).$ Therefore $$ x_c = x_1 + r_1\frac{x_2-x_1}{\|x_2-x_1\|} = x_1 + r_1\frac{x_2-x_1}{r_1+r_2} = \frac{r_1x_2+r_2x_1}{r_1+r_2} $$