diff --git a/anise/src/naif/kpl/parser.rs b/anise/src/naif/kpl/parser.rs index 425c80cf..8607cbc5 100644 --- a/anise/src/naif/kpl/parser.rs +++ b/anise/src/naif/kpl/parser.rs @@ -359,19 +359,16 @@ pub fn convert_fk + fmt::Debug>( } // Build the quaternion from the Euler matrices let from = id; - let mut to = item.data[&Parameter::Center].to_i32().unwrap(); + let to = item.data[&Parameter::Center].to_i32().unwrap(); if let Some(class) = item.data.get(&Parameter::Class) { if class.to_i32().unwrap() == 4 { // This is a relative frame. let relative_to = item.data.get(&Parameter::Relative).ok_or(DataSetError::Conversion { action: format!("frame {id} is class 4 relative to, but the RELATIVE_TO token was not found"), })?.to_string().unwrap(); - if let Ok(parent) = dataset.get_by_name(&relative_to) { - to = parent.to; - } else { - // Not found yet, let's mark it as an ID to revisit. - ids_to_update.push((id, relative_to.clone())); - } + + // Always mark as something to update later. + ids_to_update.push((id, relative_to.clone())); } } @@ -441,9 +438,10 @@ pub fn convert_fk + fmt::Debug>( let parent_id = dataset.data[(*parent_idx) as usize].to; // Modify this EP. - let this_idx = dataset.lut.by_id[&id]; - let mut this_q = dataset.data[this_idx as usize]; - this_q.from = parent_id; + let index = dataset.lut.by_id.get(&id).unwrap(); + // Grab the data + let this_q = dataset.data.get_mut(*index as usize).unwrap(); + this_q.to = parent_id; } dataset.set_crc32(); diff --git a/anise/src/structure/lookuptable.rs b/anise/src/structure/lookuptable.rs index 14dd8389..1f1a0676 100644 --- a/anise/src/structure/lookuptable.rs +++ b/anise/src/structure/lookuptable.rs @@ -47,7 +47,7 @@ pub enum LutError { /// _Both_ the IDs and the name MUST be unique in the look up table. #[derive(Clone, Default, Debug, PartialEq, Eq)] pub struct LookUpTable { - /// Unique IDs of each item in the + /// Unique IDs of each item in the LUT pub by_id: FnvIndexMap, /// Corresponding index for each hash pub by_name: FnvIndexMap, u32, ENTRIES>, diff --git a/anise/tests/orientations/mod.rs b/anise/tests/orientations/mod.rs index b4c95434..a7e493bb 100644 --- a/anise/tests/orientations/mod.rs +++ b/anise/tests/orientations/mod.rs @@ -2,11 +2,11 @@ use std::path::PathBuf; use anise::constants::frames::{ EARTH_ITRF93, EARTH_J2000, EME2000, IAU_JUPITER_FRAME, IAU_MOON_FRAME, - JUPITER_BARYCENTER_J2000, MOON_J2000, MOON_ME_DE440_ME421_FRAME, MOON_ME_FRAME, - MOON_PA_DE421_FRAME, MOON_PA_DE440_FRAME, MOON_PA_FRAME, + JUPITER_BARYCENTER_J2000, MOON_J2000, MOON_ME_DE440_ME421_FRAME, MOON_PA_DE421_FRAME, + MOON_PA_DE440_FRAME, MOON_PA_FRAME, }; use anise::constants::orientations::{ - ECLIPJ2000, IAU_JUPITER, IAU_MOON, ITRF93, J2000, MOON_PA, MOON_PA_DE421, MOON_PA_DE440, + ECLIPJ2000, IAU_JUPITER, IAU_MOON, ITRF93, J2000, MOON_PA_DE421, MOON_PA_DE440, }; use anise::math::rotation::DCM; use anise::math::Matrix3;