From 294db0123be137c13e4d4aca01345ed45def1d65 Mon Sep 17 00:00:00 2001 From: Christopher Rabotin Date: Sun, 7 Jan 2024 08:45:00 -0700 Subject: [PATCH] Fix doc test --- README.md | 16 ++++++++-------- anise/src/math/mod.rs | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 00200ead..283e607a 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ let orig_state = Orbit::keplerian( // Transform that orbit into another frame. let state_itrf93 = almanac - .transform_to(orig_state, EARTH_ITRF93, Aberration::NotSet) + .transform_to(orig_state, EARTH_ITRF93, None) .unwrap(); // The `:x` prints this orbit's Keplerian elements @@ -109,7 +109,7 @@ println!("{state_itrf93:X}"); // Convert back let from_state_itrf93_to_eme2k = almanac - .transform_to(state_itrf93, EARTH_J2000, Aberration::NotSet) + .transform_to(state_itrf93, EARTH_J2000, Aberration::NONE) .unwrap(); println!("{from_state_itrf93_to_eme2k}"); @@ -181,11 +181,11 @@ let ctx = Almanac::from_spk(spk).unwrap(); let epoch = Epoch::from_str("2020-11-15 12:34:56.789 TDB").unwrap(); let state = ctx - .translate_from_to( - VENUS_J2000, - EARTH_MOON_BARYCENTER_J2000, + .translate( + VENUS_J2000, // Target + EARTH_MOON_BARYCENTER_J2000, // Observer epoch, - Aberration::NotSet, + None, ) .unwrap(); @@ -242,7 +242,7 @@ def test_state_transformation(): assert orig_state.tlong_deg() == 0.6916999999999689 state_itrf93 = ctx.transform_to( - orig_state, Frames.EARTH_ITRF93, Aberration.NotSet + orig_state, Frames.EARTH_ITRF93, None ) print(orig_state) @@ -254,7 +254,7 @@ def test_state_transformation(): # Convert back from_state_itrf93_to_eme2k = ctx.transform_to( - state_itrf93, Frames.EARTH_J2000, Aberration.NotSet + state_itrf93, Frames.EARTH_J2000, None ) print(from_state_itrf93_to_eme2k) diff --git a/anise/src/math/mod.rs b/anise/src/math/mod.rs index 151b6550..1b2b06a8 100644 --- a/anise/src/math/mod.rs +++ b/anise/src/math/mod.rs @@ -48,7 +48,7 @@ pub fn perp_vector(a: &Vector3, b: &Vector3) -> Vector3 { /// Rotate the vector a around the provided axis by angle theta. /// Converted from NAIF SPICE's `vrotv` -pub fn rotate_vector(a: &Vector3, axis: &Vector3, theta: f64) -> Vector3 { +pub fn rotate_vector(a: &Vector3, axis: &Vector3, theta_rad: f64) -> Vector3 { // Compute the unit vector that lies in the direction of the AXIS. let x = axis.normalize(); @@ -62,7 +62,7 @@ pub fn rotate_vector(a: &Vector3, axis: &Vector3, theta: f64) -> Vector3 { let v2 = a.cross(&v1); // Compute COS(THETA)*V1 + SIN(THETA)*V2. This is V1 rotated about the AXIS in the plane normal to the axis. - let r_plane = v1 * theta.cos() + v2 * theta.sin(); + let r_plane = v1 * theta_rad.cos() + v2 * theta_rad.sin(); // Add the rotated component in the normal plane to AXIS to the projection of V onto AXIS (P) to obtain R. r_plane + p