summaryrefslogtreecommitdiffstats
path: root/src/solar_system
diff options
context:
space:
mode:
Diffstat (limited to 'src/solar_system')
-rw-r--r--src/solar_system/orbit.rs29
-rw-r--r--src/solar_system/ship.rs4
2 files changed, 33 insertions, 0 deletions
diff --git a/src/solar_system/orbit.rs b/src/solar_system/orbit.rs
new file mode 100644
index 0000000..fe55e4f
--- /dev/null
+++ b/src/solar_system/orbit.rs
@@ -0,0 +1,29 @@
+use crate::solar_system::{Angle, BodyId, Kilometers, OrbitalBody, Percentage};
+use crate::timeman::{Second};
+
+pub struct StaticOrbit
+{
+ pub parent: Option<BodyId>,
+ pub eccentricity: Percentage,
+ pub inclination: Angle,
+ pub long_asc_node: Angle,
+ pub long_periapsis: Angle,
+ pub mean_long: Angle,
+
+ pub semi_major_axis: Kilometers,
+}
+
+impl StaticOrbit
+{
+ pub fn period(
+ &self,
+ this_body: &OrbitalBody)
+ -> Second
+ {
+ ((self.semi_major_axis.powf(3.0) / this_body.sgp).sqrt() * std::f64::consts::TAU) as u64
+ }
+
+ pub fn parent(&self) -> Option<BodyId> {
+ self.parent
+ }
+}
diff --git a/src/solar_system/ship.rs b/src/solar_system/ship.rs
new file mode 100644
index 0000000..eb4cdf3
--- /dev/null
+++ b/src/solar_system/ship.rs
@@ -0,0 +1,4 @@
+pub struct Ship
+{
+
+}