It might be interesting to link to all codebases that might be relevant. Maybe I will add a list to https://airsick.guide/tools.html.
---
I only searched briefly for more stable methods. Thanks for the reference, I'll have a look!
It might be interesting to link to all codebases that might be relevant. Maybe I will add a list to https://airsick.guide/tools.html.
---
I only searched briefly for more stable methods. Thanks for the reference, I'll have a look!
What comes to stability: given just a single pair of (position, velocity) vectors, it's hard to make something that is really stable. If you have several pairs, you can use the method of least squares to try to fit an orbit into observations.
Not using too many arcus trig functions (acos, asin), will give a bit better results near zero.
Additionally, not having to solve the Kepler's equation would be an improvement for near-parabolic trajectories. In other words: it might be preferable to store (true anomaly at epoch, timestamp of epoch) rather than time of periapsis passage or mean anomaly at epoch to avoid this. The issue is that E - e*sin(E) loses numerical precision when e is near 1 (parabolic) and E is near zero. Same applies for the hyperbolic equivalent of Kepler's equation.
Anyway, nice to find people with similar interests! Good luck with your projects.
Regarding the naming convention, I am trying to stick to PEP8 as strictly as possible (sometimes, even in C) and to use overly explicit variable names. I had not noticed that you did that too for the structure member, with `longitude_of_ascending_node` and such. My objective is to have the code be as readable as possible to a newcomer (hence Python, too).
Advantages over a simple implementation such as yours: proper handling of parabolic and near parabolic orbits, state of the art solvers for time of flight (Kepler's equation) and universal variable formulation. Additionally I've done some work with higher level algorithms for interplanetary trajectory planning.
The library may seem a bit cryptic if you're not too familiar with the literature on this subject, but it should not be too difficult to get up to speed with it. It might take a little bit of trivial software engineering to make it work to get it working as a dll but shouldn't be too much work. I'm happy to help, drop me an email (address in commit log) or contact me on irc (freenode, same nick as here on hn).