Here's part of a solution. I didn't get to finish it in time. I'll try again later.
If I understand correctly, you have a planet's position & velocity, as well as a ship's position and speed. You want to get the ship's movement direction. I'm assuming the ship's and planet's speeds are constant. I also assume, without loss of generality, that the ship is at (0,0)\$(0,0)\$; to do this, subtract the ship's position from the planet's, and add the ship's position back onto the result of the operation described below.
Unfortunately, without latex, I can't format this answer very well, but we'll attempt to make do. Let:
s_s
\$s_s\$ = the ship's speed (s_s.x, s_s.y\$s_s.x, s_s.y\$, likewise)s_a
\$s_a\$ = the ship's bearing (angle of movement, what we want to calculate)p_p
\$p_p\$ = the planet's initial position, global coordsp_r
\$p_r\$ = the planet's distance (radius) from the center of orbit, derivable fromp_p
\$p_p\$p_a
\$p_a\$ = the planet's initial angle in radians, relative to the center of orbitp_s
\$p_s\$ = the planet's angular velocity (rad/sec)t
\$t\$ = the time to collision (this turns out to be something we must calculate as well)
Here's the equations for the position of the two bodies, broken down into components: $$ ship.x = s_s.x * t * cos(s_a) $$ $$ ship.y = s_s.y * t * sin(s_a) $$ $$ planet.x = p_r * cos(p_a + p_s * t) + p_p.x $$ $$ planet.y = p_r * sin(p_a + p_s * t) + p_p.y $$
ship.x = s_s.x * t * cos(s_a)
ship.y = s_s.y * t * sin(s_a)
planet.x = p_r * cos(p_a + p_s * t) + p_p.x
planet.y = p_r * sin(p_a + p_s * t) + p_p.y
Since we want ship.x = planet.x
\$ship.x = planet.x\$ and ship.y = planet.y
\$ship.y = planet.y\$ at some instant t
\$t\$, we obtain this equation (the y
\$y\$ case is nearly symmetrical):
s_s.x * t * cos(s_a) = p_r * cos(p_a + p_s * t) + p_p.x
s_s.y * t * sin(s_a) = p_r * sin(p_a + p_s * t) + p_p.y
$$ s_s.x * t * cos(s_a) = p_r * cos(p_a + p_s * t) + p_p.x $$ $$ s_s.y * t * sin(s_a) = p_r * sin(p_a + p_s * t) + p_p.y $$
Solving the top equation for s_a\$s_a\$:
s_s.x * t * cos(s_a) = p_r * cos(p_a + p_s * t) + p_p.x
=> s_a = arccos((p_r * cos(p_a + p_s * t) + p_p.x) / (s_s.x * t))
$$ s_s.x * t * cos(s_a) = p_r * cos(p_a + p_s * t) + p_p.x \\ \implies s_a = \frac{arccos((p_r * cos(p_a + p_s * t) + p_p.x)}{(s_s.x * t))}$$
Substituting this into the second equation results in a fairly terrifying equation that Wolfram alpha won't solve for me. There may be a better way to do this not involving polar coordinates. If anyone wants to give this method a shot, you're welcome to it; I've made this a wiki. Otherwise, you may want to take this to the Math StackExchange.