| Crates.io | keplerian_sim |
| lib.rs | keplerian_sim |
| version | 0.6.2 |
| created_at | 2024-11-26 00:42:39.262593+00 |
| updated_at | 2025-09-23 15:12:00.812132+00 |
| description | A Keplerian orbit library |
| homepage | |
| repository | https://github.com/Not-A-Normal-Robot/keplerian-sim |
| max_upload_size | |
| id | 1461032 |
| size | 473,051 |
A Rust library for simulating Keplerian orbits.
You'll need Cargo and Rust to run the example binary. You can get it at rustup.rs.
You'll also need rustfmt to build the code, which you can install with rustup component add rustfmt.
You should not need to install rustfmt if you are a user of this library and only want to use it in your own project, as rustfmt is only used in build.rs, which is not included in the distributed crate in crates.io.
The crate has the following feature flags:
serde: Enables serialization and deserialization of the structs in this crate using Serde. Disabled by default.mint: Enables interoperability across math libraries using the mint crate. Disabled by default. Note that this only applies to the Matrix3x2 struct used internally.The current MSRV is 1.81.0.
MSRV changes is out-of-scope for this crate's SemVer guarantees and may change in minor or major releases.
If this version number and the one in Cargo.toml do not match, then assume the one in Cargo.toml is the correct one, and create an issue regarding the mismatch.
This project is a library crate, so you can't really 'run' that, but you can run the example binaries.
git clone https://github.com/Not-A-Normal-Robot/keplerian-simcargo run --examplecargo run --examplecargo run --example <binary_name>For the examples that dump a CSV, you can use external tools to chart it.
One example is https://csvplot.com/.
You can run cargo bench to run the benchmarks in /benches. Note that most of them run the function around 1000 times, so you'll have to divide the times you get by 1000 to get the average time for one function call.
The benchmarks use shortened names, and here's what they mean:
ecc poll: The algorithm for obtaining the eccentric anomaly from the mean anomaly in a certain orbit.pos: The algorithm for obtaining the position of a body at a certain angle (true anomaly) in an orbit.pos time: The algorithm for obtaining the position of a body at a certain time in an orbit.vel: The algorithm for obtaining the velocity of a body at a certain angle (true anomaly) in an orbit.vel time: The algorithm for obtaining the velocity of a body at a certain time in an orbit.sv: The algorithm for obtaining the state vectors (position and velocity) of a body at a certain angle (true anomaly) in an orbit.sv time: The algorithm for obtaining the state vectors (position and velocity) of a body at a certain time in an orbit.tilt poll: The algorithm for tilting a certain point from 2D to 3D based on the orbit's inclination and longitude of ascending node.true poll: The algorithm for obtaining the true anomaly from the mean anomaly in an orbit.hyp: Specifies that the orbit/trajectory is hyperbolic. If this is not present, then the orbit is elliptic.cached: Specifies that the orbit struct benchmarked is the regular Orbit struct.compact: Specifies that the orbit struct benchmarked is the CompactOrbit struct instead of the regular Orbit struct.You can run cargo test to run the tests.
I did not come up with the algorithms myself. For more information and useful resources to learn about the algorithms used, check out the CREDITS.md file.