From a0a3b3974cab754c10a1517d82762b99482970ce Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Tue, 12 May 2026 19:01:27 -0400 Subject: update packages to latest versions --- src/solar_system/body.rs | 8 +++++++- src/solar_system/orbit.rs | 12 ++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'src/solar_system') diff --git a/src/solar_system/body.rs b/src/solar_system/body.rs index 3e61486..f3aef8c 100644 --- a/src/solar_system/body.rs +++ b/src/solar_system/body.rs @@ -9,6 +9,8 @@ pub const BODY_TICK_DURATION: Second = timeman::DAY; pub struct OrbitalBody { id: BodyId, + system: SystemId, + name: String, mass: Kilograms, radius: Kilometers, @@ -34,10 +36,12 @@ impl OrbitalBody pub fn new_from_record( id: BodyId, + system: SystemId, record: CSVOrbitalBody) -> Self { Self { - id: id, + id, + system, name: record.name, mass: record.mass, radius: record.radius, @@ -45,6 +49,7 @@ impl OrbitalBody orbit: match record.orbits { Some(parent) => Some(StaticOrbit::new( parent, + system, record.eccentricity, record.inclination, record.long_asc_node, @@ -59,6 +64,7 @@ impl OrbitalBody } pub fn id(&self) -> BodyId { self.id } + pub fn system(&self) -> SystemId { self.system } pub fn name(&self) -> &String { &self.name } pub fn radius(&self) -> f32 { self.radius as f32 } pub fn mass(&self) -> Kilograms { self.mass } diff --git a/src/solar_system/orbit.rs b/src/solar_system/orbit.rs index f5a564c..b29e2c2 100644 --- a/src/solar_system/orbit.rs +++ b/src/solar_system/orbit.rs @@ -1,9 +1,11 @@ -use crate::solar_system::{Angle, BodyId, Kilometers, OrbitalBody, Percentage}; +use crate::solar_system::{Angle, BodyId, Kilometers, OrbitalBody, Percentage, SystemId}; use crate::timeman::{Second}; pub struct StaticOrbit { parent: BodyId, + system: SystemId, + eccentricity: Percentage, inclination: Angle, long_asc_node: Angle, @@ -23,6 +25,7 @@ impl StaticOrbit { pub fn new( parent: BodyId, + system: SystemId, eccentricity: Percentage, inclination: Angle, long_asc_node: Angle, @@ -32,6 +35,7 @@ impl StaticOrbit -> Self { Self { parent, + system, eccentricity, inclination, long_asc_node, @@ -48,6 +52,7 @@ impl StaticOrbit { Self { parent: parent.id(), + system: parent.system(), eccentricity: 1e-6, inclination: 0.0, long_asc_node: 0.0, @@ -65,9 +70,8 @@ impl StaticOrbit ((self.semi_major_axis.powf(3.0) / this_body.sgp()).sqrt() * std::f64::consts::TAU) as Second } - pub fn parent(&self) -> BodyId { - self.parent - } + pub fn parent(&self) -> BodyId { self.parent } + pub fn system(&self) -> SystemId { self.system } pub fn sma(&self) -> Kilometers { self.semi_major_axis } -- cgit v1.2.3