Skip to content

Commit d19d07a

Browse files
Fix #340
1 parent 722681e commit d19d07a

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

anise/src/astro/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::errors::{MathError, PhysicsError};
1515
use super::PhysicsResult;
1616

1717
/// Mean anomaly f64::EPSILON
18-
pub const MA_EPSILON: f64 = 1e-16;
18+
pub const MA_EPSILON: f64 = 1e-12;
1919

2020
/// Computes the true anomaly from the given mean anomaly for an orbit.
2121
///

anise/tests/astro/orbit.rs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
extern crate pretty_env_logger as pel;
22

33
use anise::astro::orbit::Orbit;
4-
use anise::constants::frames::EARTH_J2000;
4+
use anise::constants::frames::{EARTH_J2000, MOON_J2000};
55
use anise::constants::usual_planetary_constants::MEAN_EARTH_ANGULAR_VELOCITY_DEG_S;
66
use anise::math::angles::{between_0_360, between_pm_180};
77
use anise::math::Vector3;
88
use anise::prelude::*;
9-
use anise::time::{Epoch, Unit};
9+
use anise::time::{Epoch, TimeSeries, Unit};
1010

1111
use rstest::*;
1212

@@ -835,3 +835,23 @@ fn b_plane_davis(almanac: Almanac) {
835835
// The following is a regression test.
836836
assert!(dbg!(orbit.hyperbolic_anomaly_deg().unwrap() - 149.610128737).abs() < 1e-9);
837837
}
838+
839+
#[rstest]
840+
fn gh_regression_340(almanac: Almanac) {
841+
let moon_j2k = almanac.frame_from_uid(MOON_J2000).unwrap();
842+
843+
let start = Epoch::from_str("2024-10-16").unwrap();
844+
845+
let orbit = Orbit::keplerian(
846+
6142.400, // sma
847+
0.6, 57.7, 270.0, 270.0, 0.0, start, moon_j2k,
848+
);
849+
850+
for epoch in TimeSeries::inclusive(
851+
start,
852+
Epoch::from_str("2024-10-17").unwrap(),
853+
Unit::Minute * 1,
854+
) {
855+
assert!(orbit.at_epoch(epoch).is_ok(), "error on {epoch}");
856+
}
857+
}

0 commit comments

Comments
 (0)