ballistics_calculate_trajectory_with_drag_table

Function ballistics_calculate_trajectory_with_drag_table 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn ballistics_calculate_trajectory_with_drag_table( inputs: *const FFIBallisticInputs, wind: *const FFIWindConditions, atmosphere: *const FFIAtmosphericConditions, max_range: c_double, step_size: c_double, drag_mach: *const c_double, drag_cd: *const c_double, drag_table_len: c_int, ) -> *mut FFITrajectoryResult
Expand description

ballistics_calculate_trajectory with a caller-supplied custom drag deck (Cd vs Mach, e.g. Hornady CDM / Doppler-radar data). The deck REPLACES the G-model + BC for drag: bc_type/bc_value are ignored, and the retardation denominator becomes the projectile’s sectional density (mass and diameter in inputs must therefore be positive). Mach values must be strictly ascending with drag_table_len in [2, MAX_FFI_DRAG_TABLE_LEN] and finite positive Cd; outside the deck’s Mach domain the nearest endpoint Cd is held.

Returns null for an invalid deck (null arrays, drag_table_len outside [2, MAX_FFI_DRAG_TABLE_LEN], or failed validation), in addition to every failure mode of the base function.

§Safety

Same contract as ballistics_calculate_trajectory for inputs, wind, and atmosphere. Additionally, when non-null, drag_mach and drag_cd must each point to drag_table_len readable f64 values, borrowed only for the duration of this call (the deck is copied; the caller retains ownership — no new free function is required). The returned pointer, when non-null, must be released exactly once with ballistics_free_trajectory_result.