[−][src]Struct holding_solar::Orbit
Describes the orbit of a given planet.
For the sake of simplicity, orbits are rounded to the nearest day relative to the parent object. This makes calendar calculation much much simpler, as you do not need to manage leap seconds / days.
Fields
parent: PlanetId
The id of the parent planet.
body: PlanetId
The body that is orbiting.
shift: usize
The starting offset for the orbit in days.
eccentricity: f32
The eccentricity of the orbit, or how elliptic it is.
period: usize
The amount of time a single orbit takes in seconds.
For simplicity, valid planets must have a period that is a multiple of the number of seconds in a day.
Implementations
impl Orbit
[src]
pub fn from_period(
target: &CelestialBody,
parent: PlanetId,
period: usize,
shift: usize
) -> Self
[src]
target: &CelestialBody,
parent: PlanetId,
period: usize,
shift: usize
) -> Self
Create a new orbit with a given perion.
pub fn from_radius(
target: &CelestialBody,
parent: PlanetId,
semimajor_axis: f32,
shift: usize
) -> Self
[src]
target: &CelestialBody,
parent: PlanetId,
semimajor_axis: f32,
shift: usize
) -> Self
Creates a new orbit at a given semimajor axis. Note that for now, since the period is a fixed number of days relative to the parent, this will be rounded. This is for simpler interop with the calendar. Nobody wants to RP leap seconds!
pub fn get_phase(
&self,
lookup: &dyn PlanetStore,
date_time: CalendarDateTime<'_>
) -> Option<Phase>
[src]
&self,
lookup: &dyn PlanetStore,
date_time: CalendarDateTime<'_>
) -> Option<Phase>
Get the phase of the orbit.
Only valid if the body being orbited is in turn orbiting something else (that gives off light).
pub fn get_orbit_radians(&self, seconds: u32) -> f32
[src]
Given some day, gets the radians relative to the periapsis.
pub fn get_distance(&self, seconds: u32) -> f32
[src]
Calculates the distance between a body and its parent.
pub fn get_semimajor_axis(&self) -> f32
[src]
Gets the semimajor axis
pub fn validate_calendar(
&self,
calendar: &Calendar
) -> Result<bool, OrbitValidationError>
[src]
&self,
calendar: &Calendar
) -> Result<bool, OrbitValidationError>
Validates an orbit against a calendar, ensuring the period is correct.
Trait Implementations
impl Clone for Orbit
[src]
impl Copy for Orbit
[src]
impl Debug for Orbit
[src]
impl<'de> Deserialize<'de> for Orbit
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for Orbit
[src]
Auto Trait Implementations
impl RefUnwindSafe for Orbit
impl Send for Orbit
impl Sync for Orbit
impl Unpin for Orbit
impl UnwindSafe for Orbit
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,