linuxgurugamer / ResonantOrbitCalculator

Calculate the resonant orbit needed for a carrier craft to inject craft it carries,
MIT License
10 stars 3 forks source link

[Bug] Orbital Period to Altitude calculation #5

Open yalov opened 5 years ago

yalov commented 5 years ago

[JNSQ system, so numbers are larger, but on the stock system the bug is the same]

Let say we want to have some nice orbital period, like 3h, this way an inner resonant orbit for 3 satellite should be 2h,
but we see some rounding mistake there - 1h 59m 59.9s, and it is not some milli- or micro- seconds, it is a deci-second,
that is pretty large for just floating point error.

Point cursor to Altitude: field, delete and rewrite last digit 4, for forcing to update orbital period, and it updates to 2h 59m 59.8s,
so resonant period 1h 59m 59.9s makes more sense.

Now trying to pick up an altitude for getting the period equals to 3h.
It is more than 50m larger, and periods now ok: 3h and 2h respectively.

So the problem somewhere in period to altitude calculation, but I couldn't find it.

linuxgurugamer commented 4 years ago

No offense, but I'm not going to worry about 0.1 second, at least not now. If you are interested, look into the floating point, maybe convert everything to double for internal and see what that does. I'll leave this open for now, if you do a PR, I'll happily include it