# Shortest time taken for a targeted object with a set speed to meet a body orbiting in a circle

I'm trying to figure out how to find the optimum point that a ship in 2D space would meet a planet which was orbiting in a perfect circle. The orbit is at a constant rate, and the ship can only move at a set speed.

The idea I had was that if I could calculate the earliest time at which both the planet and the ship were at the same distance from the ship's starting position, I could then figure out where the planet was at that time and point the ship in that direction and it would meet the planet perfectly.

To get the equation for the distance between the planet and the ship's starting point at any one time I took the distance between two points:

$$d = \sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$

Then stuck in the x and y coordinates of the position of the planet using trig:

$$x = \sin\theta+x_p, y = \cos\theta+x_p$$

Then got the angle from the speed of the planet multiplied by the time:

$$d = \sqrt{(\sin(s_pt)r+x_p-x_s)^2+(\cos(s_pt)r+y_p-x_s)^2}$$ Where:

• $d$ is the distance between the planet and the ship's starting position
• $s_p$ is the speed of the planet's orbit in radians/second
• $t$ is the current time in seconds
• $r$ is the radius of the planet's orbit
• $x_p$, $y_p$ are the coordinates of the point the planet orbits around
• $x_s$, $y_s$ are the starting coordinates of the ship

At this point I really didn't know where to go.

For the ship's distance equation, because it travels at a constant speed, I could obviously just use: $$d = s_st$$ Where $s_s$ is the speed of the ship.

If I plot the two equations on a graph, with some dummy values for everything but $d$ and $t$, they intersect.

$$\left\{s_s,s_p,r,x_p,y_p,x_s,y_s\right\}=\left\{30,\frac{1}{10},60,300,147,20,49\right\}$$

I took this to mean that there's definitely going to be a point at which they're both at the same distance from the starting point of the ship at the same time. I remember (a bit hazily) that finding the point that two lines on a graph meet involves simultaneous equations, but I can't for the life of me solve the following for $t$:

$$s_st = \sqrt{(\sin(s_pt)r+x_p-x_s)^2+(\cos(s_pt)r+y_p-x_s)^2}$$

I have a bad feeling that I've gone wrong somewhere along the line and now I'm stuck in a dead-end, although the equation for the planet's distance does put out the right values. Surely there has to be a way to calculate this without drawing it out on a graph and finding the intersection point every time I need to work it out.

• I couldn't insert the image of the graph because I don't have a high enough reputation, so if somebody else could do that for me I'd really appreciate it. – Craig Johnston Mar 30 '13 at 11:59
• Unfortunately your image does not show a two-dimensional situation. It's unclear where the starting point of the ship lies, and whether we may choose the direction of the ship freely. – Christian Blatter Mar 30 '13 at 12:07
• Hmm, I'm a bit out of my depth here so I'm not completely sure what you mean. For what I'm doing, this calculation just needs to find a time at which the planet and the ship are both at the same distance from the starting point of the ship. It'd be performed before the ship started moving. – Craig Johnston Mar 30 '13 at 12:14
• I should probably point out that I'm doing this for a game that I'm making. The player tells the ship to travel to a particular planet, and so before the ship begins moving it needs to work out exactly where it's going to aim for. There isn't any gravity simulation, so it's just a case of figuring out where the planet is going to be when it gets there. So the ship needs to aim for the position of the planet at the point in time at which the planet and the ship are both the same distance from the ship's starting point, which is at the intersection on the graph. – Craig Johnston Mar 30 '13 at 12:24