# Solving "when are these two exponential trajectories exactly distance ... apart"

I have two exponential functions related to a physics problem where two circles with same radius $$r$$ that are subject to non-linear drag travel with velocities $$v_1=\{x_1,y_1\}$$ and $$v_2=\{x_2,y_2\}$$, starting at positions $$p_1$$ and $$p_2$$ at time $$t=0$$:

\begin{aligned} \textit{position}_1(t)&=\vec{p}_1 + \frac{\vec{v}_1 a^t - \vec{v}_1}{\ln a} \\ \textit{position}_2(t)&=\vec{p}_2 + \frac{\vec{v}_2 a^t - \vec{v}_2}{\ln a} \end{aligned}

with these positions derived from the velocity function $$\textit{velocity}(t) = \vec{v}_{...~}a^t$$, with $$0 effecting the exponentially increasing decelleration.

I'm now trying to determine the time when two circles collide, i.e. when the distance between these functions is the sum of the radii of the circles, which in this case is $$2r$$ as both circles are the same size:

$$\begin{array} \textit{distance}(t) = \lVert \textit{position}_2(t) - \textit{position}_1(t) \rVert = 2r \end{array}$$

And I'm kinda stuck: I know all the vectors, the decelleration, and the radius, I know how to rule out the "there is no intersection" cases based on the fact that for both circles the maximum distance that can be travelled is $$\frac{-v_{...}}{\ln a}$$ and so the line segments defined by these formulae run from $$\vec{p}_1$$ to $$\left( \vec{p}_1 - \frac{\vec{v}_1}{\ln a} \right)$$ and $$\vec{p}_2$$ to $$\left( \vec{p}_2 - \frac{\vec{v}_2}{\ln a} \right)$$ respectively. I can shortcut on whether or not there is a line/line intersection using those four points and some geometry, and if there isn't one, done: nothing to do further. However, if there is an intersection then all that tells me is that they might collide somewhere in the "lozenge" that both circles pass through:

In this, $$\alpha$$ is the angle between the two trajectories, and knowing $$m \pm 2b$$ lets me find the time-for-distance when each circle enters/leaves the intersection using:

$$\begin{array} \textit{time}_n(d) = \frac{1 + \frac{d_n}{v_n} \ln a}{\ln a} \end{array}$$

(which has no solution if $$d_n > \frac{-v_n}{\ln a}$$)

I can fairly easily check at which times each circle enters/leaves the intersection (if they leave it all, given the maximum distance each can travel) but finding the exact times (because there might be two even if I'm only interested in the earlier of the two) at which they collide in a symbolic way is eluding me. How do I tackle this problem?

I can trivially binary-search my way to victory by using the earliest/latest times the circles enter and leave the area of potential collision as initial floor/ceiling values but it would be so much nicer not to have to do that...

• Equation $(\textit{position}_2(t) - \textit{position}_1(t) )^2 = 4r^2$ is quadratic in $x={a^t-1\over\log a}$ and can be solved. Commented Jun 4, 2022 at 21:52
• So it is, and I really need some help with that. I know it can be solved, and I can intuit that it's quadratic (after all, we have two roots), but it's the part that gets me to that solution that eludes me. (so an answer, even if it feels being overly descriptive to the point of explaining elementary steps, would be immensely appreciated) Commented Jun 4, 2022 at 22:12

Let's introduce a new variable: $$x={a^t-1\over\ln a}.$$ We have then: \begin{aligned} \textit{position}_1(t)&=\vec{p}_1 + x\vec{v}_1 \\ \textit{position}_2(t)&=\vec{p}_2 + x\vec{v}_2 \end{aligned} and the collision equation $$\lVert \textit{position}_2(t) - \textit{position}_1(t) \rVert^2 = 4r^2$$ becomes: $$\lVert(\vec{p}_2-\vec{p}_1)+x(\vec{v}_2-\vec{v}_1)\rVert^2 = 4r^2,$$ that is $$(\vec{p}_2-\vec{p}_1)^2+2(\vec{p}_2-\vec{p}_1)\cdot(\vec{v}_2-\vec{v}_1)x+(\vec{v}_2-\vec{v}_1)^2x^2 = 4r^2,$$ where $$\cdot$$ denotes the scalar product of two vectors. This is a quadratic equation in $$x$$ which can be solved: $$x={-(\vec{p}_2-\vec{p}_1)\cdot(\vec{v}_2-\vec{v}_1) \pm\sqrt{[(\vec{p}_2-\vec{p}_1)\cdot(\vec{v}_2-\vec{v}_1)]^2 -(\vec{v}_2-\vec{v}_1)^2[(\vec{p}_2-\vec{p}_1)^2-4r^2]} \over(\vec{v}_2-\vec{v}_1)^2}.$$ Once the values of $$x$$ have been found (if real solutions exist, of course) we can plug them into the definition of $$x$$ and solve for $$t$$: $$t={\ln(1+x\ln a)\over\ln a}.$$ Of course a solution for $$t$$ might not exist, or it may be negative.