sample_at_range

Function sample_at_range 

Source
pub fn sample_at_range(
    samples: &[TrajectorySample],
    range_m: f64,
) -> Option<TrajectorySample>
Expand description

Read a sampled trajectory at an EXACT range by linear interpolation between the two samples that bracket it (MBA-1476).

None when range_m lies outside the sampled span (or the span is degenerate) — that is a row the solved flight genuinely cannot supply, and every caller reports it as an error. It must never be answered with the closest sample lying around: the substitution is invisible in the output, and a card row is a number someone dials.

The returned sample carries distance_m == range_m — the range asked for, which is also the range the row is labelled with — so the angular conversion downstream divides by the same distance the shooter reads. flags are dropped: they mark grid points (zero crossing, apex, Mach transition), not arbitrary interpolated ranges.