# Calculating at what time and at what angle two objects will cross around a circle

I'm trying to calculate the times and the angles (the red 'X') at which two objects 'A' (the blue dot) and 'B' (the red dot) that are travelling around a circle and start at different speeds and different angles will meet.

I had help creating an animated Geogebra file below, but I'm still having trouble converting the Geogebra functions into equations that I can then convert into octave m code, which is similar to matlab m code. • change coordinate system to the one associated with object A. Calculate relative angular velocity of B. Time to collision will be angle between A and B divided by relative angular velocity of B. Oct 25 '19 at 10:46

Although the graph at the bottom of your figure (showing the position of the dots as functions of time) is composed of many separate linear pieces between $$0$$ and $$360$$ degrees, you could model the position of each dot as a continuous function:

\begin{align} \text{angle}_A &= \text{start}_A + \omega_A t, \\ \text{angle}_B &= \text{start}_B + \omega_B t. \end{align}

Notice that this does nothing to constrain the angles to remain in any particular range of angles, in fact, one of the angles will increase without bound and the other will decrease to negative values without bound as time passes.

Now instead of looking for times when the angles are equal, you look for when they differ by a multiple of $$360$$ degrees. That is, you solve equations like

\begin{align} \text{start}_A + \omega_A t &= \text{start}_B + \omega_B t, \\ \text{start}_A + \omega_A t &= \text{start}_B + \omega_B t + 360^\circ, \\ \text{start}_A + \omega_A t &= \text{start}_B + \omega_B t + 720^\circ, \\ \text{start}_A + \omega_A t &= \text{start}_B + \omega_B t + 1080^\circ, \\ \end{align}

and so forth. This gives you a sequence of values of $$t$$ that are times when the dots meet. You should be able to show easily that the times are in an arithmetic sequence, so you can summarize all the meeting times with a simple equation like

$$t_n = t_0 + n (t_1 - t_0)$$

where $$t_0$$ is one of the meeting times, $$t_1$$ is the next meeting time, and $$t_n$$ is the $$n$$th meeting time after $$t_0.$$

Once you know when the dots meet you can easily find where they will meet by taking the equation for either $$\text{angle}_A$$ or $$\text{angle}_B,$$ plugging in one of the meeting times $$t_n,$$ and then adding or subtracting a multiple of $$360$$ degrees to find the location on the circle.

Let $$\theta_a(t)$$ and $$\theta_b(t)$$ be their angular positions as functions of time $$t$$, respectively. Then,

$$\theta_a(t)=\theta_a(0)+w_at$$ $$\theta_b(t)=\theta_b(0)-w_bt$$

where $$w_a$$ and $$w_b$$ are their angle speeds. Note that $$-w_b$$ is used due to movement in the opposite direction.

When the objects meet, their angular displacements differ by full circles, i.e.

$$\theta_a(t_k)-\theta_b(t_k)=2\pi k$$

with $$k$$ being integers. Then, solve the joint equations above to obtain their meeting times

$$t_k = \frac{2\pi k -\theta_a(0)+ \theta_b(0)}{w_a+w_b}$$

and the corresponding meeting angles

$$\theta_k = \frac{2\pi k w_a +w_b\theta_a(0)+ w_a\theta_b(0)}{w_a+w_b}$$