pub struct TrajectorySolver { /* private fields */ }Implementations§
Source§impl TrajectorySolver
impl TrajectorySolver
pub fn new( inputs: BallisticInputs, wind: WindConditions, atmosphere: AtmosphericConditions, ) -> Self
Sourcepub fn new_with_resolved_station_atmosphere(
inputs: BallisticInputs,
wind: WindConditions,
atmosphere: AtmosphericConditions,
) -> Self
pub fn new_with_resolved_station_atmosphere( inputs: BallisticInputs, wind: WindConditions, atmosphere: AtmosphericConditions, ) -> Self
Construct a solver from station temperature and pressure that a presence-aware service
has already resolved. Unlike Self::new, exact sea-level standard values remain
authoritative at nonzero altitude rather than acting as legacy omission sentinels.
pub (MBA-1397; was pub(crate)): a QNH-aware caller (native CLI, WASM) that has
already reduced a declared altimeter setting to station pressure via
crate::atmosphere::resolve_station_conditions_with_pressure_mode needs this
constructor too, and those callers live in a different crate (src/main.rs is a
separate binary crate over the library). Widening visibility only, no signature
change: every existing pub(crate) caller is unaffected.
pub fn set_max_range(&mut self, range: f64)
pub fn set_time_step(&mut self, step: f64)
Sourcepub fn set_wind_segments(&mut self, segments: Vec<WindSegment>)
pub fn set_wind_segments(&mut self, segments: Vec<WindSegment>)
Supply downrange-segmented wind. Each segment is (speed_kmh, angle_deg, until_distance_m); the wind for a given downrange distance is the first
segment whose until_distance_m exceeds it (a step function), and wind is
zero beyond the last segment. An empty list clears segmented wind (reverts
to the scalar wind). The angle convention matches WindConditions
(0 = headwind, 90 = from the right).
Sourcepub fn set_atmo_segments(&mut self, segments: Vec<AtmoSegment>)
pub fn set_atmo_segments(&mut self, segments: Vec<AtmoSegment>)
Supply downrange-segmented atmosphere (MBA-1137). Each segment is
(temp_c, pressure_hpa, humidity_percent, until_distance_m), defined at the shooter base
altitude; the per-substep local-atmosphere recompute selects the active zone by downrange
distance (first zone whose until_distance_m exceeds it; the last zone is held beyond the
final threshold). The zone’s base conditions are composed with the vertical altitude lapse
via get_local_atmosphere_humid, so a steeply-arcing shot still sees the y-lapse on top of
the zone base. An empty list clears segmented atmosphere (reverts to the resolved
single-station conditions).
pub fn solve(&self) -> Result<TrajectoryResult, BallisticsError>
Sourcepub fn effective_drag_coefficient(
&self,
velocity_magnitude: f64,
speed_of_sound: f64,
) -> Option<f64>
pub fn effective_drag_coefficient( &self, velocity_magnitude: f64, speed_of_sound: f64, ) -> Option<f64>
The projectile’s own drag coefficient at one speed — the curve a shooter would compare against a measured CDM trace, not the reference-table Cd (MBA-1423).
A G-model Cd describes the standard projectile, so reporting it directly would hand a
consumer the same G7 curve no matter which bullet was flown. Scaling by the form factor
SD / BC converts it to this projectile’s actual Cd, from the identity that both
descriptions must produce the same retardation:
Cd_own / SD == Cd_ref / BC => Cd_own == Cd_ref * SD / BCBecause the denominator comes from the same internal resolver the integrator divides by, a velocity- or Mach-segmented BC carries into the result and its band steps appear in the reported curve. The same expression is already correct for a custom drag table, where the denominator is the sectional density and the scale factor collapses to 1.
Returns None when the projectile’s mass or diameter is unavailable, since sectional
density — and therefore the projectile’s own Cd — is undefined without both.
Trait Implementations§
Source§impl Clone for TrajectorySolver
impl Clone for TrajectorySolver
Source§fn clone(&self) -> TrajectorySolver
fn clone(&self) -> TrajectorySolver
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for TrajectorySolver
impl RefUnwindSafe for TrajectorySolver
impl Send for TrajectorySolver
impl Sync for TrajectorySolver
impl Unpin for TrajectorySolver
impl UnsafeUnpin for TrajectorySolver
impl UnwindSafe for TrajectorySolver
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.