I've been trying to derive an equation for this for a while now, but I haven't had much success.

Let us set up the equation. There is a star with mass $M$ and a planet that is distance $d$ from the star. Let us assume there are no other objects around that can cause perturbation. What I want to know is the velocity $v$ that is required for the planet to pass through a desired point $P$ in its orbit, assuming trajectory angle $a$.

I am creating a simulation game where you fling planets around, and I want to be able to calculate the velocity necessary to hit certain points.

For example, let us assume:

Sun mass = 1,000,000 kg
Sun x = 0 km
Sun y = 0 km
Planet x = 500 km
Planet y = 0 km
Planet x speed = 0 km/s
Planet y speed = ??? km/s
Desired point x = -1000 km
Desired point y = 0 km

What I would want to find out is what the y speed would need to be in order for the planet to pass through the desired point. This particular example would result in a planetary orbit with a semi-major axis that is 2 times the semi-minor axis.

I would want to be able to do this based on the angle of the planet's initial velocity. And I would want to know when it's not possible. (for example, trying to have the planet pass through a point on the opposite side of the star by moving directly towards or away from the star)

How can I do these calculations?

I would also like to be able to derive a similar equation, where I have a fixed speed and am able to calculate the required angle to pass through a certain point, if possible. This should hopefully be possible by solving for the angle from the equation I'm looking for.

I have experimented with a 90 degree trajectory only, and tried finding a formula based upon the orbital speed calculation for a perfectly circular orbit, but I haven't had any luck. I have, however, been able to confirm that the maximum distance the planet travels approaches infinity as the planet's speed approaches its escape velocity.

NOTE: Please do not just throw an equation at me; I would like to know how the equation was derived. For example, if an orbital speed equation was used, please explain how.

Here are some equations I've been looking into, but I'm not sure how or if I need to use them to derive the equation I'm looking for:

  • $\begingroup$ Try Kepler's Laws. Better yet, find a resource on the web or a book on celestial mechanics - really depends upon how many bodies and if you're trying to simulate celestial motion, etc. $\endgroup$ Commented Dec 31, 2019 at 0:46

2 Answers 2


I believe this problem can be tackled using polar coordinates. The equation of an conic in these coordinate is:

$$r(\theta) = \frac{r_0}{1+e \cos (\theta + \phi)},$$

