# Minimal rotation to avoid collision of circles

The discriminant of a certain quadratic equation which determines when two circles (hyperspheres?) will collide, provided they travel with a constant velocity is

$$(\Delta v\cdot\Delta s)^2-(\Delta v\cdot\Delta v)\times(\Delta s\cdot\Delta s-r^2)$$

where $\Delta v$ is the difference in the velocities of two circles, $\Delta s$ is the difference of their positions, and $r$ is the sum of their radii. What is the minimal rotation of $\Delta v$ that will make this discriminant negative, and therefore avoid the collision of the circles?

I have spent many, many hours trying to massage the above into various mathematical packages, and I've received many incomprehensible multi-screen equations and many useless results with $cos(\theta)$ and $sin(\theta)$ on both sides, which I could not resolve.

Any suggestions would be nice, a numerical solution would also suffice.

-
Could be simplified by doing the following: (1) place the coordinate origin $O$ into the center of the first sphere, thus making it fixed; (2) notice that the collision happens exactly when the center $C$ of second sphere enters $2r$-neighborhood of $O$; (3) notice that the problem is essentially 2-dimensional since everything happens in the plane that contains the trajectory of $C$. Now it's a trigonometric exercise which @mjqxxxx did for you... without getting an upvote or acceptance of the answer, I might add. –  user31373 Sep 10 '12 at 1:14
That's already done, hence $\Delta v$ and $\Delta s$. Also, re: @mjqxxxx's answer: I'm still experimenting with it. I'll upvote and accept it as soon as I can confirm there aren't any unforeseen issues (I think another edit might be necessary, I seem to be running into some trouble). –  Electro Sep 10 '12 at 8:35

You have the discriminant as $$(\Delta v\cdot \Delta s)^2 - (\Delta v \cdot \Delta v)(\Delta s\cdot \Delta s - r^2) = |\Delta v|^2 |\Delta s|^2\left(\cos^2\theta-1+\frac{r^2}{|\Delta s|^2}\right),$$ where $\cos\theta=(\Delta v \cdot \Delta s)/(|\Delta v||\Delta s|)$. To make this negative, you need to have $\left\lvert\cos\theta\right\rvert<\sqrt{1-r^2/|\Delta s|^2}$, or $-\cos^{-1}(\sqrt{1-r^2/|\Delta s|^2}) < \theta < \cos^{-1}(\sqrt{1-r^2/|\Delta s|^2})$. If this does not already hold, then the minimal rotation to do it will be a rotation of $\Delta v$ in the plane containing both $\Delta v$ and $\Delta s$, by an angle $\left\lvert\theta\right\rvert - \cos^{-1}(\sqrt{1-r^2/|\Delta s|^2})=\left\lvert\theta\right\rvert - \sin^{-1}(r/|\Delta s|)$.
Er, don't you mean $|\Delta v|^2 |\Delta s|^2\left(\cos^2\theta-\frac{|\Delta s|^2-r^2}{|\Delta s|^2}\right)=|\Delta v|^2 |\Delta s|^2\left(\cos^2\theta-1+\frac{|r^2}{|\Delta s|^2}\right)$? –  Electro Aug 31 '12 at 19:23