blob: fe55e4f3deb3befeb2ef60a14c59a053bf9565fb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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
}
}
|