I have an idea for something that could be really useful to me and to other add-on developers. I hope this already exists; in that case, could somebody point me to it? If it doesn't I think it would be a great idea to create it.
The idea is as follows:
For a lot of Orbiter-related programming (e.g. the custom Cruithne asteroid dll I tried to make, but also for MFDs), you need to do orbital calculations. For instance, you have the orbital elements, but you need to have the orbital state vector in terms of position and velocity. Or you have the orbital state vector, and you want to know position and velocity at some time in the future. Or you want to get the shape of the orbit (e.g. approximated with a polyline) to display it on an MFD. Or you want to calculate the line of intersection between two orbital planes. Et cetera.
Many of these things are very straightforward if you know how to do it, but if people have to implement them again and again, a lot of time is wasted in searching on the internet for formulas, converting them to source code, etc.. So my idea is to make a simple open source, C language library for orbital calculations. Right now I can think of the following functionality:
I'd like it to be a generic library that has no dependencies on anything but the C language itself, so that it can be used in any project outside Orbiter.
The idea is as follows:
For a lot of Orbiter-related programming (e.g. the custom Cruithne asteroid dll I tried to make, but also for MFDs), you need to do orbital calculations. For instance, you have the orbital elements, but you need to have the orbital state vector in terms of position and velocity. Or you have the orbital state vector, and you want to know position and velocity at some time in the future. Or you want to get the shape of the orbit (e.g. approximated with a polyline) to display it on an MFD. Or you want to calculate the line of intersection between two orbital planes. Et cetera.
Many of these things are very straightforward if you know how to do it, but if people have to implement them again and again, a lot of time is wasted in searching on the internet for formulas, converting them to source code, etc.. So my idea is to make a simple open source, C language library for orbital calculations. Right now I can think of the following functionality:
- Basic vector calculus
- Geometric calculation tools
- From orbital state vectors to Keplerian elements and vice versa
- Partial derivatives of the same
- From orbital state vectors at time=t1 to time=t2 (with given accuracy, assuming 2-body system)
- Transformation between various useful coordinate systems (solar centered, planet-centered non-rotating, planet-centered rotating, composition of velocity change in forward/outward/ch.plane etc.)
- State vector prediction using numerical integration of various distortion forces ( >=3 body gravitation, solar wind, continuous thrust, atmospheric drag, who knows what)
I'd like it to be a generic library that has no dependencies on anything but the C language itself, so that it can be used in any project outside Orbiter.