Added equinoctial elements. Also a little cleanup
This commit is contained in:
1 parent
b089b206f5
commit
1f02cac6a9
8 files changed
+654
-14
No files matched your search
+35
-1
@@ -8,6 +8,7 @@ use std::hint::black_box;
|
||||
|
||||
use astrokit::body::Body;
|
||||
use astrokit::cartesian::Cartesian;
|
||||
use astrokit::equinoctial::Equinoctial;
|
||||
use astrokit::frames::Frame;
|
||||
use astrokit::kepler::{self, Degeneracy, Keplerian};
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
@@ -121,11 +122,44 @@ fn bench_invariants(c: &mut Criterion) {
|
||||
group.finish();
|
||||
}
|
||||
|
||||
/// Equinoctial against Keplerian on the same states.
|
||||
///
|
||||
/// The interesting comparison is GEO: Keplerian takes its doubly-degenerate
|
||||
/// branch there and equinoctial takes no branch at all.
|
||||
fn bench_equinoctial(c: &mut Criterion) {
|
||||
let mut group = c.benchmark_group("equinoctial");
|
||||
|
||||
let leo = leo();
|
||||
let geo = geo();
|
||||
|
||||
group.bench_function("from_cartesian/leo", |b| {
|
||||
b.iter(|| Equinoctial::from_cartesian(&black_box(leo)))
|
||||
});
|
||||
group.bench_function("from_cartesian/geo", |b| {
|
||||
b.iter(|| Equinoctial::from_cartesian(&black_box(geo)))
|
||||
});
|
||||
|
||||
let elements = Equinoctial::from_cartesian(&leo);
|
||||
group.bench_function("to_cartesian", |b| {
|
||||
b.iter(|| black_box(elements).to_cartesian())
|
||||
});
|
||||
group.bench_function("round_trip", |b| {
|
||||
b.iter(|| Equinoctial::from_cartesian(&black_box(leo)).to_cartesian())
|
||||
});
|
||||
|
||||
let keplerian = leo.keplerian();
|
||||
group.bench_function("from_keplerian", |b| {
|
||||
b.iter(|| Equinoctial::from_keplerian(&black_box(keplerian)))
|
||||
});
|
||||
group.finish();
|
||||
}
|
||||
|
||||
criterion_group!(
|
||||
benches,
|
||||
bench_scalar_relations,
|
||||
bench_anomalies,
|
||||
bench_conversions,
|
||||
bench_invariants
|
||||
bench_invariants,
|
||||
bench_equinoctial
|
||||
);
|
||||
criterion_main!(benches);
|
||||
Reference in new issue
Block a user