Skip to main content

estimate_bc_fit

Function estimate_bc_fit 

Source
pub fn estimate_bc_fit(
    velocity: f64,
    mass: f64,
    diameter: f64,
    points: &[(f64, f64)],
    drag_model: DragModel,
    mode: BcFitMode,
    atmosphere: AtmosphericConditions,
    zero_range: Option<f64>,
    sight_height: f64,
) -> Result<BcEstimate, BallisticsError>
Expand description

Estimate a BC by fitting a simulated trajectory to measured data, for a chosen drag model (G1, G7, …) and fit basis (drop or velocity). Uses a coarse 0.01 sweep over plausible BCs followed by a 0.001 local refine around the coarse best.

points are (distance_m, value_m_or_mps) where the second element is drop in meters (BcFitMode::Drop) or remaining speed in m/s (BcFitMode::Velocity).

The fit runs under atmosphere — BC is only meaningful relative to the air density the data was measured at, so this must match the conditions the drop/velocity came from (pass ICAO standard for a standard-atmosphere dope card).

zero_range selects the drop reference frame (ignored for velocity fits):

  • Nonebore-referenced: flat 0° fire, drop below the extended bore axis.
  • Some(range_m)sight/dope-card-referenced: the trajectory is zeroed at range_m (using sight_height), and drop is measured below the horizontal line of sight — i.e. exactly what a dope card zeroed at that range prints.