pub struct EllipticalOrbit {
pub mu: f64,
pub periapsis_radius: f64,
pub apoapsis_radius: f64,
}Expand description
Elliptical orbit state described by a gravitational parameter and apsides.
Fields§
§mu: f64Central-body gravitational parameter in cubic meters per second squared.
periapsis_radius: f64Periapsis radius in meters.
apoapsis_radius: f64Apoapsis radius in meters.
Implementations§
Source§impl EllipticalOrbit
impl EllipticalOrbit
Sourcepub fn new(
mu: f64,
periapsis_radius: f64,
apoapsis_radius: f64,
) -> Option<EllipticalOrbit>
pub fn new( mu: f64, periapsis_radius: f64, apoapsis_radius: f64, ) -> Option<EllipticalOrbit>
Creates an elliptical orbit from a gravitational parameter and apsides.
Returns None when mu is less than or equal to zero or not finite, or when the apsides
are invalid.
Sourcepub fn semi_major_axis(&self) -> Option<f64>
pub fn semi_major_axis(&self) -> Option<f64>
Computes the semi-major axis.
Sourcepub fn eccentricity(&self) -> Option<f64>
pub fn eccentricity(&self) -> Option<f64>
Computes eccentricity.
Sourcepub fn period(&self) -> Option<f64>
pub fn period(&self) -> Option<f64>
Computes the orbital period.
§Examples
use use_orbit::EllipticalOrbit;
let orbit = EllipticalOrbit::new(100.0, 10.0, 20.0);
assert!(orbit.and_then(|value| value.period()).is_some_and(|period| period > 0.0));Sourcepub fn periapsis_speed(&self) -> Option<f64>
pub fn periapsis_speed(&self) -> Option<f64>
Computes speed at periapsis.
Sourcepub fn apoapsis_speed(&self) -> Option<f64>
pub fn apoapsis_speed(&self) -> Option<f64>
Computes speed at apoapsis.
Trait Implementations§
Source§impl Clone for EllipticalOrbit
impl Clone for EllipticalOrbit
Source§fn clone(&self) -> EllipticalOrbit
fn clone(&self) -> EllipticalOrbit
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EllipticalOrbit
impl Debug for EllipticalOrbit
Source§impl PartialEq for EllipticalOrbit
impl PartialEq for EllipticalOrbit
Source§fn eq(&self, other: &EllipticalOrbit) -> bool
fn eq(&self, other: &EllipticalOrbit) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for EllipticalOrbit
impl StructuralPartialEq for EllipticalOrbit
Auto Trait Implementations§
impl Freeze for EllipticalOrbit
impl RefUnwindSafe for EllipticalOrbit
impl Send for EllipticalOrbit
impl Sync for EllipticalOrbit
impl Unpin for EllipticalOrbit
impl UnsafeUnpin for EllipticalOrbit
impl UnwindSafe for EllipticalOrbit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more