Skip to content

Commit

Permalink
Fix doc test
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherRabotin committed Jan 7, 2024
1 parent ec7a67b commit 294db01
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}");
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions anise/src/math/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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
Expand Down

0 comments on commit 294db01

Please sign in to comment.