Approximating Ellipse Orbits with Newton's Law

AI Thread Summary
To approximate the ellipse of an object's orbit using Newton's law of universal gravitation, one can calculate the orbital energy using the object's speed, distance from the primary, and the primary's mass. The formula for orbital energy is E = mv²/2 - GMm/d, where G is the gravitational constant. This energy can also be expressed as E = -GMm/2a, with 'a' representing the semi-major axis. By solving the first equation for energy and substituting it into the second, the semi-major axis can be determined. This approach allows for accurate simulation of orbits in a 2D space game.
Chetic
Messages
8
Reaction score
0
How do you approximate the ellipse of an object's orbit using Newton's law of universal gravitation?
I'm working on a 2D space game and that's pretty much the only physics I use, so no other forces to consider.
 
Astronomy news on Phys.org
We need more information to be able to help you.

Do you want to simulate the orbit of a body based on its position and velocity? Do you just want to plot random orbits? In which case it would be easier to base it on eccentricity and period.

Can the orbits change and what sort of events cause the orbits to change? Application of an impulse, new velocity, new eccentricity, etc.
 
Sorry, I didn't realize.
I'm simulating the orbit of bodies based on position and velocity vectors.
The only orbit that's really interesting is the player's. The player will want to have an idea of where he is going. All I really need is how to calculate the ellipse of a two-body system.

The player can of course use thrusters to alter his orbit but surely that can simply be recalculated after the end of the impulse?

I have access to all variables involved, and I can even simulate ahead any number of steps (though as few as possible would be preferred)
 
I'm going to try running the simulation 5 steps ahead, collecting positions, and solve for a conic section.
 
You can definitely solve for the orbital elements exactly with only a single point location and velocity. I don't have my orbital mechanics textbook with me right now, so I can't look up the formulas (and I haven't used them in a while, so I don't remember for sure), but it's definitely doable.
 
Okay, forget what I said.

I've managed to calculate the eccentricity vector, which now always points towards apoapsis (with the length of the eccentricity of the orbit).
How do I calculate the semi major axis? Or something else that gives me the rest of the information I need to draw the ellipse.
 
Chetic said:
Okay, forget what I said.

I've managed to calculate the eccentricity vector, which now always points towards apoapsis (with the length of the eccentricity of the orbit).
How do I calculate the semi major axis? Or something else that gives me the rest of the information I need to draw the ellipse.

That's pretty easy. You use orbital energy.

Given that you know the orbiting object's speed and distance from the primary, and the mass of the Primary, you can find its orbital energy by:

E = \frac{mv^2}{2}-\frac{GMm}{d}

Where m is the mass of the object, v its speed, d its distance from the primary, M the mass of the primary and G the gravitational constant.

It also turns out the the orbital energy is equal to


E= -\frac{GMm}{2a}

Where 'a' is the length of the semi-major axis.

So if you can solve the first equation, you can plug this into the second one and solve for 'a'
 
Back
Top