pub struct AltitudeSwitch<Below, Above> { /* private fields */ }Expand description
Routes to one of two force models by comparing raw position Y with a cutoff.
Use it to bound a dense-atmosphere model: at and below the cutoff, forces
come from e.g. BallisticForces; above it, from a vacuum model such as
UniformGravity or CentralGravity. The switch reads Y, and
BallisticForces reads Y as altitude above sea level, so it switches on
altitude only in a frame where Y is altitude: the flat frame, or a local
frame with a CentralGravity center at (0, -R, 0) (R the planet
radius), where Y stays near altitude close to the launch point. In an
Earth-centered frame (center at the origin; the icbm_midcourse example
starts at Y = R + h) Y is measured from Earth’s center, so neither the
cutoff nor BallisticForces reads altitude; there, compare the radius
yourself, as that example does for its reentry handoff.
Implementations§
Source§impl<Below, Above> AltitudeSwitch<Below, Above>
impl<Below, Above> AltitudeSwitch<Below, Above>
Sourcepub fn new(below: Below, above: Above, cutoff_altitude_m: f64) -> Result<Self>
pub fn new(below: Below, above: Above, cutoff_altitude_m: f64) -> Result<Self>
Switch from below to above at cutoff_altitude_m (inclusive below).
The cutoff is compared with raw position Y, so it is an altitude only
in a frame where Y is altitude (see the type docs).
Sourcepub fn cutoff_altitude_m(&self) -> f64
pub fn cutoff_altitude_m(&self) -> f64
Handoff value in metres, compared with raw position Y: an altitude only in a frame where Y is altitude (see the type docs).
Trait Implementations§
Source§impl<Below: ForceModel, Above: ForceModel> ForceModel for AltitudeSwitch<Below, Above>
impl<Below: ForceModel, Above: ForceModel> ForceModel for AltitudeSwitch<Below, Above>
Source§fn acceleration(&self, state: &FlightState, mass_kg: f64) -> Result<Vec3>
fn acceleration(&self, state: &FlightState, mass_kg: f64) -> Result<Vec3>
Source§fn acceleration_with_axis(
&self,
state: &FlightState,
mass_kg: f64,
_body_axis: Vec3,
) -> Result<Vec3>
fn acceleration_with_axis( &self, state: &FlightState, mass_kg: f64, _body_axis: Vec3, ) -> Result<Vec3>
body_axis is the solver-resolved unit
thrust axis at this stage. The default ignores the axis, which keeps every
orientation-blind model (gravity, plain drag) bit-identical.Auto Trait Implementations§
impl<Below, Above> Freeze for AltitudeSwitch<Below, Above>
impl<Below, Above> RefUnwindSafe for AltitudeSwitch<Below, Above>where
Below: RefUnwindSafe,
Above: RefUnwindSafe,
impl<Below, Above> Send for AltitudeSwitch<Below, Above>
impl<Below, Above> Sync for AltitudeSwitch<Below, Above>
impl<Below, Above> Unpin for AltitudeSwitch<Below, Above>
impl<Below, Above> UnsafeUnpin for AltitudeSwitch<Below, Above>where
Below: UnsafeUnpin,
Above: UnsafeUnpin,
impl<Below, Above> UnwindSafe for AltitudeSwitch<Below, Above>where
Below: UnwindSafe,
Above: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.