where $r$ is the distance to one of the foci of the ellipse (the center of mass of the system, or the center of the star if it is much more massive than the orbiting object), $e$ is the excentricity and $\theta$ is chosen for instance so that $\theta = 0$ for your initial position (not necessarily one of the axis of the ellipse). For $e < 1$, the trajectory is closed and corresponds to an ellipse. When $e \geq 1$, the planet escapes to infinity (parabole or hyperbole), but I think that the following stays true (you just have to be careful about the allowed $\theta$'s).

Now what you need to do is convert your "target" from $x$, $y$ coordinates to $r_{\mathrm{target}}$, $\theta_{\mathrm{target}}$. Then you need to find the relation between your initial angle $\alpha$ (fixed), initial velocity $v_0$ with $r_0$, $e$ and $\phi$. I have not worked out the details but I assume this can be done using the definition of excentricity and inverse trigonometric functions. I will try to look into it. Now that you have $r_0(\alpha, v_0)$, $e(\alpha, v_0)$ and $\phi(\alpha, v_0)$, you can just inject into the ellipse equation and look at $\theta = \theta_{\mathrm{target}}$. You need that

$$r_{\mathrm{target}} = r(\alpha, v_0, \theta = \theta_{\mathrm{target}}) = \frac{r_0(\alpha, v_0)}{1 + e(\alpha, v_0) \cos(\theta_{\mathrm{target}} + \phi(\alpha, v_0))}.$$

I do not know if this is the easiest way to do it, but I believe it can be done nonetheless.

If you want to check if a solution exists, you need to wonder what happens if, given an angle, you increase progressively the velocity. For low velocities, you effectively fall rapidly towards the star. For very large velocity, you go through a more and more elongated ellipse. If you go beyond the escape velocity, you will not follow a closed trajectory anymore but escape to infinity (parabole or hyperbole). If your velocity becomes infinite, you basically go into a straight line. For all the velocities in between, you basically span all the half-plane separated by a straight line passing through your initial position and parallel to your initial velocity, and containing the star.

Accessible positions

On the above picture, the green part of the plane are the accessible positions. You see for instance that if you would want to hit the target shown here, you would need a velocity $v_0$ between the one represented in blue (ellipse) and the one represented in red (hyperbole). The red part of the picture, on the other hand, correspond to the points that cannot be accessed using this value of $\alpha$.

If you do find a solution and want to check whether or not you would go through the star at some point, you just need to check if the minimal distance which is $r_0/(1+e)$ is larger or smaller than the radius of the star (assuming the star is very massive and the foci of the ellipse are merged with the center of the star).

Hope this helps!

Preliminary calculations :

the eccentricity is defined as :

$$e = \sqrt{1 + \frac{2 \varepsilon h^{2}}{\mu^2}},$$

where $\varepsilon$ is the specific orbital energy (total energy divided by the reduced mass), $\mu$ the standard gravitational parameter based on the total mass, and $h$ the specific relative angular momentum (angular momentum divided by the reduced mass) (-> https://en.wikipedia.org/wiki/Orbital_eccentricity).

Assuming a large star mass so that the reduced mass $\mu$ is just the mass of the planet $m$ and the total mass is roughly the mass of the star $M$, you find:

$$e = \sqrt{1 + \frac{2 (v_0^2 - \frac{2GM}{d}) d^2 v_0^2 \cos^2 (\alpha)}{G^2 M^2}},$$

where $d$ is the distance from the star to the planet initially, and $\alpha$ is defined so that $\alpha = 0$ if the velocity is purely radial initially. By the way, this gives you a second order equation in $v_0^2$, which allows you to invert it (although I am not sure if you want to invert the equation at this point...).

Then, to find $\phi$, you can use the Laplace-Runge-Lenz vector (https://en.wikipedia.org/wiki/Laplace%E2%80%93Runge%E2%80%93Lenz_vector), defined as $\overrightarrow{A} = \overrightarrow{p} \times \overrightarrow{L} - GMm^2 \overrightarrow{e_r}$, which indicates the direction for which $\theta + \phi = 0$. If you choose your x-axis to line up with your initial position, you find that $\overrightarrow{A} = m^2 v_0^2 d (\cos^2(\alpha) \overrightarrow{e_x} + \cos(\alpha) \sin(\alpha) \overrightarrow{e_y}) - GMm^2 \overrightarrow{e_x}$ (please check again). From this you should be able to find $\phi$ and then $r_0$. Good luck!


I think the issue you're running into here is that there isn't a single vector describing the inertial path between different points in space, but infinitely many. The reason for this is that you can approach this point at any time you'd like.

To simplify, consider the case of a baseball you want to throw from point A to B in a linearly uniform gravitational field. We don't care about the velocity it has when it reaches point B, or what time it gets there, just that it shows up there at some time.

In one scenario we could lob the baseball very high in the air, so that it reached a maximum altitude nearly midway between the pitcher and the point we want to hit, and it would cross that point several seconds later moving almost straight downward.

We could also fire the ball like a bullet, using a very low launch angle where the maximum height of the ball would be reached well after the ball crossed the point we intended it to, so that the ball would cross that point with it's vector of motion pointing nearly entirely along the horizontal.

Between these extremes, we could launch the ball with any angle assuming we used exactly the right velocity to make it cross the intended point.

So I think your approach should be to look for an equation relating the angle and velocity the planet should have in order to reach the desired point.

  • $\begingroup$ Yes, but the angle is a fixed value in my scenario. I want to calculate the speed. $\endgroup$
    – overlord
    Commented Dec 31, 2019 at 0:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.