Speaking of this. I HAVE SO MANY MATH QUESTIONS.
1- Does anyone here know how to calculate the speed change of a satellite as its rising from his perigee to the apogee within elliptical orbit? I know the speed change is exponential, but how do you calculate it?
2- How do you predict when two spacecrafts will meet at their respective closest encounters in any kind of orbit? I remember in Primary school, there's this math question where you got three guys who come to the library at different time intervals, and you find out when they'll meet by adding up the time intervals until you get the same number, add said number to the starting date, and there's your encounter.
But satellites? Different orbital planes? How? HOW?
3- Finally. Why. In the name of the emperor's mummified testicles, are afterburner calculations SO MUCH more complicated than the FHACKING jet engine itself????? ITS LITERALLY JUST A BLAST FURNACE.
I can answer the first 2 questions.
1- You need the vis-viva equation for this:
v^2 = μ×(2/r - 1/a)
μ is the gravitational parameter (μ = G×M in astrodynamics formulas), a is the semi great axis : a = (periapsis + apoapsis)/2
If you use this in the context of the game, don't forget that periapsis and apoapsis have to be measured from the body's center, not from ground level like ingame. So you have to add the body radius to the values you get from the game.
For the gravitational parameter, you can calculate it from the planet data file:
μ = g×radius^2
Note that the formula works for any type of trajectory, but as there is no semi great axis for hyperbolas, you should use the following form:
v^2/2 - μ/r = constant.
If you know the speed at one point (periapsis for example), then you know it at any point.
2- Now you need the Kepler equation:
M = E - e×sin(E)
e is eccentricity
E is eccentric anomaly
M is mean anomaly
You can calculate eccentric anomaly that way:
tan(E/2) = sqrt((1-e)/(1+e)) × tan((θ-φ)/2)
θ is the argument (the angle at which the ship currently is), φ is the argument of periapsis.
Then the mean anomaly is proportional to the delay the ship needs to go from periapsis to its current position:
M = sqrt(μ)/a^(3/2) × T
(T is the delay in the equation).
Another way to write it is to use the orbital period: T_orb = 2×Pi×a^(3/2)/sqrt(μ)
Then you have M = 2Pi × T/T_Orb = E - e×sin(E)
The Kepler equation allows you to calculate the delay (T) that separates 2 positions, but the equation can't be reversed to calculate a starting position from a delay and an ending position. However, some numerical analysis methods (like the Newton-Raphson method) are very efficient to calculate this in practice.
But as you see, overall this is much more complicated than applying a formula. If you want to calculate the closest encounter this requires an iterative approach, there's no direct way to achieve this.
3- I'll use a joker for this one