| Title: | High-Performance Exterior Ballistics Trajectory Engine |
|---|---|
| Description: | Native R bindings to the 'ballistics-engine' Rust crate via 'extendr'. Provides exterior ballistics trajectory integration (RK4, adaptive RK45, fast fixed-step, and Euler), zeroing, ICAO and CIPM moist-air atmospheric modeling, 3D and segmented wind fields, boundary-layer wind shear, minimax wind-scenario hold corridors, G1-G8/GI/GS/RA4 and custom drag models, spin drift, pitch damping, precession/nutation, aerodynamic jump, gyroscopic stability, BC conversion/estimation/5D lookup tables, Monte Carlo and adaptive confidence sequences, Weapon Employment Zone (WEZ), sensitivity perturbation, counterfactual explanation, first-order error budgets, tolerance envelopes, MV/BC/Bayesian/DSF/wind/tall-target truing, turret/reticle engagement planning, parametric and imported reticles, adaptive range cards, printable PDF dope cards, ArcherBC2 .a7p profile import/export, moving-target lead, SAAMI free recoil, competition power factor, and the versioned JSON command bridge. |
| Authors: | Alex Jokela [aut, cre] |
| Maintainer: | Alex Jokela <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.51.0.1 |
| Built: | 2026-12-06 18:56:48 UTC |
| Source: | https://github.com/ajokela/ballistics-r |
ProfileData fields carried by the .a7p export formatList ProfileData fields carried by the .a7p export format
a7p_carried_fields()a7p_carried_fields()
Character vector of carried field names.
BallisticInputs
Powder-temperature-adjusted muzzle velocity from BallisticInputs
adjusted_muzzle_velocity(inputs = ballistic_inputs())adjusted_muzzle_velocity(inputs = ballistic_inputs())
inputs |
Ballistic inputs list (SI). |
Adjusted muzzle velocity (m/s).
Format an angular or quantized-click adjustment with optional bias and tracking CF
adjustment_display( drop_yd, range_yd, unit = c("mil", "moa", "smoa", "iphy", "clicks"), click_spec = NULL, bias_mil = 0, cf = 1 )adjustment_display( drop_yd, range_yd, unit = c("mil", "moa", "smoa", "iphy", "clicks"), click_spec = NULL, bias_mil = 0, cf = 1 )
drop_yd |
Linear drop (same unit as |
range_yd |
Range. |
unit |
One of |
click_spec |
Optional click graduation string (required for quantized clicks). |
bias_mil |
Optional zero-set angular bias in MIL. |
cf |
Tracking correction factor (default |
Named list with value, unit_label, and quantized.
mil, moa, smoa)Angular conversion factor for a click base unit (mil, moa, smoa)
adjustment_factor(base = c("mil", "moa", "smoa"))adjustment_factor(base = c("mil", "moa", "smoa"))
base |
One of |
Numeric scalar conversion factor.
Bullet-type advanced spin drift (meters)
advanced_spin_drift( stability_factor, time_of_flight_s, velocity_mps, muzzle_velocity_mps, spin_rate_rad_s, caliber_m, mass_kg, air_density_kg_m3 = 1.225, is_right_twist = TRUE, bullet_type = "match" )advanced_spin_drift( stability_factor, time_of_flight_s, velocity_mps, muzzle_velocity_mps, spin_rate_rad_s, caliber_m, mass_kg, air_density_kg_m3 = 1.225, is_right_twist = TRUE, bullet_type = "match" )
stability_factor |
Sg. |
time_of_flight_s |
Time of flight (s). |
velocity_mps |
Current velocity (m/s). |
muzzle_velocity_mps |
Muzzle velocity (m/s). |
spin_rate_rad_s |
Spin rate (rad/s). |
caliber_m |
Caliber (m). |
mass_kg |
Mass (kg). |
air_density_kg_m3 |
Air density (kg/m^3). |
is_right_twist |
Logical. |
bullet_type |
Bullet type: |
Spin drift in meters.
Advanced gyroscopic stability accounting for bullet type and boat tail
advanced_stability( mass_grains, velocity_fps, twist_rate_inches, caliber_inches, length_inches, air_density_kg_m3 = 1.225, temperature_k = 288.15, bullet_type = "match", has_boat_tail = TRUE, has_plastic_tip = FALSE )advanced_stability( mass_grains, velocity_fps, twist_rate_inches, caliber_inches, length_inches, air_density_kg_m3 = 1.225, temperature_k = 288.15, bullet_type = "match", has_boat_tail = TRUE, has_plastic_tip = FALSE )
mass_grains |
Bullet weight (grains). |
velocity_fps |
Muzzle velocity (fps). |
twist_rate_inches |
Barrel twist (inches/turn). |
caliber_inches |
Caliber (inches). |
length_inches |
Total bullet length (inches). |
air_density_kg_m3 |
Air density (kg/m^3). |
temperature_k |
Ignored by the engine's model; kept for compatibility. |
bullet_type |
Bullet type: |
has_boat_tail |
Logical. |
has_plastic_tip |
Ignored by the engine's model; kept for compatibility. See
|
Stability factor Sg.
Legacy advanced yaw of repose helper
advanced_yaw_of_repose( stability_factor, velocity_mps, crosswind_mps, spin_rate_rad_s, air_density_kg_m3 = 1.225, caliber_m = 0.00782 )advanced_yaw_of_repose( stability_factor, velocity_mps, crosswind_mps, spin_rate_rad_s, air_density_kg_m3 = 1.225, caliber_m = 0.00782 )
stability_factor |
Sg. |
velocity_mps |
Velocity (m/s). |
crosswind_mps |
Crosswind (m/s). |
spin_rate_rad_s |
Spin rate (rad/s). |
air_density_kg_m3 |
Air density (kg/m^3). |
caliber_m |
Caliber (m). |
Yaw angle (rad).
Detailed aerodynamic jump components
aerodynamic_jump( muzzle_velocity_mps, spin_rate_rad_s, crosswind_mps, caliber_m, mass_kg, barrel_length_m = 0.6096, twist_rate_calibers = 32.5, is_right_twist = TRUE, initial_yaw_rad = 0, air_density_kg_m3 = 1.225 )aerodynamic_jump( muzzle_velocity_mps, spin_rate_rad_s, crosswind_mps, caliber_m, mass_kg, barrel_length_m = 0.6096, twist_rate_calibers = 32.5, is_right_twist = TRUE, initial_yaw_rad = 0, air_density_kg_m3 = 1.225 )
muzzle_velocity_mps |
Muzzle velocity (m/s). |
spin_rate_rad_s |
Spin rate (rad/s). |
crosswind_mps |
Crosswind (m/s). |
caliber_m |
Caliber (m). |
mass_kg |
Mass (kg). |
barrel_length_m |
Barrel length (m). |
twist_rate_calibers |
Twist rate in calibers/turn. |
is_right_twist |
Logical. |
initial_yaw_rad |
Initial yaw (rad). |
air_density_kg_m3 |
Air density (kg/m^3). |
Named list with all 6 AerodynamicJumpComponents fields.
Compute aerodynamic-jump launch-angle offset (radians)
aerodynamic_jump_launch_offset(inputs = ballistic_inputs(), atmosphere = NULL)aerodynamic_jump_launch_offset(inputs = ballistic_inputs(), atmosphere = NULL)
inputs |
Ballistic inputs list (SI). |
atmosphere |
Optional atmosphere list. |
Numeric scalar launch angle offset in radians.
atmosphere::air_at)Evaluate local air properties aloft and downrange (atmosphere::air_at)
air_at( atmosphere = NULL, downrange_m = 0, altitude_m = 0, atmo_segments = NULL )air_at( atmosphere = NULL, downrange_m = 0, altitude_m = 0, atmo_segments = NULL )
atmosphere |
Named list specifying either station air ( |
downrange_m |
Numeric vector of downrange distances (m). |
altitude_m |
Numeric vector of altitudes above MEAN SEA LEVEL (m), not above the station: the default 0 is sea level, so for a station at 1500 m pass 1500 to read the station's own air. |
atmo_segments |
Optional downrange atmosphere segments ( |
A data.frame with density_kg_m3, speed_of_sound_mps,
temperature_k, and pressure_pa.
CIPM moist-air density calculation (vectorized)
air_density_cipm(temp_c = 15, pressure_hpa = 1013.25, humidity_percent = 50)air_density_cipm(temp_c = 15, pressure_hpa = 1013.25, humidity_percent = 50)
temp_c |
Temperature in Celsius (numeric vector). |
pressure_hpa |
Station pressure in hPa (numeric vector). |
humidity_percent |
Relative humidity percent |
Numeric vector of air densities in kg/m^3.
Convert and analyze velocity-banded BC segments with family recommendation
analyze_bc_segments( segments, source_model = "G1", target_model = "G7", candidates = c("G1", "G7", "G8"), speed_of_sound_fps = 340.29/0.3048, format = NULL )analyze_bc_segments( segments, source_model = "G1", target_model = "G7", candidates = c("G1", "G7", "G8"), speed_of_sound_fps = 340.29/0.3048, format = NULL )
segments |
Velocity-banded BC segments |
source_model |
Source drag model. |
target_model |
Target drag model. |
candidates |
Character vector of candidate drag models. |
speed_of_sound_fps |
Speed of sound in fps. |
format |
Optional output format ( |
Named list (BcSegmentAnalysisV1) or formatted string.
moment / moment_of_inertia (rad/s^2)Angular acceleration moment / moment_of_inertia (rad/s^2)
angular_acceleration(moment, moment_of_inertia)angular_acceleration(moment, moment_of_inertia)
moment |
Moment (N*m). |
moment_of_inertia |
Moment of inertia (kg*m^2). |
Angular acceleration (rad/s^2).
Solve a trajectory and apply a Mach-keyed DSF table post-correction
apply_dsf_trajectory( inputs = ballistic_inputs(), dsf_points, wind = NULL, atmosphere = NULL, max_range_m = 1500 )apply_dsf_trajectory( inputs = ballistic_inputs(), dsf_points, wind = NULL, atmosphere = NULL, max_range_m = 1500 )
inputs |
|
dsf_points |
A |
wind |
Optional |
atmosphere |
Optional |
max_range_m |
Maximum integration range (m). |
An object of class "ballistics_trajectory" with DSF-adjusted drops.
Apply form factor to a base drag coefficient
apply_form_factor( cd_base, bullet_name = NULL, drag_model = "G1", use_form_factor = TRUE )apply_form_factor( cd_base, bullet_name = NULL, drag_model = "G1", use_form_factor = TRUE )
cd_base |
Base drag coefficient. |
bullet_name |
Optional bullet name string. |
drag_model |
Drag model string. |
use_form_factor |
Logical. |
Adjusted drag coefficient.
Apply low-Reynolds-number drag correction
apply_reynolds_correction( base_cd, velocity_mps, diameter_inches, air_density_kg_m3, temperature_c, mach )apply_reynolds_correction( base_cd, velocity_mps, diameter_inches, air_density_kg_m3, temperature_c, mach )
base_cd |
Base drag coefficient. |
velocity_mps |
Velocity (m/s). |
diameter_inches |
Projectile diameter (inches). |
air_density_kg_m3 |
Air density (kg/m^3). |
temperature_c |
Ambient temperature (C). |
mach |
Mach number. |
Corrected drag coefficient.
In R, scalars and length-1 vectors are identical. Wrap length-1 inputs in
as_json_array() (or base I()) when a Rust serde schema expects a JSON
array (such as ranges_m, observations, or bc_segments).
as_json_array(x)as_json_array(x)
x |
An R vector or list. |
x with S3 class "ballistics_array" prepended.
{}
Mark an empty list to serialize as an empty JSON object {}
as_json_object(x = list())as_json_object(x = list())
x |
An R list (default |
x with S3 class "ballistics_object" prepended.
The decision-support functions (perturbation_read_axis(), perturbation_with_axis(),
perturbation_central_difference(), perturbation_bisect_axis(), explain_difference(),
error_budget(), tolerance_envelope(), perturbation_evaluate()) take either a
SolveRequestV1 or a resolved request (ResolvedSolveRequestV1). The two share field
names but not meaning: a resolved pressure is already QNH-reduced and a resolved wind
direction is already shooter-relative. So a resolved request must say so. The one
returned by solve_v1() ($resolved_request) already does; use this for one built or read
some other way (e.g. from JSON). Anything untagged is read as a SolveRequestV1 and
resolved first.
as_resolved_request(x)as_resolved_request(x)
x |
A |
x, with class "ballistics_resolved_request" added.
AtmoSock) handleCreate a downrange atmosphere-segment (AtmoSock) handle
atmo_sock(segments)atmo_sock(segments)
segments |
A |
An opaque handle of class "AtmoSockHandle".
AtmosphericConditions configuration listOmitted (NULL) temperature or pressure preserves StationAtmospherePresence
semantics so ICAO standard air at altitude is resolved automatically.
atmospheric_conditions( temperature = NULL, pressure = NULL, humidity = 50, altitude = 0 )atmospheric_conditions( temperature = NULL, pressure = NULL, humidity = 50, altitude = 0 )
temperature |
Ambient temperature (C in metric, F in imperial), or |
pressure |
Absolute station pressure (hPa in metric, inHg in imperial), or |
humidity |
Relative humidity percent ( |
altitude |
Station altitude (m in metric, ft in imperial). |
Named list of atmospheric conditions.
BallisticInputs configuration listCreates a named list of ballistic input parameters. Any omitted fields use
ballistics-engine's BallisticInputs::default() values.
ballistic_inputs( bc_value = 0.5, bc_type = "G1", bullet_mass = NULL, muzzle_velocity = NULL, bullet_diameter = NULL, bullet_length = NULL, sight_height = NULL, target_distance = NULL, muzzle_angle = NULL, shooting_angle = NULL, twist_rate = NULL, is_twist_right = TRUE, use_rk4 = NULL, use_adaptive_rk45 = NULL, enable_trajectory_sampling = NULL, sample_interval = NULL, ... )ballistic_inputs( bc_value = 0.5, bc_type = "G1", bullet_mass = NULL, muzzle_velocity = NULL, bullet_diameter = NULL, bullet_length = NULL, sight_height = NULL, target_distance = NULL, muzzle_angle = NULL, shooting_angle = NULL, twist_rate = NULL, is_twist_right = TRUE, use_rk4 = NULL, use_adaptive_rk45 = NULL, enable_trajectory_sampling = NULL, sample_interval = NULL, ... )
bc_value |
Ballistic coefficient (G1, G7, etc.). |
bc_type |
Drag model ( |
bullet_mass |
Bullet mass (kg in metric, grains in imperial). |
muzzle_velocity |
Muzzle velocity (m/s in metric, fps in imperial). |
bullet_diameter |
Bullet diameter (m in metric, inches in imperial). |
bullet_length |
Optional bullet length (m in metric, inches in imperial). |
sight_height |
Sight height above bore (m in metric, inches in imperial). |
target_distance |
Target/zero distance (m in metric, yards in imperial). |
muzzle_angle |
Explicit launch angle in radians. |
shooting_angle |
Uphill/downhill shooting angle in radians. |
twist_rate |
Barrel twist rate in inches per turn. |
is_twist_right |
Logical; |
use_rk4 |
Logical; use RK4 integration. |
use_adaptive_rk45 |
Logical; use adaptive RK45 integration. |
enable_trajectory_sampling |
Logical; populate |
sample_interval |
Sampling interval (m in metric, yards in imperial). |
... |
Any additional |
A named list suitable for solve_trajectory(),
calculate_zero_angle(), run_monte_carlo(), and ballistics_solver().
ballistics-engine
Physical and numerical constants from ballistics-engine
ballistics_constants()ballistics_constants()
Named list of all physical and numerical constants exported by
ballistics_engine::constants and core solver limits.
BallisticsSolver handleWraps ballistics_engine::TrajectorySolver in an opaque handle supporting
$set_max_range(), $set_time_step(), $set_wind_segments(),
$set_atmo_segments(), $solve(), $equivalent_horizontal_range(),
$effective_drag_coefficient(), $position_at_range(),
$observation_at_range(), and $sample_observations().
ballistics_solver(inputs = ballistic_inputs(), wind = NULL, atmosphere = NULL)ballistics_solver(inputs = ballistic_inputs(), wind = NULL, atmosphere = NULL)
inputs |
List of ballistic inputs (SI units; see |
wind |
Optional list of wind conditions (SI units). |
atmosphere |
Optional list of atmospheric conditions (SI units). |
An external pointer handle of class "BallisticsSolver".
BcCorrectionTable)Load a legacy offline binary BC correction table (BcCorrectionTable)
bc_table_load(path)bc_table_load(path)
path |
File path to the binary BC table. |
An opaque handle of class "BcTableHandle".
Convert a caliber in inches to its integer 5D table key
bc5d_caliber_to_key(caliber_in)bc5d_caliber_to_key(caliber_in)
caliber_in |
Caliber in inches (e.g. |
Integer caliber key.
Bc5dTableManager)Create a directory-backed 5D BC table manager (Bc5dTableManager)
bc5d_manager(table_dir = NULL)bc5d_manager(table_dir = NULL)
table_dir |
Optional directory containing caliber-specific 5D BC tables
(if |
An opaque handle of class "Bc5dManagerHandle".
Bc5dTable) from raw bytesParse a 5D ML BC table (Bc5dTable) from raw bytes
bc5d_table_from_bytes(bytes)bc5d_table_from_bytes(bytes)
bytes |
An R |
An opaque handle of class "Bc5dTableHandle".
Bc5dTable) from diskLoad a caliber-specific 5D ML BC table (Bc5dTable) from disk
bc5d_table_load(path, verified = FALSE, caliber_in = NULL)bc5d_table_load(path, verified = FALSE, caliber_in = NULL)
path |
File path to a |
verified |
Logical; use verified path cache ( |
caliber_in |
Optional expected caliber in inches (used when |
An opaque handle of class "Bc5dTableHandle".
Boundary-layer wind-shear speed ratio vs. height above launch
boundary_layer_speed_ratio( height_rel_launch_m, model = c("logarithmic", "power_law", "ekman_spiral", "none", "custom_layers") )boundary_layer_speed_ratio( height_rel_launch_m, model = c("logarithmic", "power_law", "ekman_spiral", "none", "custom_layers") )
height_rel_launch_m |
Numeric vector of heights relative to launch (m). |
model |
One of |
Numeric vector of wind-speed scaling ratios.
angle_calculations::brent_root_find)Brent's method 1D root finder backed by Rust (angle_calculations::brent_root_find)
brent_root_find(f, a, b, x_tolerance = 1e-08, max_iterations = 100)brent_root_find(f, a, b, x_tolerance = 1e-08, max_iterations = 100)
f |
An R function taking a single numeric argument and returning a numeric scalar. |
a |
Lower bracket bound. |
b |
Upper bracket bound. |
x_tolerance |
Convergence tolerance. |
max_iterations |
Maximum iterations. |
Named list with angle_rad (the root), iterations_used, final_error, success.
ballistics_engine::bridge)Exposes all 23+ bridge commands (meta.capabilities, meta.version, solve,
atmosphere.density_altitude, card.*, profile.*, reticle.*, true.*,
bc5d.info) in-process without subprocess or C-FFI overhead.
bridge_call(request, raw_json = FALSE)bridge_call(request, raw_json = FALSE)
request |
Either a named R list (e.g. |
raw_json |
Logical; if |
Parsed R list response envelope (with ok, api_version,
engine_version, command, result / error), or a JSON string if
raw_json = TRUE.
Calculate air density and speed of sound at one or more altitudes
calculate_atmosphere( altitude_m = 0, temp_override_c = NULL, press_override_hpa = NULL, humidity_percent = 50 )calculate_atmosphere( altitude_m = 0, temp_override_c = NULL, press_override_hpa = NULL, humidity_percent = 50 )
altitude_m |
Numeric vector of altitudes in meters. |
temp_override_c |
Optional temperature override in Celsius. |
press_override_hpa |
Optional station pressure override in hPa. |
humidity_percent |
Relative humidity percent (default |
A data.frame with altitude_m, density_kg_m3, and speed_of_sound_mps.
Circular Error Probable (CEP, 50% radius) from 2D impact coordinates
calculate_cep(wind_drift, drop)calculate_cep(wind_drift, drop)
wind_drift |
Numeric vector of lateral impacts. |
drop |
Numeric vector of vertical impacts. |
Numeric scalar CEP.
Solve wind-aware moving-target intercept lead
calculate_lead( inputs = ballistic_inputs(), speed, angle_deg = 90, range = 500, wind = NULL, atmosphere = NULL, units = c("metric", "imperial") )calculate_lead( inputs = ballistic_inputs(), speed, angle_deg = 90, range = 500, wind = NULL, atmosphere = NULL, units = c("metric", "imperial") )
inputs |
|
speed |
Target speed (m/s in metric, mph in imperial). |
angle_deg |
Target travel angle relative to line of sight (degrees; |
range |
Target range (m in metric, yd in imperial). |
wind |
Optional |
atmosphere |
Optional |
units |
Unit system ( |
Named list with time_of_flight_s, lead_m, lead_mil, lead_moa,
corrected_range_m, iterations (plus imperial equivalents when units = "imperial").
Calculate the zero launch angle (radians)
calculate_zero_angle( inputs = ballistic_inputs(), target_distance = 100, target_height = NULL, wind = NULL, atmosphere = NULL, resolved = FALSE, units = c("metric", "imperial") )calculate_zero_angle( inputs = ballistic_inputs(), target_distance = 100, target_height = NULL, wind = NULL, atmosphere = NULL, resolved = FALSE, units = c("metric", "imperial") )
inputs |
Ballistic inputs list. |
target_distance |
Target distance (m in metric, yd in imperial). |
target_height |
Zero target height in the engine's sight-line frame (m in metric,
in in imperial), measured from the same datum as |
wind |
Optional wind conditions list. |
atmosphere |
Optional atmospheric conditions list. |
resolved |
Logical; if |
units |
Unit system ( |
Numeric scalar zero angle in radians.
Find near and far zero crossing distances from a launch angle
calculate_zero_range( inputs = ballistic_inputs(), zero_angle_rad, target_height = NULL, wind = NULL, atmosphere = NULL, resolved = FALSE, units = c("metric", "imperial") )calculate_zero_range( inputs = ballistic_inputs(), zero_angle_rad, target_height = NULL, wind = NULL, atmosphere = NULL, resolved = FALSE, units = c("metric", "imperial") )
inputs |
Ballistic inputs list. |
zero_angle_rad |
Launch angle in radians. |
target_height |
Zero target height in the engine's sight-line frame (m in metric,
in in imperial), measured from the same datum as |
wind |
Optional wind conditions list. |
atmosphere |
Optional atmospheric conditions list. |
resolved |
Logical; treat atmosphere as already resolved. |
units |
Unit system ( |
Named list with the near and far zero crossings: near_m and far_m in metric,
near_yd and far_yd in imperial (NULL when there is no such crossing).
Validate combined station air conditions
check_station_air( temperature_c = 15, pressure_hpa = 1013.25, humidity_percent = 50, altitude_m = 0 )check_station_air( temperature_c = 15, pressure_hpa = 1013.25, humidity_percent = 50, altitude_m = 0 )
temperature_c |
Ambient temperature (C). |
pressure_hpa |
Station pressure (hPa). |
humidity_percent |
Relative humidity percent ( |
altitude_m |
Station altitude (m). |
Named list with valid, density_kg_m3, speed_of_sound_mps,
density_ratio, and flown_humidity_percent.
Assess whether a bullet stays gyroscopically stable through terminal range
check_trajectory_stability( muzzle_stability, muzzle_velocity_fps, terminal_velocity_fps, spin_decay_factor = 0.95 )check_trajectory_stability( muzzle_stability, muzzle_velocity_fps, terminal_velocity_fps, spin_decay_factor = 0.95 )
muzzle_stability |
Muzzle Sg. |
muzzle_velocity_fps |
Muzzle velocity (fps). |
terminal_velocity_fps |
Terminal velocity (fps). |
spin_decay_factor |
Spin retention factor ( |
Named list with is_stable, terminal_stability, assessment.
ballistics-engine CLI commands and surface availabilityList all ballistics-engine CLI commands and surface availability
cli_commands()cli_commands()
A data.frame with columns name and availability.
Compute whole turret clicks for a linear drop at a range
clicks_for(drop_yd, range_yd, click_spec = "0.1mil")clicks_for(drop_yd, range_yd, click_spec = "0.1mil")
drop_yd |
Linear drop (in the same length unit as |
range_yd |
Range (same length unit as |
click_spec |
Click graduation string. |
Signed click count.
Predict empirical BC degradation cluster and optional velocity-adjusted BC
cluster_bc_predict( caliber_in, weight_grains, bc, drag_model = "G1", velocity_fps = NULL )cluster_bc_predict( caliber_in, weight_grains, bc, drag_model = "G1", velocity_fps = NULL )
caliber_in |
Bullet diameter (inches). |
weight_grains |
Bullet mass (grains). |
bc |
Nominal ballistic coefficient. |
drag_model |
Drag model string (any case). |
velocity_fps |
Optional velocity (fps) to compute multiplier & corrected BC. |
Named list with cluster_id, cluster_name, multiplier, corrected_bc. The
correction is G7-only (its velocity ladders are G7-derived): for any other drag model the
BC comes back unchanged and multiplier is 1.
AngularState by one step dt
Advance combined precession/nutation AngularState by one step dt
combined_angular_motion( params, angular_state, time_s, dt, initial_disturbance = 0.01 )combined_angular_motion( params, angular_state, time_s, dt, initial_disturbance = 0.01 )
params |
Named list of |
angular_state |
Named list of |
time_s |
Current flight time (s). |
dt |
Time step (s). |
initial_disturbance |
Initial tip-off disturbance (rad). |
Updated AngularState list.
card_service::come_ups_v1)Generate a come-ups elevation adjustment card (card_service::come_ups_v1)
come_ups(request)come_ups(request)
request |
Named list matching |
An object of S3 class "ballistics_card" (CardResponseV1).
terminal_commands::compare)Compare multiple ballistic loads side-by-side (terminal_commands::compare)
compare_loads( loads, zero_distance = 100, start = 100, end = 1000, step = 100, wind_speed = 0, wind_direction = 90, adjustment_unit = "mil", windage_unit = adjustment_unit, elevation_click = NULL, windage_click = NULL, elevation_cf = 1, windage_cf = 1, sight_height = if (match.arg(units) == "imperial") 2 else 50, temperature = NULL, pressure = NULL, pressure_type = NULL, humidity = NULL, altitude = NULL, units = c("metric", "imperial"), format = c("table", "json", "csv") )compare_loads( loads, zero_distance = 100, start = 100, end = 1000, step = 100, wind_speed = 0, wind_direction = 90, adjustment_unit = "mil", windage_unit = adjustment_unit, elevation_click = NULL, windage_click = NULL, elevation_cf = 1, windage_cf = 1, sight_height = if (match.arg(units) == "imperial") 2 else 50, temperature = NULL, pressure = NULL, pressure_type = NULL, humidity = NULL, altitude = NULL, units = c("metric", "imperial"), format = c("table", "json", "csv") )
loads |
Either a character vector of CLI-style load specs or a list of
load lists ( |
zero_distance |
Shared zero distance (m or yd). |
start |
Start range (m or yd). |
end |
End range (m or yd). |
step |
Range step (m or yd). |
wind_speed |
Wind speed (m/s or mph). |
wind_direction |
Wind-FROM direction (degrees). |
adjustment_unit |
Elevation unit ( |
windage_unit |
Windage unit. |
elevation_click |
Optional elevation click spec (e.g. |
windage_click |
Optional windage click spec. |
elevation_cf |
Elevation tracking CF. |
windage_cf |
Windage tracking CF. |
sight_height |
Sight height (mm in metric, in in imperial). |
temperature |
Optional ambient temperature (C or F). |
pressure |
Optional station/QNH pressure (hPa or inHg). |
pressure_type |
Optional |
humidity |
Optional relative humidity percent. |
altitude |
Optional altitude (m or ft). |
units |
Unit system ( |
format |
Output format ( |
Named list with text, warnings, and notes.
Convert a compass wind bearing to shooter-relative angle
compass_to_shooter_bearing(bearing, shot_azimuth, radians = FALSE)compass_to_shooter_bearing(bearing, shot_azimuth, radians = FALSE)
bearing |
Compass wind-FROM bearing (degrees or radians). |
shot_azimuth |
Shot compass bearing (degrees or radians). |
radians |
Logical; |
Shooter-relative wind-FROM angle.
Compute instantaneous 6-DOF equations-of-motion derivatives
compute_derivatives( pos, vel, inputs = ballistic_inputs(), wind_vector = NULL, atmosphere = NULL, bc_used = inputs$bc_value %||% 0.5, omega_vector = NULL, time_s = 0, atmo_segments = NULL )compute_derivatives( pos, vel, inputs = ballistic_inputs(), wind_vector = NULL, atmosphere = NULL, bc_used = inputs$bc_value %||% 0.5, omega_vector = NULL, time_s = 0, atmo_segments = NULL )
pos |
Length-3 numeric vector |
vel |
Length-3 numeric vector |
inputs |
Ballistic inputs list (SI). |
wind_vector |
Optional length-3 wind vector (m/s). |
atmosphere |
Optional atmosphere list. |
bc_used |
Effective ballistic coefficient to apply. |
omega_vector |
Optional Earth rotation vector (rad/s). |
time_s |
Flight time (s). |
atmo_segments |
Optional downrange atmosphere segments. |
Length-6 numeric vector c(vx, vy, vz, ax, ay, az).
Compute Weapon Employment Zone (WEZ) hit probability vs. range
compute_wez( velocity, angle = NULL, bc, mass, diameter, num_sims = 200, velocity_std = 0, angle_std = 0.000290888, bc_std = 0, wind_std = 0, wind_direction_std = 0, wind_speed = 0, wind_direction = pi/2, wind_vertical = 0, wind_call_error = 0, target_size = if (match.arg(units) == "imperial") "18x30" else "30x50", wez_start = 100, wez_end = 1000, wez_step = 100, drag_model = "G7", custom_drag_table = NULL, cd_scale = 1, cant = 0, sight_offset_lateral_m = 0, humidity_percent = 50, units = c("metric", "imperial") )compute_wez( velocity, angle = NULL, bc, mass, diameter, num_sims = 200, velocity_std = 0, angle_std = 0.000290888, bc_std = 0, wind_std = 0, wind_direction_std = 0, wind_speed = 0, wind_direction = pi/2, wind_vertical = 0, wind_call_error = 0, target_size = if (match.arg(units) == "imperial") "18x30" else "30x50", wez_start = 100, wez_end = 1000, wez_step = 100, drag_model = "G7", custom_drag_table = NULL, cd_scale = 1, cant = 0, sight_offset_lateral_m = 0, humidity_percent = 50, units = c("metric", "imperial") )
velocity |
Muzzle velocity (m/s in metric, fps in imperial). |
angle |
Zero/launch angle in radians. |
bc |
Ballistic coefficient. |
mass |
Bullet mass (kg in metric, grains in imperial). |
diameter |
Bullet diameter (m in metric, inches in imperial). |
num_sims |
Monte Carlo trials per range. |
velocity_std |
Muzzle velocity SD (m/s or fps). |
angle_std |
Launch angle / precision SD (radians). |
bc_std |
BC standard deviation. |
wind_std |
Wind speed SD (m/s or mph). |
wind_direction_std |
Wind direction SD (radians). |
wind_speed |
Mean wind speed (m/s or mph). |
wind_direction |
Mean wind direction (radians). |
wind_vertical |
Vertical wind (m/s or mph). |
wind_call_error |
Wind-call estimation error SD (m/s or mph). |
target_size |
Spec string as |
wez_start |
Start range (m or yd). |
wez_end |
End range (m or yd). |
wez_step |
Range step (m or yd). |
drag_model |
Drag model string (default |
custom_drag_table |
Optional custom drag table. |
cd_scale |
Whole-curve drag multiplier. |
cant |
Rifle cant angle (radians). |
sight_offset_lateral_m |
Lateral sight offset (m). |
humidity_percent |
Relative humidity percent ( |
units |
Unit system ( |
An object of S3 class "ballistics_wez".
95% confidence ellipse from 2D impact coordinates
confidence_ellipse(wind_drift, drop)confidence_ellipse(wind_drift, drop)
wind_drift |
Numeric vector of lateral impacts. |
drop |
Numeric vector of vertical impacts. |
Named list with center_x, center_y, semi_major, semi_minor, angle_rad.
BernoulliConfidenceSequence handleCreate an anytime-valid BernoulliConfidenceSequence handle
confidence_sequence(level = c("p95", "p90", "p99"))confidence_sequence(level = c("p95", "p90", "p99"))
level |
Confidence level: |
An opaque handle of class "ConfidenceSeqHandle".
Convert a scalar BC between drag-model families at a given Mach number
convert_bc_at_mach( source_bc, source_model = "G1", target_model = "G7", mach = 2 )convert_bc_at_mach( source_bc, source_model = "G1", target_model = "G7", mach = 2 )
source_bc |
Source ballistic coefficient. |
source_model |
Source drag model (e.g. |
target_model |
Target drag model (e.g. |
mach |
Mach number. |
Named list (ScalarBcConversionV1).
Convert a scalar BC between drag-model families at a given velocity (fps)
convert_bc_at_velocity( source_bc, source_model = "G1", target_model = "G7", velocity_fps = 2650, speed_of_sound_fps = 340.29/0.3048 )convert_bc_at_velocity( source_bc, source_model = "G1", target_model = "G7", velocity_fps = 2650, speed_of_sound_fps = 340.29/0.3048 )
source_bc |
Source ballistic coefficient. |
source_model |
Source drag model. |
target_model |
Target drag model. |
velocity_fps |
Velocity in feet per second. |
speed_of_sound_fps |
Speed of sound in feet per second (default ICAO standard,
|
Named list (ScalarBcConversionV1).
Convert velocity-banded BC segments between reference drag families
convert_bc_segments( segments, source_model = "G1", target_model = "G7", speed_of_sound_fps = 340.29/0.3048 )convert_bc_segments( segments, source_model = "G1", target_model = "G7", speed_of_sound_fps = 340.29/0.3048 )
segments |
A |
source_model |
Source drag model. |
target_model |
Target drag model. |
speed_of_sound_fps |
Speed of sound in fps. |
Named list (BandedBcConversionV1).
Back-solve true muzzle velocity from a downrange chronograph reading
correct_chrono_velocity( measured_velocity, screen_distance_m = 3, bc = 0.5, drag_model = "G7", mass = if (match.arg(units) == "imperial") 168 else 0.010886, diameter = if (match.arg(units) == "imperial") 0.308 else 0.00782, temperature = NULL, pressure = NULL, humidity_pct = 50, altitude = 0, bc_segments = NULL, units = c("metric", "imperial") )correct_chrono_velocity( measured_velocity, screen_distance_m = 3, bc = 0.5, drag_model = "G7", mass = if (match.arg(units) == "imperial") 168 else 0.010886, diameter = if (match.arg(units) == "imperial") 0.308 else 0.00782, temperature = NULL, pressure = NULL, humidity_pct = 50, altitude = 0, bc_segments = NULL, units = c("metric", "imperial") )
measured_velocity |
Measured velocity (m/s in metric, fps in imperial). |
screen_distance_m |
Distance from muzzle to chronograph screen (meters). |
bc |
Ballistic coefficient. |
drag_model |
|
mass |
Bullet mass (kg in metric, grains in imperial). |
diameter |
Bullet diameter (m in metric, inches in imperial). |
temperature |
Ambient temperature (C in metric, F in imperial), or |
pressure |
Station pressure (hPa in metric, inHg in imperial), or |
humidity_pct |
Relative humidity percent ( |
altitude |
Station altitude (m in metric, ft in imperial). |
bc_segments |
Optional velocity-BC segments |
units |
Unit system ( |
Named list with muzzle_velocity_mps (or muzzle_velocity_fps) and iterations.
Courtney-Miller plastic-tip stability correction
courtney_miller_plastic_tip( uncorrected_sg, caliber_inches, total_length_inches, tip_length_inches )courtney_miller_plastic_tip( uncorrected_sg, caliber_inches, total_length_inches, tip_length_inches )
uncorrected_sg |
Uncorrected Miller Sg. |
caliber_inches |
Caliber (inches). |
total_length_inches |
Total length including tip (inches). |
tip_length_inches |
Plastic tip length (inches). |
Corrected Sg.
Crosswind aerodynamic-jump sensitivity (MOA per m/s)
crosswind_jump_sensitivity( muzzle_velocity_mps, spin_rate_rad_s, caliber_m, mass_kg, twist_rate_calibers, is_right_twist = TRUE )crosswind_jump_sensitivity( muzzle_velocity_mps, spin_rate_rad_s, caliber_m, mass_kg, twist_rate_calibers, is_right_twist = TRUE )
muzzle_velocity_mps |
Muzzle velocity (m/s). |
spin_rate_rad_s |
Spin rate (rad/s). |
caliber_m |
Caliber (m). |
mass_kg |
Mass (kg). |
twist_rate_calibers |
Twist rate in calibers/turn. |
is_right_twist |
Logical. |
Vertical jump in MOA per m/s of crosswind (the engine evaluates 1 mph and the jump is linear in the crosswind).
Damped yaw of repose and convergence rate
damped_yaw_of_repose( stability_factor, velocity_mps, spin_rate_rad_s, wind_velocity_mps = 0, pitch_rate_rad_s = 0, air_density_kg_m3 = 1.225, caliber_inches = 0.308, length_inches = 1.24, mass_grains = 168, mach = 2, bullet_type = "match" )damped_yaw_of_repose( stability_factor, velocity_mps, spin_rate_rad_s, wind_velocity_mps = 0, pitch_rate_rad_s = 0, air_density_kg_m3 = 1.225, caliber_inches = 0.308, length_inches = 1.24, mass_grains = 168, mach = 2, bullet_type = "match" )
stability_factor |
Sg. |
velocity_mps |
Velocity (m/s). |
spin_rate_rad_s |
Spin rate (rad/s). |
wind_velocity_mps |
Crosswind (m/s). |
pitch_rate_rad_s |
Pitch rate (rad/s). |
air_density_kg_m3 |
Air density (kg/m^3). |
caliber_inches |
Caliber (inches). |
length_inches |
Length (inches). |
mass_grains |
Mass (grains). |
mach |
Mach number. |
bullet_type |
Pitch-damping bullet type: |
Named list with yaw_rad and convergence_rate.
solve-json v1 requestDecode and validate a solve-json v1 request
decode_solve_request_v1(request)decode_solve_request_v1(request)
request |
Named R list or JSON string conforming to |
Validated request list, or a SolveErrorEnvelopeV1 list on error.
Get legacy default form factor by bullet name and drag model
default_form_factor(bullet_name, drag_model = "G1")default_form_factor(bullet_name, drag_model = "G1")
bullet_name |
Bullet name string. |
drag_model |
Drag model string. |
Numeric form factor.
Estimate default barrel twist rate (inches/turn) targeting Sg = 2.0
default_twist_inches(diameter_m, mass_kg, muzzle_velocity_mps)default_twist_inches(diameter_m, mass_kg, muzzle_velocity_mps)
diameter_m |
Bullet diameter (m). |
mass_kg |
Bullet mass (kg). |
muzzle_velocity_mps |
Muzzle velocity (m/s). |
Twist rate in inches per turn.
atmosphere.density_altitude v1 serviceRun the versioned atmosphere.density_altitude v1 service
density_altitude(request)density_altitude(request)
request |
Named list conforming to |
Named list representing DensityAltitudeResponseV1.
Density-matched standard altitude (meters)
density_matched_altitude( temperature_c, station_pressure_hpa, humidity_percent = 50 )density_matched_altitude( temperature_c, station_pressure_hpa, humidity_percent = 50 )
temperature_c |
Ambient temperature in Celsius. |
station_pressure_hpa |
Station pressure in hPa. |
humidity_percent |
Relative humidity percent ( |
Density-matched standard altitude in meters.
Interpolate Mach-keyed BC segments
derivatives_interpolated_bc(mach, segments, inputs = NULL)derivatives_interpolated_bc(mach, segments, inputs = NULL)
mach |
Numeric vector of Mach numbers. |
segments |
2-column |
inputs |
Optional |
Numeric vector of interpolated BCs.
truing_service::derive_dsf_point_v1)Derive a Mach-keyed DSF point from an observed drop (truing_service::derive_dsf_point_v1)
derive_dsf_point(request)derive_dsf_point(request)
request |
Named list matching |
Named list (DsfPointResultV1).
truing_service::dial_plan_v1
Compute a dial/hold/hybrid engagement plan via truing_service::dial_plan_v1
dial_plan(request)dial_plan(request)
request |
Named list matching |
Named list (DialPlanReportV1).
Discretize a candidate range interval (yards) for truing experiment planning
discretize_truing_ranges(start_yd, end_yd, step_yd)discretize_truing_ranges(start_yd, end_yd, step_yd)
start_yd |
Start range (yd). |
end_yd |
End range (yd). |
step_yd |
Step (yd). |
Numeric vector of candidate ranges in yards.
rows_per_page, page_count)Query PDF dope card pagination layout (rows_per_page, page_count)
dope_card_layout_info(row_count, font_scale = 1)dope_card_layout_info(row_count, font_scale = 1)
row_count |
Number of rows to print. |
font_scale |
Font scale factor in |
Named list with rows_per_page and page_count.
Evaluate standard reference drag coefficient Cd(Mach) (vectorized)
drag_coefficient(mach, drag_model = "G7")drag_coefficient(mach, drag_model = "G7")
mach |
Numeric vector of Mach numbers. |
drag_model |
One of |
Numeric vector of drag coefficients.
Evaluate drag coefficient with optional transonic and Reynolds corrections
drag_coefficient_full( mach, drag_model = "G7", apply_transonic_correction = FALSE, apply_reynolds_correction = FALSE, projectile_shape = NULL, caliber_in = NULL, weight_grains = NULL, velocity_mps = NULL, air_density_kg_m3 = NULL, temperature_c = NULL )drag_coefficient_full( mach, drag_model = "G7", apply_transonic_correction = FALSE, apply_reynolds_correction = FALSE, projectile_shape = NULL, caliber_in = NULL, weight_grains = NULL, velocity_mps = NULL, air_density_kg_m3 = NULL, temperature_c = NULL )
mach |
Numeric vector of Mach numbers. |
drag_model |
Drag model string. |
apply_transonic_correction |
Logical; kept for compatibility. It has no effect on the reference G tables, which already include transonic drag (the engine does not add it a second time, MBA-1155). |
apply_reynolds_correction |
Logical; include low-Reynolds correction. |
projectile_shape |
Optional shape ( |
caliber_in |
Optional bullet diameter in inches. |
weight_grains |
Optional bullet weight in grains. |
velocity_mps |
Optional velocity in m/s (for Reynolds calculation). |
air_density_kg_m3 |
Optional air density in kg/m^3. |
temperature_c |
Optional temperature in Celsius. |
Numeric vector of corrected drag coefficients.
DragTable handleConstruct a custom or reference DragTable handle
drag_table(mach = NULL, cd = NULL, csv = NULL, file = NULL, reference = NULL)drag_table(mach = NULL, cd = NULL, csv = NULL, file = NULL, reference = NULL)
mach |
Numeric vector of Mach numbers (when constructing directly). |
cd |
Numeric vector of drag coefficients (when constructing directly). |
csv |
Optional CSV string with Mach/Cd columns. |
file |
Optional file path to load a drag table from. |
reference |
Optional built-in reference drag model ( |
An opaque handle of class "DragTableHandle".
Convert linear drop and range into angular turret adjustment (vectorized)
drop_to_adjustment(drop_yd, range_yd, unit = c("mil", "moa", "smoa", "iphy"))drop_to_adjustment(drop_yd, range_yd, unit = c("mil", "moa", "smoa", "iphy"))
drop_yd |
Numeric vector of drops (same unit as |
range_yd |
Numeric vector of ranges. |
unit |
One of |
Numeric vector of angular adjustments.
DsfTable) handleCreate a Mach-keyed Drop Scale Factor (DsfTable) handle
dsf_table(points = NULL)dsf_table(points = NULL)
points |
Optional |
An opaque handle of class "DsfTableHandle".
Compute the DSF truing window start distance (meters) from Mach 0.9 distance
dsf_window_start(mach_0_9_distance_m)dsf_window_start(mach_0_9_distance_m)
mach_0_9_distance_m |
Distance (m) where velocity drops below Mach 0.9. |
Numeric scalar distance in meters, or NULL.
Dynamic gyroscopic stability from bullet geometry and spin rate
dynamic_stability_spin( bullet_mass_grains, velocity_mps, spin_rate_rad_s, caliber_inches, length_inches, air_density_kg_m3 = 1.225 )dynamic_stability_spin( bullet_mass_grains, velocity_mps, spin_rate_rad_s, caliber_inches, length_inches, air_density_kg_m3 = 1.225 )
bullet_mass_grains |
Bullet weight (grains). |
velocity_mps |
Velocity (m/s). |
spin_rate_rad_s |
Spin rate (rad/s). |
caliber_inches |
Caliber (inches). |
length_inches |
Bullet length (inches). |
air_density_kg_m3 |
Air density (kg/m^3). |
Stability factor.
BallisticInputs
Compute effective gyroscopic stability factor (Sg) from BallisticInputs
effective_sg(inputs = ballistic_inputs(), temp_c = 15, press_hpa = 1013.25)effective_sg(inputs = ballistic_inputs(), temp_c = 15, press_hpa = 1013.25)
inputs |
Ballistic inputs list (SI). |
temp_c |
Ambient temperature (C). |
press_hpa |
Station pressure (hPa). |
Effective Miller stability factor Sg.
Get the underlying ballistics-engine version
engine_version()engine_version()
Character scalar: the ballistics-engine version this package was built against,
as the engine itself reports it (e.g. "0.51.0"). The package's own version is the
engine's plus an optional fourth, package-only component (e.g. 0.51.0.1).
SpinDriftComponents)Full enhanced spin drift decomposition (SpinDriftComponents)
enhanced_spin_drift( bullet_mass_grains, velocity_mps, twist_rate_in, bullet_diameter_in, bullet_length_in, is_twist_right = TRUE, time_s = 1, air_density_kg_m3 = 1.225, crosswind_mps = 0, pitch_rate_rad_s = 0, use_pitch_damping = TRUE )enhanced_spin_drift( bullet_mass_grains, velocity_mps, twist_rate_in, bullet_diameter_in, bullet_length_in, is_twist_right = TRUE, time_s = 1, air_density_kg_m3 = 1.225, crosswind_mps = 0, pitch_rate_rad_s = 0, use_pitch_damping = TRUE )
bullet_mass_grains |
Bullet mass in grains. |
velocity_mps |
Velocity (m/s). |
twist_rate_in |
Barrel twist (inches/turn). |
bullet_diameter_in |
Bullet diameter in inches. |
bullet_length_in |
Bullet length in inches. |
is_twist_right |
Logical. |
time_s |
Time of flight (s). |
air_density_kg_m3 |
Air density (kg/m^3). |
crosswind_mps |
Crosswind (m/s). |
pitch_rate_rad_s |
Pitch rate (rad/s). |
use_pitch_damping |
Logical. |
Named list with all 11 SpinDriftComponents fields.
Simplified enhanced spin drift (meters)
enhanced_spin_drift_simple( time_s, stability, velocity_mps, twist_rate, is_twist_right = TRUE, caliber = 0.00782 )enhanced_spin_drift_simple( time_s, stability, velocity_mps, twist_rate, is_twist_right = TRUE, caliber = 0.00782 )
time_s |
Time of flight (s). |
stability |
Stability Sg. |
velocity_mps |
Velocity (m/s). |
twist_rate |
Twist rate (inches/turn). |
is_twist_right |
Logical. |
caliber |
Ignored: the engine's simple model does not use the caliber. Kept for compatibility. |
Spin drift in meters.
Epicyclic precession and nutation frequencies (rad/s)
epicyclic_frequencies( spin_inertia, transverse_inertia, spin_rate_rad_s, stability_factor )epicyclic_frequencies( spin_inertia, transverse_inertia, spin_rate_rad_s, stability_factor )
spin_inertia |
Axial inertia Ix (kg*m^2). |
transverse_inertia |
Transverse inertia Iy (kg*m^2). |
spin_rate_rad_s |
Spin rate (rad/s). |
stability_factor |
Sg. |
Named list with precession_rad_s and nutation_rad_s.
(pitch_rad, yaw_rad) at time t
Compute instantaneous epicyclic (pitch_rad, yaw_rad) at time t
epicyclic_motion( spin_inertia, transverse_inertia, spin_rate_rad_s, stability_factor, time_s, initial_yaw_rad )epicyclic_motion( spin_inertia, transverse_inertia, spin_rate_rad_s, stability_factor, time_s, initial_yaw_rad )
spin_inertia |
Ix (kg*m^2). |
transverse_inertia |
Iy (kg*m^2). |
spin_rate_rad_s |
Spin rate (rad/s). |
stability_factor |
Sg. |
time_s |
Time (s). |
initial_yaw_rad |
Initial yaw (rad). |
Named list with pitch_rad and yaw_rad.
Propagate input uncertainties to impact covariance and ranked variance shares
error_budget(request, sources, ranges_m, target = NULL)error_budget(request, sources, ranges_m, target = NULL)
request |
|
sources |
Named list or named numeric vector mapping |
ranges_m |
Numeric vector of ranges (m). |
target |
Optional |
An object of S3 class "ballistics_error_budget" (ErrorBudgetReportV1).
Estimate ballistic coefficient from observed drop or velocity data
estimate_bc( velocity, mass, diameter, points, drag_model = "G7", mode = c("drop", "velocity"), atmosphere = NULL, zero_range = NULL, sight_height = if (match.arg(units) == "imperial") 2 else 0.05, units = c("metric", "imperial") )estimate_bc( velocity, mass, diameter, points, drag_model = "G7", mode = c("drop", "velocity"), atmosphere = NULL, zero_range = NULL, sight_height = if (match.arg(units) == "imperial") 2 else 0.05, units = c("metric", "imperial") )
velocity |
Muzzle velocity (m/s in metric, fps in imperial). |
mass |
Bullet mass (kg in metric, grains in imperial). |
diameter |
Bullet diameter (m in metric, inches in imperial). |
points |
2-column |
drag_model |
Drag model string (default |
mode |
Fit mode: |
atmosphere |
Optional atmospheric conditions list. |
zero_range |
Optional zero range (m in metric, yd in imperial). |
sight_height |
Sight height above bore (m in metric, in in imperial). |
units |
Unit system ( |
Named list with bc, rms_error, drag_model, mode, at_bound.
Empirically estimate velocity-banded BC segments from bullet characteristics
estimate_bc_segments( base_bc, caliber_in = 0.308, weight_grains = 168, model = "Match", drag_model = "G7" )estimate_bc_segments( base_bc, caliber_in = 0.308, weight_grains = 168, model = "Match", drag_model = "G7" )
base_bc |
Nominal BC. |
caliber_in |
Bullet diameter (inches). |
weight_grains |
Bullet mass (grains). |
model |
Bullet model string (e.g. |
drag_model |
Drag model string (e.g. |
A data.frame with columns velocity_min, velocity_max, bc_value.
Estimate bullet length (meters) from diameter and mass
estimate_bullet_length(diameter_m, mass_kg)estimate_bullet_length(diameter_m, mass_kg)
diameter_m |
Bullet diameter (m). |
mass_kg |
Bullet mass (kg). |
Estimated bullet length in meters.
Evaluate bullet load against all USPSA, IDPA, and SASS power-factor divisions
evaluate_power_factor(weight_gr, velocity_fps)evaluate_power_factor(weight_gr, velocity_fps)
weight_gr |
Bullet weight in grains. |
velocity_fps |
Muzzle velocity in fps. |
A data.frame with organization, class, min_pf, pf_pass,
min_velocity_fps, max_velocity_fps, velocity_pass, pass.
Explain differences between two solve requests by symmetric counterfactual group swaps
explain_difference(request_a, request_b, ranges_m)explain_difference(request_a, request_b, ranges_m)
request_a |
Baseline |
request_b |
Comparison |
ranges_m |
Numeric vector of ranges (m). |
Named list (SolutionDiffReportV1).
ProfileData list to an ArcherBC2 .a7p binary fileExport a ProfileData list to an ArcherBC2 .a7p binary file
export_a7p(profile, file = NULL)export_a7p(profile, file = NULL)
profile |
Named list matching |
file |
Optional output file path to write the |
Named list with bytes (R raw), dropped_fields, not_carried,
and warnings.
FAA-rule density altitude (feet)
faa_density_altitude(station_pressure_hpa, temperature_f)faa_density_altitude(station_pressure_hpa, temperature_f)
station_pressure_hpa |
Station pressure in hPa. |
temperature_f |
Ambient temperature in degrees Fahrenheit. |
Density altitude in feet.
Exposes ballistics_engine::fast_trajectory::fast_integrate and
fast_integrate_with_segments.
fast_integrate( inputs = ballistic_inputs(), initial_state, t_span = c(0, 10), horiz_m = 1000, vert_m = 0, atmosphere = NULL, wind_segments = NULL, atmo_segments = NULL, query_times = NULL )fast_integrate( inputs = ballistic_inputs(), initial_state, t_span = c(0, 10), horiz_m = 1000, vert_m = 0, atmosphere = NULL, wind_segments = NULL, atmo_segments = NULL, query_times = NULL )
inputs |
Ballistic inputs list (SI). |
initial_state |
Length-6 numeric vector |
t_span |
Length-2 numeric vector |
horiz_m |
Target horizontal range (m). |
vert_m |
Target vertical height (m). Not read by the engine's fast integrator (only the horizontal target range ends the flight); kept for compatibility. |
atmosphere |
Optional atmosphere list (station or uniform). |
wind_segments |
Optional wind segments |
atmo_segments |
Optional downrange atmosphere segments |
query_times |
Optional numeric vector of query times (s) for dense interpolation. |
List with success, trajectory (data.frame), t_events, and interpolated.
Format a built-in reference drag curve as table, CSV, or JSON text
format_reference_drag_curve( drag_model = "G7", format = c("table", "csv", "json") )format_reference_drag_curve( drag_model = "G7", format = c("table", "csv", "json") )
drag_model |
Drag model string. |
format |
One of |
Character scalar.
ReticleDescription as table or JSON textFormat a ReticleDescription as table or JSON text
format_reticle_description(reticle, format = c("table", "json"))format_reticle_description(reticle, format = c("table", "json"))
reticle |
Named list ( |
format |
|
Character scalar.
SAAMI free-recoil momentum-balance calculator
free_recoil( bullet_mass, charge_mass, muzzle_velocity, firearm_mass, firearm_type = c("rifle", "pistol", "shotgun_average", "shotgun_long"), gas_velocity_factor = NULL, gas_velocity_fixed = NULL, units = c("metric", "imperial") )free_recoil( bullet_mass, charge_mass, muzzle_velocity, firearm_mass, firearm_type = c("rifle", "pistol", "shotgun_average", "shotgun_long"), gas_velocity_factor = NULL, gas_velocity_fixed = NULL, units = c("metric", "imperial") )
bullet_mass |
Bullet mass (kg in metric, grains in imperial). |
charge_mass |
Propellant charge mass (kg in metric, grains in imperial). |
muzzle_velocity |
Muzzle velocity (m/s in metric, fps in imperial). |
firearm_mass |
Firearm mass including optic/accessories (kg in metric, lb in imperial). |
firearm_type |
SAAMI gas-velocity preset: |
gas_velocity_factor |
Optional custom multiplier on muzzle velocity. |
gas_velocity_fixed |
Optional fixed gas velocity (m/s in metric, fps in imperial). |
units |
Unit system ( |
Named list with recoil_velocity_mps, recoil_energy_j,
impulse_ns, gas_velocity_mps (plus imperial equivalents when units = "imperial").
DopeCardConfig and CardRowsRender a printable PDF dope card directly from DopeCardConfig and CardRows
generate_dope_card_pdf( config, rows, range_unit = c("yards", "meters"), file = NULL )generate_dope_card_pdf( config, rows, range_unit = c("yards", "meters"), file = NULL )
config |
Named list of |
rows |
A |
range_unit |
|
file |
Optional file path to write the PDF bytes to disk. |
An R raw vector containing the PDF document bytes.
Pure gyroscopic spin drift component (meters)
gyroscopic_drift( stability_factor, yaw_rad, velocity_mps, time_s, is_right_twist = TRUE )gyroscopic_drift( stability_factor, yaw_rad, velocity_mps, time_s, is_right_twist = TRUE )
stability_factor |
Gyroscopic stability Sg. |
yaw_rad |
Yaw angle (rad). |
velocity_mps |
Velocity (m/s). |
time_s |
Time of flight (s). |
is_right_twist |
Logical. |
Gyroscopic drift in meters.
HoldCurve handleSupports $at_range(range_m), $far_zero_range_m(), $reach_m(),
$max_sampled_range_m(), $sample_ranges_m(),
$range_for_angular_drop_mil(drop_mil), and $adaptive_card(...).
hold_curve(load = list(), max_range_m = 1500)hold_curve(load = list(), max_range_m = 1500)
load |
Named list matching |
max_range_m |
Maximum curve range in meters. |
An opaque handle of class "HoldCurveHandle".
(drop_mil, wind_mil) hold point within a reticleLocate a (drop_mil, wind_mil) hold point within a reticle
hold_point_in_reticle( drop_mil, wind_mil, magnification = 10, reticle, format = NULL )hold_point_in_reticle( drop_mil, wind_mil, magnification = 10, reticle, format = NULL )
drop_mil |
Required holdover (MIL, positive down). |
wind_mil |
Required wind hold (MIL, positive right). |
magnification |
Scope magnification. |
reticle |
Named list ( |
format |
Optional text format ( |
Named list (ReticleHold) or formatted string.
Identify bullet type classification, sectional density, and degradation factors
identify_bullet_type( model = "Match", weight_grains = 168, caliber_in = 0.308, bc_value = NULL, drag_model = "G7" )identify_bullet_type( model = "Match", weight_grains = 168, caliber_in = 0.308, bc_value = NULL, drag_model = "G7" )
model |
Bullet model string. |
weight_grains |
Bullet weight (grains). |
caliber_in |
Bullet diameter (inches). |
bc_value |
Optional BC value. |
drag_model |
Drag model string. |
Named list with bullet_type, sectional_density, drop, transition_curve.
.a7p binary ballistic profileImport an ArcherBC2 .a7p binary ballistic profile
import_a7p(bytes = NULL, file = NULL, name_override = NULL, zero_click = NULL)import_a7p(bytes = NULL, file = NULL, name_override = NULL, zero_click = NULL)
bytes |
An R |
file |
Optional file path to read |
name_override |
Optional replacement profile name. |
zero_click |
Optional source-device click graduation (e.g. |
Named list with profile, envelope, unknown_field_count, and
report (mapped, unmapped, warnings).
.reticle XML drawing documentImport a third-party .reticle XML drawing document
import_reticle_document(xml = NULL, file = NULL)import_reticle_document(xml = NULL, file = NULL)
xml |
XML string (or pass |
file |
Optional path to a |
Named list with reticle (ReticleDescription) and report.
Import a Ventum JSON reticle specification
import_ventum_reticle(json = NULL, file = NULL)import_ventum_reticle(json = NULL, file = NULL)
json |
JSON string (or pass |
file |
Optional path to a Ventum JSON reticle file. |
Named list with reticle (ReticleDescription) and report.
Exposes ballistics_engine::trajectory_integration::try_integrate_trajectory.
integrate_trajectory( initial_state, t_span = c(0, 5), params = list(), method = c("RK45", "RK4", "Euler"), tolerance = 1e-06, max_step = 0.01 )integrate_trajectory( initial_state, t_span = c(0, 5), params = list(), method = c("RK45", "RK4", "Euler"), tolerance = 1e-06, max_step = 0.01 )
initial_state |
Length-6 numeric vector |
t_span |
Length-2 numeric vector |
params |
Named list of |
method |
Integrator method: |
tolerance |
Relative/absolute error tolerance for adaptive RK45. |
max_step |
Maximum integration step size (s). |
A data.frame with columns t, x, y, z, vx, vy, vz.
Interpolate a measured powder temperature-to-velocity curve
interpolate_powder_curve(curve, temps_c)interpolate_powder_curve(curve, temps_c)
curve |
2-column |
temps_c |
Numeric vector of query temperatures in Celsius. |
Numeric vector of interpolated muzzle velocities (m/s).
Compute moving-target lead components from an explicit time of flight
lead_from_tof(speed_mps, angle_deg = 90, tof_s, range_m)lead_from_tof(speed_mps, angle_deg = 90, tof_s, range_m)
speed_mps |
Target speed (m/s). |
angle_deg |
Target heading angle relative to line of sight (degrees; |
tof_s |
Bullet time of flight (s). |
range_m |
Target range (m). |
Named list with lead_m, lead_mil, lead_moa.
Limit-cycle yaw angle (radians)
limit_cycle_yaw( velocity_mps, spin_rate_rad_s, stability_factor, spin_inertia = NULL, transverse_inertia = NULL )limit_cycle_yaw( velocity_mps, spin_rate_rad_s, stability_factor, spin_inertia = NULL, transverse_inertia = NULL )
velocity_mps |
Velocity (m/s). |
spin_rate_rad_s |
Spin rate (rad/s). |
stability_factor |
Sg. |
spin_inertia |
Optional Ix (kg*m^2). |
transverse_inertia |
Optional Iy (kg*m^2). |
Limit-cycle yaw angle (rad).
Litz crosswind aerodynamic-jump estimator (MOA)
litz_crosswind_jump( sg, length_calibers, crosswind_from_right_mph, is_right_twist = TRUE )litz_crosswind_jump( sg, length_calibers, crosswind_from_right_mph, is_right_twist = TRUE )
sg |
Gyroscopic stability factor Sg. |
length_calibers |
Bullet length in calibers. |
crosswind_from_right_mph |
Signed crosswind from right (mph). |
is_right_twist |
Logical. |
Signed vertical aerodynamic jump in MOA.
Litz spin drift approximation (vectorized)
litz_spin_drift( sg, t_s, is_twist_right = TRUE, units = c("metric", "imperial") )litz_spin_drift( sg, t_s, is_twist_right = TRUE, units = c("metric", "imperial") )
sg |
Numeric vector of gyroscopic stability factors (Sg). |
t_s |
Numeric vector of times of flight (seconds). |
is_twist_right |
Logical; |
units |
|
Numeric vector of spin drift displacements.
Local atmosphere lapse from base station conditions
local_atmosphere( altitude_m, base_alt_m = 0, base_temp_c = 15, base_press_hpa = 1013.25, base_ratio = 1, humidity_percent = 50 )local_atmosphere( altitude_m, base_alt_m = 0, base_temp_c = 15, base_press_hpa = 1013.25, base_ratio = 1, humidity_percent = 50 )
altitude_m |
Target altitude (m). |
base_alt_m |
Base station altitude (m). |
base_temp_c |
Base station temperature (C). |
base_press_hpa |
Base station pressure (hPa). |
base_ratio |
Base station density ratio. |
humidity_percent |
Optional relative humidity percent (if |
Named list with density_kg_m3 and speed_of_sound_mps.
.drg Doppler drag fileDetect whether text looks like a .drg Doppler drag file
looks_like_drg(text)looks_like_drg(text)
text |
Character scalar. |
Logical scalar.
Magnus lateral drift component (meters)
magnus_drift( velocity_mps, spin_rate_rad_s, yaw_rad, air_density_kg_m3, caliber_inches, time_s, mass_grains )magnus_drift( velocity_mps, spin_rate_rad_s, yaw_rad, air_density_kg_m3, caliber_inches, time_s, mass_grains )
velocity_mps |
Velocity (m/s). |
spin_rate_rad_s |
Spin rate (rad/s). |
yaw_rad |
Yaw angle (rad). |
air_density_kg_m3 |
Air density (kg/m^3). |
caliber_inches |
Caliber (inches). |
time_s |
Time of flight (s). |
mass_grains |
Bullet weight (grains). |
Magnus drift component in meters.
Linear-interpolated percentile over a sorted numeric vector
mc_percentile(sorted_values, p)mc_percentile(sorted_values, p)
sorted_values |
Sorted numeric vector. |
p |
Probability in |
Numeric scalar percentile.
Moist-air speed of sound (vectorized)
moist_speed_of_sound( temp_k = 288.15, pressure_pa = 101325, humidity_percent = 50 )moist_speed_of_sound( temp_k = 288.15, pressure_pa = 101325, humidity_percent = 50 )
temp_k |
Temperature in Kelvin (numeric vector). |
pressure_pa |
Pressure in Pascals (numeric vector). |
humidity_percent |
Relative humidity percent |
Numeric vector of speeds of sound in m/s.
Axial moment of inertia Ix (kg*m^2)
moment_of_inertia(mass_kg, caliber_m, length_m, shape = "boat_tail")moment_of_inertia(mass_kg, caliber_m, length_m, shape = "boat_tail")
mass_kg |
Mass (kg). |
caliber_m |
Caliber (m). |
length_m |
Length (m). |
shape |
Shape for the moment of inertia: |
Axial moment of inertia (kg*m^2).
Compute moving-target uncertainty ring radius
mover_ring(target_speed_mps, time_s, downrange_m)mover_ring(target_speed_mps, time_s, downrange_m)
target_speed_mps |
Target speed (m/s). |
time_s |
Time of flight (s). |
downrange_m |
Downrange distance (m). |
Named list with radius_m and radius_mil.
Multi-observation joint MV and BC truing
multi_observation_truing( observations, drop_unit = c("mil", "moa", "in"), bc_input = 0.25, drag_model = "G7", mass_gr = 168, diameter_in = 0.308, zero_yd = 100, sight_in = 2, temperature_f = NULL, pressure_inhg = NULL, humidity_pct = 50, altitude_ft = 0, bc_segments = NULL, dial_cf = 1, units = c("imperial", "metric") )multi_observation_truing( observations, drop_unit = c("mil", "moa", "in"), bc_input = 0.25, drag_model = "G7", mass_gr = 168, diameter_in = 0.308, zero_yd = 100, sight_in = 2, temperature_f = NULL, pressure_inhg = NULL, humidity_pct = 50, altitude_ft = 0, bc_segments = NULL, dial_cf = 1, units = c("imperial", "metric") )
observations |
|
drop_unit |
|
bc_input |
Nominal BC. |
drag_model |
|
mass_gr |
Bullet weight (grains). |
diameter_in |
Bullet diameter (inches). |
zero_yd |
Zero distance (yards). |
sight_in |
Sight height (inches; default 2, the CLI's). |
temperature_f |
Optional ambient temperature (F). |
pressure_inhg |
Optional station pressure (inHg). |
humidity_pct |
Relative humidity percent. |
altitude_ft |
Station altitude (ft). |
bc_segments |
Optional velocity-BC segments. |
dial_cf |
Scope elevation tracking correction factor (default |
units |
Unit system for parsing string |
Named list (MultiTruingReport).
Compute the recommended MV calibration range window (meters) from Mach 1.2 distance
mv_calibration_window(mach_1_2_distance_m)mv_calibration_window(mach_1_2_distance_m)
mach_1_2_distance_m |
Distance (m) where velocity drops below Mach 1.2. |
Named list list(near_m, far_m), or NULL.
t
Damped nutation amplitude at time t
nutation_amplitude( initial_disturbance_rad, time_s, nutation_frequency, damping_factor, spin_rate_rad_s )nutation_amplitude( initial_disturbance_rad, time_s, nutation_frequency, damping_factor, spin_rate_rad_s )
initial_disturbance_rad |
Initial disturbance (rad). |
time_s |
Time (s). |
nutation_frequency |
Nutation frequency (rad/s). |
damping_factor |
Damping fraction. |
spin_rate_rad_s |
Spin rate (rad/s). |
Nutation amplitude (rad).
Bivariate normal hit probability over a rectangular or circular target
p_hit_bivariate(var_drop, var_wind, cov, target)p_hit_bivariate(var_drop, var_wind, cov, target)
var_drop |
Drop variance (m^2). |
var_wind |
Windage variance (m^2). |
cov |
Drop-windage covariance (m^2). |
target |
Target geometry list: either |
Hit probability in [0, 1].
"0.1mil", "0.25moa", "1/8moa")Parse a turret click graduation specification (e.g. "0.1mil", "0.25moa", "1/8moa")
parse_click_value(spec)parse_click_value(spec)
spec |
Click graduation string. |
Named list with size, base, and size_mil.
.drg Doppler drag-curve text file or stringParse a .drg Doppler drag-curve text file or string
parse_drg(text = NULL, file = NULL)parse_drg(text = NULL, file = NULL)
text |
|
file |
Optional path to a |
Named list with name and points (data.frame(mach, cd)).
Parse a powder temperature sweep specification
parse_powder_sweep(spec)parse_powder_sweep(spec)
spec |
Sweep string |
Numeric vector of temperatures.
"18x30", "5")Parse a WEZ target-size specification string (e.g. "18x30", "5")
parse_target_size(spec, units = c("metric", "imperial"))parse_target_size(spec, units = c("metric", "imperial"))
spec |
Target size, as the CLI's |
units |
Unit system ( |
Named list describing the metric target geometry.
"rect:18x30", "circle:10")Parse a target specification string (e.g. "rect:18x30", "circle:10")
parse_target_spec(spec, units = c("metric", "imperial"))parse_target_spec(spec, units = c("metric", "imperial"))
spec |
Target specification string, as the CLI's |
units |
Unit system ( |
Parsed TargetSpec list.
"3oc" or "10h30")Parse a wind direction token (degrees, or a clock position like "3oc" or "10h30")
parse_wind_direction(token, standalone = FALSE)parse_wind_direction(token, standalone = FALSE)
token |
Direction string. |
standalone |
Logical; use standalone parser rules. |
Named list with degrees and was_clock.
"600:-8.5")Parse a wind-truing observation string (e.g. "600:-8.5")
parse_wind_observation(spec, units = c("imperial", "metric"))parse_wind_observation(spec, units = c("imperial", "metric"))
spec |
Observation string |
units |
Unit system ( |
Named list (WindObservation).
Parse a named wind-scenario set document
parse_wind_scenario_set(text, units = c("metric", "imperial"))parse_wind_scenario_set(text, units = c("metric", "imperial"))
text |
JSON/text wind-scenario set specification. |
units |
Unit system ( |
Parsed WindScenarioSetV1 list.
Parse a CLI-style wind segment specification string
parse_wind_segment(spec, imperial = FALSE)parse_wind_segment(spec, imperial = FALSE)
spec |
Wind segment string, |
imperial |
Logical; interpret speed/distance in imperial units (mph/yd). |
Named list with speed_kmh, angle_deg, until_m, vertical_mps,
has_explicit_vertical (a 4th, vertical field was given) and angle_was_clock (the
angle was written as a clock position).
card_service::pdf_card_v1
Generate a printable PDF dope card via card_service::pdf_card_v1
pdf_card(request, stored_card = NULL, file = NULL)pdf_card(request, stored_card = NULL, file = NULL)
request |
Named list matching |
stored_card |
Optional |
file |
Optional file path to write the generated PDF bytes to disk. |
Named list with pdf_bytes (R raw), page_count, row_count,
source, unprintable_title_chars, truncation.
Format footer BC label text for velocity-keyed BC ladders on printed dope cards
pdf_ladder_bc_label(drag_model, band_bcs, fallback_bc, interior_gap = FALSE)pdf_ladder_bc_label(drag_model, band_bcs, fallback_bc, interior_gap = FALSE)
drag_model |
Drag model string (e.g. |
band_bcs |
Numeric vector of band BC values. |
fallback_bc |
Scalar fallback BC for interior gaps. |
interior_gap |
Logical; whether the ladder has an interior gap. |
Formatted footer label string.
List all 32 perturbation input axes and their metadata
perturbation_axes()perturbation_axes()
A data.frame with columns axis, group, kind, unit,
requires_rezero, domain_lower, domain_upper.
InputGroup
List perturbation axes belonging to a named InputGroup
perturbation_axes_in_group(group)perturbation_axes_in_group(group)
group |
Group name (e.g. |
Character vector of axis names.
InputAxis against a monotone R predicateBisect a single continuous InputAxis against a monotone R predicate
perturbation_bisect_axis( request, axis, range_m, lower, upper, predicate, tolerance = 1e-04 )perturbation_bisect_axis( request, axis, range_m, lower, upper, predicate, tolerance = 1e-04 )
request |
|
axis |
Continuous axis name. |
range_m |
Evaluation range (m). |
lower |
Lower search bound. |
upper |
Upper search bound. |
predicate |
R function |
tolerance |
Bisection stopping tolerance in axis units. |
Numeric boundary value, or NULL if not bracketed.
InputAxis
Compute central-difference drop and windage sensitivities along one InputAxis
perturbation_central_difference(request, axis, ranges_m, step = NULL)perturbation_central_difference(request, axis, ranges_m, step = NULL)
request |
|
axis |
Continuous axis name (see |
ranges_m |
Numeric vector of ranges (m). |
step |
Optional finite-difference step size. |
A data.frame with columns range_m, d_drop_d_x, d_windage_d_x, step_used, scheme.
SolveRequestV1 at explicit downrange distances via the perturbation kernelEvaluate a SolveRequestV1 at explicit downrange distances via the perturbation kernel
perturbation_evaluate(request, ranges_m)perturbation_evaluate(request, ranges_m)
request |
|
ranges_m |
Numeric vector of downrange distances (m). |
A data.frame with columns range_m, drop_m, windage_m, time_s, velocity_mps.
InputAxis from a solve requestRead the value of a single InputAxis from a solve request
perturbation_read_axis(request, axis)perturbation_read_axis(request, axis)
request |
|
axis |
Axis name (see |
Scalar value of that axis, or NULL if unavailable.
InputAxis modifiedReturn a copy of a solve request with one InputAxis modified
perturbation_with_axis(request, axis, value)perturbation_with_axis(request, axis, value)
request |
|
axis |
Axis name (see |
value |
New axis value. |
Modified SolveRequestV1 list, rebuilt from the resolved request by the engine's
reverse conversion (pressure stated as absolute, wind as shooter-relative), so it can be
solved or passed to any decision-support function as an ordinary request.
C_mq + C_m_alpha_dot vs. Mach (vectorized)Pitch damping coefficient C_mq + C_m_alpha_dot vs. Mach (vectorized)
pitch_damping_coefficient(mach, bullet_type = "match")pitch_damping_coefficient(mach, bullet_type = "match")
mach |
Numeric vector of Mach numbers. |
bullet_type |
Pitch-damping bullet type: |
Numeric vector of pitch damping coefficients.
Pitch damping aerodynamic moment (N*m)
pitch_damping_moment( pitch_rate_rad_s, velocity_mps, air_density_kg_m3, caliber_m, length_m, mach, bullet_type = "match" )pitch_damping_moment( pitch_rate_rad_s, velocity_mps, air_density_kg_m3, caliber_m, length_m, mach, bullet_type = "match" )
pitch_rate_rad_s |
Pitch rate (rad/s). |
velocity_mps |
Velocity (m/s). |
air_density_kg_m3 |
Air density (kg/m^3). |
caliber_m |
Caliber (m). |
length_m |
Length (m). |
mach |
Mach number. |
bullet_type |
Pitch-damping bullet type: |
Pitch damping moment (N*m).
Plan dial, hold, or hybrid engagement corrections for an optic
plan_corrections( correction, optic, range_m = 500, elevation_cf = 1, windage_cf = 1, preferences = NULL )plan_corrections( correction, optic, range_m = 500, elevation_cf = 1, windage_cf = 1, preferences = NULL )
correction |
Named list |
optic |
Named list matching |
range_m |
Target range (m). |
elevation_cf |
Elevation tracking CF (default |
windage_cf |
Windage tracking CF (default |
preferences |
Optional |
Named list (DialPlanReportV1).
Design an optimal observation-range plan for identifiable MV/BC truing
plan_truing_experiment(request)plan_truing_experiment(request)
request |
Named list matching |
Named list (TruingExperimentPlanV1).
Plot a trajectory
## S3 method for class 'ballistics_trajectory' plot(x, y = c("drop", "height", "velocity", "energy", "windage"), ...)## S3 method for class 'ballistics_trajectory' plot(x, y = c("drop", "height", "velocity", "energy", "windage"), ...)
x |
A |
y |
What to plot against range: |
... |
Passed to |
weight_gr * velocity_fps / 1000, vectorized)Compute competition power factor (weight_gr * velocity_fps / 1000, vectorized)
power_factor(weight_gr, velocity_fps, scored = FALSE)power_factor(weight_gr, velocity_fps, scored = FALSE)
weight_gr |
Numeric vector of bullet weights in grains. |
velocity_fps |
Numeric vector of muzzle velocities in fps. |
scored |
Logical; if |
Numeric vector of power factors.
pitch_damping
Precession frequency helper from pitch_damping
precession_with_damping( spin_rate_rad_s, spin_inertia, transverse_inertia, stability_factor )precession_with_damping( spin_rate_rad_s, spin_inertia, transverse_inertia, stability_factor )
spin_rate_rad_s |
Spin rate (rad/s). |
spin_inertia |
Axial inertia Ix (kg*m^2). |
transverse_inertia |
Transverse inertia Iy (kg*m^2). |
stability_factor |
Sg. |
Precession frequency (rad/s).
Predict gyroscopic stability downrange given velocity drop and spin retention
predict_stability_at_distance( initial_stability, initial_velocity_fps, current_velocity_fps, spin_decay_factor = 0.95 )predict_stability_at_distance( initial_stability, initial_velocity_fps, current_velocity_fps, spin_decay_factor = 0.95 )
initial_stability |
Muzzle Sg. |
initial_velocity_fps |
Muzzle velocity (fps). |
current_velocity_fps |
Velocity at range (fps). |
spin_decay_factor |
Spin retention factor ( |
Predicted Sg downrange.
Pressure altitude from station pressure
pressure_altitude(station_pressure_hpa, method = c("icao", "nws_ft"))pressure_altitude(station_pressure_hpa, method = c("icao", "nws_ft"))
station_pressure_hpa |
Numeric vector of station pressures in hPa. |
method |
|
Numeric vector of pressure altitudes (m for "icao", ft for "nws_ft").
OpticProfile from a ProfileData listExtract a validated OpticProfile from a ProfileData list
profile_optic(profile)profile_optic(profile)
profile |
Named list matching |
Named list (OpticProfile), or NULL if no optic fields are set.
Quantize an angular correction onto a turret click detent lattice
quantize_angle(angle, click_spec = "0.1mil")quantize_angle(angle, click_spec = "0.1mil")
angle |
Angle in the click's own base unit. |
click_spec |
Click graduation string (e.g. |
Named list with clicks and residual.
Fast ballistic drop approximation (inches)
quick_drop_estimate( muzzle_velocity_fps, distance_yards, bullet_mass_grains, bc )quick_drop_estimate( muzzle_velocity_fps, distance_yards, bullet_mass_grains, bc )
muzzle_velocity_fps |
Muzzle velocity (fps). |
distance_yards |
Range (yards). |
bullet_mass_grains |
Bullet mass (grains). |
bc |
Ballistic coefficient. |
Estimated drop in inches.
card_service::range_table_v1)Generate a full range table card (card_service::range_table_v1)
range_table(request)range_table(request)
request |
Named list matching |
An object of S3 class "ballistics_card" (CardResponseV1).
Recommend the best-fitting reference drag family for velocity-banded BC segments
recommend_bc_family( segments, source_model = "G1", candidates = c("G1", "G7", "G8"), speed_of_sound_fps = 340.29/0.3048 )recommend_bc_family( segments, source_model = "G1", candidates = c("G1", "G7", "G8"), speed_of_sound_fps = 340.29/0.3048 )
segments |
Velocity-banded BC segments |
source_model |
Source drag model. |
candidates |
Character vector of candidate drag models. |
speed_of_sound_fps |
Speed of sound in fps. |
Named list (BcFamilyRecommendationV1).
Reduce sea-level QNH altimeter pressure to local station pressure
reduce_qnh(qnh_hpa, altitude_m)reduce_qnh(qnh_hpa, altitude_m)
qnh_hpa |
Sea-level QNH pressure in hPa (numeric vector). |
altitude_m |
Station altitude in meters (numeric vector). |
Numeric vector of local station pressures in hPa.
(mach, cd) drag table as a data.frame
Retrieve a built-in reference (mach, cd) drag table as a data.frame
reference_drag_table(drag_model = "G7")reference_drag_table(drag_model = "G7")
drag_model |
Drag model string ( |
A data.frame with columns mach and cd.
Render a multi-series Unicode Braille or ASCII chart string
render_terminal_chart( series, width_cells = 60, height_cells = 18, style = c("braille", "ascii") )render_terminal_chart( series, width_cells = 60, height_cells = 18, style = c("braille", "ascii") )
series |
Named list of 2-column |
width_cells |
Width in terminal character cells. |
height_cells |
Height in terminal character cells. |
style |
|
Character scalar containing the rendered chart.
Resolve powder-temperature-adjusted muzzle velocity (m/s)
resolve_powder_velocity( base_velocity_mps, ambient_temp_c, use_powder_sensitivity = FALSE, powder_temp_sensitivity = 0, powder_ref_temp_c = 21.1111111111111, powder_temp_curve = NULL, powder_curve_temp_c = NULL )resolve_powder_velocity( base_velocity_mps, ambient_temp_c, use_powder_sensitivity = FALSE, powder_temp_sensitivity = 0, powder_ref_temp_c = 21.1111111111111, powder_temp_curve = NULL, powder_curve_temp_c = NULL )
base_velocity_mps |
Base muzzle velocity (m/s). |
ambient_temp_c |
Ambient air temperature (C). |
use_powder_sensitivity |
Logical; enable linear powder sensitivity model. |
powder_temp_sensitivity |
Linear slope (m/s per degree C). |
powder_ref_temp_c |
Reference powder temperature (C). |
powder_temp_curve |
Optional 2-column |
powder_curve_temp_c |
Optional explicit powder temperature (C) for curve lookup. |
Adjusted muzzle velocity in m/s.
Infer projectile shape from model name, caliber, weight, and drag model
resolve_projectile_shape( bullet_model = NULL, caliber_in = 0.308, weight_grains = 168, drag_model = "G7" )resolve_projectile_shape( bullet_model = NULL, caliber_in = 0.308, weight_grains = 168, drag_model = "G7" )
bullet_model |
Optional bullet model name. |
caliber_in |
Bullet diameter (inches). |
weight_grains |
Bullet mass (grains). |
drag_model |
Drag model string. |
Character scalar shape name.
Resolve station temperature and pressure honoring presence and pressure mode
resolve_station_conditions( temperature_c = 15, pressure_hpa = 1013.25, altitude_m = 0, pressure_mode = c("absolute", "qnh"), temperature_supplied = FALSE, pressure_supplied = FALSE )resolve_station_conditions( temperature_c = 15, pressure_hpa = 1013.25, altitude_m = 0, pressure_mode = c("absolute", "qnh"), temperature_supplied = FALSE, pressure_supplied = FALSE )
temperature_c |
Temperature in Celsius. |
pressure_hpa |
Pressure in hPa. |
altitude_m |
Station altitude in meters. |
pressure_mode |
|
temperature_supplied |
Logical; whether temperature was explicitly supplied. |
pressure_supplied |
Logical; whether pressure was explicitly supplied. |
Named list with resolved temperature_c and pressure_hpa.
(range, drop_mil) pairsGenerate a BDC reticle from (range, drop_mil) pairs
reticle_bdc_from_drops(drops)reticle_bdc_from_drops(drops)
drops |
2-column |
Named list (ReticleDescription).
Fetch a built-in reticle description by catalog ID
reticle_by_id(id)reticle_by_id(id)
id |
Catalog ID (see |
Named list (ReticleDescription).
reticle_catalog
List all built-in named reticles in reticle_catalog
reticle_catalog()reticle_catalog()
A data.frame with columns id, display_name, source, notes.
Generate a standard parametric mil-dot reticle
reticle_mil_dot(dots_per_side = 5)reticle_mil_dot(dots_per_side = 5)
dots_per_side |
Number of mil dots per side (default |
Named list (ReticleDescription).
Generate a uniform MIL hash grid reticle
reticle_mil_grid(spacing_mil = 0.5, extent_mil = 10)reticle_mil_grid(spacing_mil = 0.5, extent_mil = 10)
spacing_mil |
Mark spacing in MIL. |
extent_mil |
Maximum extent in MIL. |
Named list (ReticleDescription).
Scale reticle marks for an explicit magnification (FFP or SFP)
reticle_scaled_marks(reticle, magnification = 10)reticle_scaled_marks(reticle, magnification = 10)
reticle |
Named list ( |
magnification |
Scope magnification. |
A data.frame with columns down_mil, right_mil, kind, label.
Generate a Christmas-tree holdover reticle
reticle_tree(rows = 10, row_spacing_mil = 1, spread_step_mil = 0.5)reticle_tree(rows = 10, row_spacing_mil = 1, spread_step_mil = 0.5)
rows |
Number of elevation rows. |
row_spacing_mil |
Vertical spacing between rows (MIL). |
spread_step_mil |
Horizontal windage hash spacing (MIL). |
Named list (ReticleDescription).
(revolution, remainder_clicks)
Compute turret revolution annotation (revolution, remainder_clicks)
revolution_annotation(clicks_from_zero, clicks_per_rev)revolution_annotation(clicks_from_zero, clicks_per_rev)
clicks_from_zero |
Signed clicks from zero. |
clicks_per_rev |
Clicks per turret revolution. |
Named list with revolution and remainder_clicks, or NULL.
Run a Monte Carlo ballistic dispersion simulation
run_monte_carlo( inputs = ballistic_inputs(), wind = NULL, atmosphere = NULL, params = list(num_simulations = 500, velocity_std_dev = 3), wind_direction_std_dev = 0, seed = NULL, hit_radius = if (match.arg(units) == "imperial") 11.811 else 0.3, units = c("metric", "imperial") )run_monte_carlo( inputs = ballistic_inputs(), wind = NULL, atmosphere = NULL, params = list(num_simulations = 500, velocity_std_dev = 3), wind_direction_std_dev = 0, seed = NULL, hit_radius = if (match.arg(units) == "imperial") 11.811 else 0.3, units = c("metric", "imperial") )
inputs |
Base |
wind |
Optional base |
atmosphere |
Optional base |
params |
Named list of The launch geometry is the CLI's |
wind_direction_std_dev |
Standard deviation of wind direction (radians). |
seed |
Optional integer RNG seed for reproducibility. |
hit_radius |
Circular hit-zone radius (m in metric, in in imperial). |
units |
Unit system ( |
An object of S3 class "ballistics_mc".
Stops early once the anytime-valid Bernoulli confidence sequence half-width
reaches convergence$target_half_width.
run_monte_carlo_adaptive( inputs = ballistic_inputs(), wind = NULL, atmosphere = NULL, params = list(velocity_std_dev = 3), convergence = list(level = "p95", target_half_width = 0.05, min_samples = 50, max_samples = 2000, batch_size = 50), hit_radius_m = 0.3, seed = 42 )run_monte_carlo_adaptive( inputs = ballistic_inputs(), wind = NULL, atmosphere = NULL, params = list(velocity_std_dev = 3), convergence = list(level = "p95", target_half_width = 0.05, min_samples = 50, max_samples = 2000, batch_size = 50), hit_radius_m = 0.3, seed = 42 )
inputs |
Base |
wind |
Optional base |
atmosphere |
Optional base |
params |
|
convergence |
Named list with |
hit_radius_m |
Target hit radius in meters. |
seed |
RNG seed. |
Named list representing AdaptiveMcReportV1.
Subsample 2D Monte Carlo impact points for plotting
sample_points_for_viz(wind_drift, drop, max_points = 500)sample_points_for_viz(wind_drift, drop, max_points = 500)
wind_drift |
Numeric vector of lateral impacts. |
drop |
Numeric vector of vertical impacts. |
max_points |
Maximum number of points to return. |
A data.frame with columns wind_drift and drop.
Sample a solved state trajectory at regular distance intervals
sample_trajectory(trajectory, outputs = list(), step_m = 50, mass_kg = 0.01)sample_trajectory(trajectory, outputs = list(), step_m = 50, mass_kg = 0.01)
trajectory |
A |
outputs |
Named list of |
step_m |
Distance step size in meters. |
mass_kg |
Projectile mass in kg. |
A data.frame of sampled trajectory points with flags.
Sanitize a profile name for safe filesystem storage
sanitize_profile_name(raw)sanitize_profile_name(raw)
raw |
Character scalar. |
Sanitized profile name string.
Sight correction (elevation_rad, windage_rad) for aerodynamic jump
sight_correction_for_jump( jump_components, zero_range_m = 100, sight_height_m = 0.05 )sight_correction_for_jump( jump_components, zero_range_m = 100, sight_height_m = 0.05 )
jump_components |
Result list from |
zero_range_m |
Zero range (m). |
sight_height_m |
Sight height (m). |
Named list with elevation_rad and windage_rad, the correction in radians (the
engine works in MOA; 1 MOA = pi / 10800 rad).
SolveRequestV1 listConvenience constructor populating all required top-level v1 blocks
(schema_version, projectile, rifle, shot, atmosphere, wind,
solver, effects, sampling) for solve_v1(), error_budget(),
explain_difference(), tolerance_envelope(), and perturbation_*().
solve_request_v1( mass_kg = 0.010886, diameter_m = 0.0078232, drag_model = "g7", ballistic_coefficient = 0.243, muzzle_velocity_mps = 807.72, max_range_m = 1000, zero_distance_m = 100, sight_height_m = 0.05, twist_rate_m_per_turn = 0.254, twist_direction = "right", length_m = NULL, atmosphere = list(temperature_k = 288.15, pressure_pa = 101325, relative_humidity = 0.5, altitude_m = 0), wind = as_json_object(), solver = as_json_object(), effects = as_json_object(), sampling = list(interval_m = 100) )solve_request_v1( mass_kg = 0.010886, diameter_m = 0.0078232, drag_model = "g7", ballistic_coefficient = 0.243, muzzle_velocity_mps = 807.72, max_range_m = 1000, zero_distance_m = 100, sight_height_m = 0.05, twist_rate_m_per_turn = 0.254, twist_direction = "right", length_m = NULL, atmosphere = list(temperature_k = 288.15, pressure_pa = 101325, relative_humidity = 0.5, altitude_m = 0), wind = as_json_object(), solver = as_json_object(), effects = as_json_object(), sampling = list(interval_m = 100) )
mass_kg |
Projectile mass (kg). |
diameter_m |
Projectile diameter (m). |
drag_model |
Reference drag model string (e.g. |
ballistic_coefficient |
Ballistic coefficient. |
muzzle_velocity_mps |
Muzzle velocity (m/s). |
max_range_m |
Maximum integration range (m). |
zero_distance_m |
Zero range (m). |
sight_height_m |
Sight height above bore (m). |
twist_rate_m_per_turn |
Optional barrel twist (m/turn). |
twist_direction |
|
length_m |
Optional projectile length (m). |
atmosphere |
Named list for |
wind |
Named list for |
solver |
Named list for |
effects |
Named list for |
sampling |
Named list for |
Named list ready for solve_v1().
Solve robust minimax hold corridors across named segmented-wind scenarios
solve_robust_hold( scenarios, ranges_m, target = NULL, load = list(), format = NULL, units = c("metric", "imperial") )solve_robust_hold( scenarios, ranges_m, target = NULL, load = list(), format = NULL, units = c("metric", "imperial") )
scenarios |
A parsed |
ranges_m |
Numeric vector of target ranges in meters. |
target |
Optional |
load |
Named list describing |
format |
Optional output format ( |
units |
Unit system ( |
Structured RobustHoldReportV1 list, or formatted string if format is set.
Runs ballistics_engine::TrajectorySolver and returns summary metrics plus
a points data.frame (and sampled_points when sampling is enabled).
solve_trajectory( inputs = ballistic_inputs(), wind = NULL, atmosphere = NULL, max_range = NULL, time_step = NULL, wind_segments = NULL, atmo_segments = NULL, units = c("metric", "imperial"), auto_zero = FALSE )solve_trajectory( inputs = ballistic_inputs(), wind = NULL, atmosphere = NULL, max_range = NULL, time_step = NULL, wind_segments = NULL, atmo_segments = NULL, units = c("metric", "imperial"), auto_zero = FALSE )
inputs |
List of ballistic inputs (see |
wind |
Optional list of wind conditions (see |
atmosphere |
Optional list of atmospheric conditions (see |
max_range |
Optional maximum integration range (m in metric, yd in imperial). |
time_step |
Optional integration time step in seconds. |
wind_segments |
Optional downrange wind segments: a |
atmo_segments |
Optional downrange atmosphere segments with |
units |
Unit system: |
auto_zero |
Logical; if |
An object of S3 class "ballistics_trajectory". Its points data frame has
x (downrange), y (height in the solver's frame: the muzzle starts at
muzzle_height, 0 by default), z (lateral, positive right), and drop, the drop
below the line of sight (line_of_sight_height_m - y, positive below), the same
quantity as solve_v1()'s drop_m and the CLI's Drop column. In imperial, x is in
yards, y, z, drop and max_height are in inches, and every converted field is
named for its unit: line_of_sight_height_in, station_speed_of_sound_fps and
mach_1_2_distance_yd / mach_1_0_distance_yd / mach_0_9_distance_yd.
monte_carlo::solve_trajectory_for_monte_carlo)Single-shot Monte Carlo kernel evaluation (monte_carlo::solve_trajectory_for_monte_carlo)
solve_trajectory_mc(inputs = ballistic_inputs(), atmosphere = NULL)solve_trajectory_mc(inputs = ballistic_inputs(), atmosphere = NULL)
inputs |
|
atmosphere |
Optional |
Named list (TrajectoryOutput: drop, wind_drift, time,
velocity, energy, mach, spin_drift, distance).
solve_v1 contractSolve a trajectory using the versioned explicit-SI solve_v1 contract
solve_v1(request, return_envelope = FALSE)solve_v1(request, return_envelope = FALSE)
request |
Named R list or JSON string conforming to |
return_envelope |
Logical; if |
Named list representing SolveSuccessV1: samples is a data.frame (one row
per sample; flags is a list column) and resolved_request is tagged as resolved (see
as_resolved_request()).
ballistics_engine::special (vectorized)Error function erf(x) from ballistics_engine::special (vectorized)
special_erf(x)special_erf(x)
x |
Numeric vector. |
Numeric vector.
Complementary error function erfc(x) (vectorized)
special_erfc(x)special_erfc(x)
x |
Numeric vector. |
Numeric vector.
Log-beta function ln B(a, b) (vectorized)
special_ln_beta(a, b)special_ln_beta(a, b)
a |
Numeric vector. |
b |
Numeric vector. |
Numeric vector.
Log-gamma function ln Gamma(x) (vectorized)
special_ln_gamma(x)special_ln_gamma(x)
x |
Numeric vector. |
Numeric vector.
Standard normal CDF Phi(z) (vectorized)
special_normal_cdf(z)special_normal_cdf(z)
z |
Numeric vector. |
Numeric vector.
Aerodynamic spin-damping moment (N*m)
spin_damping_moment( spin_rate_rad_s, velocity_mps, air_density_kg_m3, caliber_m, length_m, bullet_type = "match" )spin_damping_moment( spin_rate_rad_s, velocity_mps, air_density_kg_m3, caliber_m, length_m, bullet_type = "match" )
spin_rate_rad_s |
Spin rate (rad/s). |
velocity_mps |
Velocity (m/s). |
air_density_kg_m3 |
Air density (kg/m^3). |
caliber_m |
Caliber (m). |
length_m |
Length (m). |
bullet_type |
Spin-decay bullet type: |
Spin-damping moment (N*m).
0..1) over elapsed flight timeSpin-rate retention factor (0..1) over elapsed flight time
spin_decay_correction_factor( time_elapsed_s, velocity_mps, air_density_kg_m3, mass_grains, caliber_inches, length_inches, bullet_type = NULL )spin_decay_correction_factor( time_elapsed_s, velocity_mps, air_density_kg_m3, mass_grains, caliber_inches, length_inches, bullet_type = NULL )
time_elapsed_s |
Elapsed time (s). |
velocity_mps |
Velocity (m/s). |
air_density_kg_m3 |
Air density (kg/m^3). |
mass_grains |
Mass (grains). |
caliber_inches |
Caliber (inches). |
length_inches |
Length (inches). |
bullet_type |
Optional spin-decay bullet type: |
Spin retention factor in [0, 1].
Spin decay angular deceleration rate (rad/s^2)
spin_decay_rate( spin_rate_rad_s, velocity_mps, air_density_kg_m3, mass_grains, caliber_inches, length_inches, bullet_type = "match", bullet_shape = "boat_tail" )spin_decay_rate( spin_rate_rad_s, velocity_mps, air_density_kg_m3, mass_grains, caliber_inches, length_inches, bullet_type = "match", bullet_shape = "boat_tail" )
spin_rate_rad_s |
Spin rate (rad/s). |
velocity_mps |
Velocity (m/s). |
air_density_kg_m3 |
Air density (kg/m^3). |
mass_grains |
Mass (grains). |
caliber_inches |
Caliber (inches). |
length_inches |
Length (inches). |
bullet_type |
Spin-decay bullet type: |
bullet_shape |
Shape for the moment of inertia: |
Spin decay rate (rad/s^2).
Spin drift with optional spin-decay factor (meters)
spin_drift( time_s, stability_sg, twist_rate_in, is_twist_right = TRUE, decay_factor = NULL )spin_drift( time_s, stability_sg, twist_rate_in, is_twist_right = TRUE, decay_factor = NULL )
time_s |
Time of flight (s). |
stability_sg |
Gyroscopic stability factor Sg. |
twist_rate_in |
Twist rate (inches/turn). |
is_twist_right |
Logical. |
decay_factor |
Optional spin retention factor ( |
Spin drift in meters.
Apply empirical ML correction to spin drift
spin_drift_ml_correction( base_drift, stability, mach, time_s, caliber_inches, mass_grains )spin_drift_ml_correction( base_drift, stability, mach, time_s, caliber_inches, mass_grains )
base_drift |
Base drift (m). |
stability |
Sg. |
mach |
Mach number. |
time_s |
Time of flight (s). |
caliber_inches |
Caliber (inches). |
mass_grains |
Bullet weight (grains). |
Corrected spin drift (m).
Compute bullet spin rate from velocity and barrel twist
spin_rate(velocity_mps, twist_rate_inches)spin_rate(velocity_mps, twist_rate_inches)
velocity_mps |
Velocity (m/s). |
twist_rate_inches |
Twist rate (inches per turn). |
Named list with rps (rev/s) and rad_s (rad/s).
Miller gyroscopic stability coefficient Sg
stability_coefficient( inputs = ballistic_inputs(), altitude_m = 0, temperature_c = 15, pressure_hpa = 1013.25, density_ratio = 1 )stability_coefficient( inputs = ballistic_inputs(), altitude_m = 0, temperature_c = 15, pressure_hpa = 1013.25, density_ratio = 1 )
inputs |
Ballistic inputs list (SI). |
altitude_m |
Altitude (m). |
temperature_c |
Temperature (C). |
pressure_hpa |
Station pressure (hPa). |
density_ratio |
Ignored: the engine's Miller correction reads only the temperature and pressure. Kept for compatibility. |
Gyroscopic stability factor Sg.
terminal_commands::stability)Formatted gyroscopic stability analysis report (terminal_commands::stability)
stability_report( mass, diameter, length, twist_rate, velocity, temperature = if (match.arg(units) == "imperial") 59 else 15, pressure = if (match.arg(units) == "imperial") 29.92 else 1013.25, altitude = 0, units = c("metric", "imperial"), format = c("table", "json", "csv") )stability_report( mass, diameter, length, twist_rate, velocity, temperature = if (match.arg(units) == "imperial") 59 else 15, pressure = if (match.arg(units) == "imperial") 29.92 else 1013.25, altitude = 0, units = c("metric", "imperial"), format = c("table", "json", "csv") )
mass |
Bullet mass (grams in metric, grains in imperial). |
diameter |
Bullet diameter (mm in metric, inches in imperial). |
length |
Bullet length (mm in metric, inches in imperial). |
twist_rate |
Barrel twist (mm/turn in metric, in/turn in imperial). |
velocity |
Muzzle velocity (m/s in metric, fps in imperial). |
temperature |
Ambient temperature (C in metric, F in imperial). |
pressure |
Station pressure (hPa in metric, inHg in imperial). |
altitude |
Altitude (m in metric, ft in imperial). |
units |
Unit system ( |
format |
Output format ( |
Formatted report string.
StationAir handleCreate a validated StationAir handle
station_air( altitude_m = 0, temperature_c = 15, pressure_hpa = 1013.25, humidity_percent = 50, density_ratio = NULL )station_air( altitude_m = 0, temperature_c = 15, pressure_hpa = 1013.25, humidity_percent = 50, density_ratio = NULL )
altitude_m |
Station altitude in meters. |
temperature_c |
Ambient temperature in Celsius. |
pressure_hpa |
Absolute station pressure in hPa (mb). |
humidity_percent |
Relative humidity percent ( |
density_ratio |
Optional explicit density ratio override. |
An opaque handle of class "StationAirHandle".
(altitude_m, temperature_c, pressure_hpa) from density altitudeResolve a physical station (altitude_m, temperature_c, pressure_hpa) from density altitude
station_for_density_altitude(density_altitude_m, explicit_temperature_c = NULL)station_for_density_altitude(density_altitude_m, explicit_temperature_c = NULL)
density_altitude_m |
Target density altitude in meters. |
explicit_temperature_c |
Optional explicit temperature override in Celsius. |
Named list with altitude_m, temperature_c, pressure_hpa.
Check plausibility of a station pressure reading at an altitude
station_pressure_plausibility(station_pressure_pa, altitude_m)station_pressure_plausibility(station_pressure_pa, altitude_m)
station_pressure_pa |
Station pressure in Pascals. |
altitude_m |
Station altitude in meters. |
Named list with icao_standard_pa, ratio, and implausible.
Compute scope tracking correction factor from a tall-target test
tall_target(request)tall_target(request)
request |
Named list matching |
Named list (TallTargetResultV1).
Create a Unicode Braille or ASCII terminal plotting canvas handle
terminal_canvas( width_cells = 60, height_cells = 20, style = c("braille", "ascii") )terminal_canvas( width_cells = 60, height_cells = 20, style = c("braille", "ascii") )
width_cells |
Width in terminal character cells. |
height_cells |
Height in terminal character cells. |
style |
|
An opaque handle of class "TerminalCanvasHandle".
Compute one-variable tolerance envelopes keeping impact inside a target
tolerance_envelope(request, axes, range_m, target, domains = NULL)tolerance_envelope(request, axes, range_m, target, domains = NULL)
request |
|
axes |
Character vector of |
range_m |
Target range (m). |
target |
|
domains |
Optional named list mapping axis names to |
An object of S3 class "ballistics_tolerance" (ToleranceReportV1).
Check whether a scope tracking correction factor is within the valid physical range
tracking_cf_in_range(value)tracking_cf_in_range(value)
value |
Numeric scalar tracking CF. |
Logical scalar.
Apply transonic wave-drag correction to base Cd (vectorized)
transonic_correction( mach, base_cd, shape = "boat_tail", include_wave_drag = TRUE )transonic_correction( mach, base_cd, shape = "boat_tail", include_wave_drag = TRUE )
mach |
Numeric vector of Mach numbers. |
base_cd |
Numeric vector of base drag coefficients. |
shape |
Projectile shape string. |
include_wave_drag |
Logical; add the wave-drag rise. A raw primitive: a |
Numeric vector of corrected drag coefficients.
Transonic wave-drag rise factor vs. Mach (vectorized)
transonic_drag_rise(mach, shape = "boat_tail")transonic_drag_rise(mach, shape = "boat_tail")
mach |
Numeric vector of Mach numbers. |
shape |
Projectile shape ( |
Numeric vector of transonic drag rise factors.
Transverse moment of inertia Iy (kg*m^2)
transverse_moment_of_inertia(mass_kg, caliber_m, length_m, shape = "boat_tail")transverse_moment_of_inertia(mass_kg, caliber_m, length_m, shape = "boat_tail")
mass_kg |
Mass (kg). |
caliber_m |
Caliber (m). |
length_m |
Length (m). |
shape |
Bullet shape string. |
Transverse moment of inertia (kg*m^2).
Back-solve effective muzzle velocity from a single observed drop (MIL)
true_velocity( measured_drop_mil, range, bc, drag_model = "G7", mass = if (match.arg(units) == "imperial") 168 else 0.010886, diameter = if (match.arg(units) == "imperial") 0.308 else 0.00782, zero_distance = 100, sight_height = if (match.arg(units) == "imperial") 2 else 0.05, temperature = NULL, pressure = NULL, humidity_pct = 50, altitude = 0, bc_segments = NULL, units = c("metric", "imperial") )true_velocity( measured_drop_mil, range, bc, drag_model = "G7", mass = if (match.arg(units) == "imperial") 168 else 0.010886, diameter = if (match.arg(units) == "imperial") 0.308 else 0.00782, zero_distance = 100, sight_height = if (match.arg(units) == "imperial") 2 else 0.05, temperature = NULL, pressure = NULL, humidity_pct = 50, altitude = 0, bc_segments = NULL, units = c("metric", "imperial") )
measured_drop_mil |
Observed drop in MIL. |
range |
Target range (m in metric, yd in imperial). |
bc |
Ballistic coefficient. |
drag_model |
|
mass |
Bullet mass (kg or grains). |
diameter |
Bullet diameter (m or inches). |
zero_distance |
Zero range (m or yd). |
sight_height |
Sight height (m or in; default 0.05 m / 2 in, the CLI's). |
temperature |
Optional ambient temperature (C or F). |
pressure |
Optional station pressure (hPa or inHg). |
humidity_pct |
Relative humidity percent. |
altitude |
Altitude (m or ft). |
bc_segments |
Optional velocity-BC segments. |
units |
Unit system ( |
Named list (TrueVelocityLocalResult), plus effective_velocity_mps in metric mode.
Back-solve effective crosswind from observed horizontal miss(es)
true_wind(request, format = NULL, units = c("metric", "imperial"))true_wind(request, format = NULL, units = c("metric", "imperial"))
request |
Named list matching |
format |
Optional output format ( |
units |
Unit system for formatted output ( |
Named list (WindTruingReport) or formatted string.
Bayesian MAP uncertainty-aware joint MV/BC truing with covariance and predictive bands
uncertainty_truing(request)uncertainty_truing(request)
request |
Named list matching |
Named list (UncertaintyTruingReportV1).
Uses ballistics_engine::terminal_commands::UnitConverter, the CLI's own converter, so
conversions match the CLI bit-for-bit. "Metric" here is the CLI's METRIC INPUT units, not
SI: bullet mass in grams and diameter and sight height in millimetres.
unit_convert( value, quantity = c("velocity", "mass", "distance", "diameter", "sight_height", "wind", "temperature", "temperature_delta", "pressure", "altitude"), direction = c("to_metric", "from_metric"), units = c("imperial", "metric") )unit_convert( value, quantity = c("velocity", "mass", "distance", "diameter", "sight_height", "wind", "temperature", "temperature_delta", "pressure", "altitude"), direction = c("to_metric", "from_metric"), units = c("imperial", "metric") )
value |
Numeric vector of values to convert. |
quantity |
One of |
direction |
Either |
units |
Unit system ( |
| quantity | imperial | metric | internal |
| velocity | fps | m/s | m/s |
| mass | grains | g | kg |
| distance | yd | m | m |
| diameter | in | mm | m |
| sight_height | in | mm | m |
| wind | mph | m/s | m/s |
| temperature | °F | °C | °C |
| temperature_delta | °F | °C | °C |
| pressure | inHg | hPa | hPa |
| altitude | ft | m | m |
Converted numeric vector.
Update projectile spin rate after elapsed flight time
update_spin_rate( initial_spin_rad_s, time_elapsed_s, velocity_mps, air_density_kg_m3, mass_grains, caliber_inches, length_inches, bullet_type = NULL )update_spin_rate( initial_spin_rad_s, time_elapsed_s, velocity_mps, air_density_kg_m3, mass_grains, caliber_inches, length_inches, bullet_type = NULL )
initial_spin_rad_s |
Initial spin rate (rad/s). |
time_elapsed_s |
Elapsed time (s). |
velocity_mps |
Velocity (m/s). |
air_density_kg_m3 |
Air density (kg/m^3). |
mass_grains |
Mass (grains). |
caliber_inches |
Caliber (inches). |
length_inches |
Length (inches). |
bullet_type |
Optional spin-decay bullet type: |
Updated spin rate (rad/s).
OpticProfile configurationValidate an OpticProfile configuration
validate_optic(optic)validate_optic(optic)
optic |
Named list matching |
TRUE if valid; raises an error otherwise.
ProfileData)Validate a saved ballistic profile (ProfileData)
validate_profile(profile)validate_profile(profile)
profile |
Named list matching |
Named list with valid, warnings, air_refusal, flown_humidity,
and flown_humidity_note.
Validate a relative humidity reading (with sensor-band tolerance)
validate_relative_humidity(value, is_fraction = FALSE)validate_relative_humidity(value, is_fraction = FALSE)
value |
Humidity value ( |
is_fraction |
Logical; |
Named list with flown percent and fraction.
ReticleDescription
Validate a ReticleDescription
validate_reticle(reticle)validate_reticle(reticle)
reticle |
Named list ( |
TRUE if valid; raises an error otherwise.
Validate a table/list of wind segments
validate_wind_segments(segments)validate_wind_segments(segments)
segments |
A |
TRUE if valid; raises an error otherwise.
Welford mean/variance accumulator handleCreate a streaming Welford mean/variance accumulator handle
welford()welford()
An opaque handle of class "WelfordHandle".
Fixed-sample Wilson score confidence interval for a binomial proportion
wilson_interval(successes, trials, level = c("p95", "p90", "p99"))wilson_interval(successes, trials, level = c("p95", "p90", "p99"))
successes |
Number of hits/successes. |
trials |
Total number of trials. |
level |
Confidence level ( |
Length-2 numeric vector c(lower, upper).
Compute the 3D wind vector at a 3D projectile position with optional wind shear
wind_at_position( position, wind_segments, enable_wind_shear = FALSE, wind_shear_model = "logarithmic", shooter_altitude_m = 0 )wind_at_position( position, wind_segments, enable_wind_shear = FALSE, wind_shear_model = "logarithmic", shooter_altitude_m = 0 )
position |
Length-3 numeric vector |
wind_segments |
Wind segments |
enable_wind_shear |
Logical; apply boundary-layer wind shear. |
wind_shear_model |
Model name: |
shooter_altitude_m |
Site altitude (m). |
Length-3 numeric wind vector (m/s).
card_service::wind_card_v1)Generate a multi-speed wind drift card (card_service::wind_card_v1)
wind_card(request)wind_card(request)
request |
Named list matching |
An object of S3 class "ballistics_card" (CardResponseV1).
WindConditions configuration listConstruct a WindConditions configuration list
wind_conditions(speed = 0, direction = 0, vertical_speed = 0)wind_conditions(speed = 0, direction = 0, vertical_speed = 0)
speed |
Wind speed (m/s in metric, mph in imperial). |
direction |
Wind-FROM direction in radians ( |
vertical_speed |
Vertical wind component (m/s in metric, mph in imperial; positive = updraft). |
Named list of wind conditions.
WindField handle (constant, profile, log, or ekman)Create a 3D WindField handle (constant, profile, log, or ekman)
wind_field( type = c("constant", "profile", "log", "ekman"), ..., height_offset_m = NULL )wind_field( type = c("constant", "profile", "log", "ekman"), ..., height_offset_m = NULL )
type |
One of |
... |
Parameters for the selected wind field:
|
height_offset_m |
Optional vertical height offset (m) wrapped via |
An opaque handle of class "WindFieldHandle".
WindShearProfile across altitudesEvaluate a WindShearProfile across altitudes
wind_shear_at_altitude(profile, altitudes_m)wind_shear_at_altitude(profile, altitudes_m)
profile |
Named list describing |
altitudes_m |
Numeric vector of altitudes (m). |
A data.frame with columns altitude_m, wx, wy, wz.
WindShearWindSock at a 3D positionEvaluate WindShearWindSock at a 3D position
wind_shear_sock_vector( segments_mps, shear_profile = NULL, shooter_altitude_m = 0, position = c(0, 0, 0) )wind_shear_sock_vector( segments_mps, shear_profile = NULL, shooter_altitude_m = 0, position = c(0, 0, 0) )
segments_mps |
|
shear_profile |
Optional |
shooter_altitude_m |
Site altitude (m). |
position |
Length-3 position vector |
Length-3 numeric wind vector (m/s).
WindSock handleCreate a downrange segmented WindSock handle
wind_sock(segments)wind_sock(segments)
segments |
A |
An opaque handle of class "WindSockHandle".
Convert wind speed, direction (radians), and vertical speed to a 3D wind vector
wind_vector(speed_mps, direction_rad, vertical_mps = 0)wind_vector(speed_mps, direction_rad, vertical_mps = 0)
speed_mps |
Horizontal wind speed (m/s). |
direction_rad |
Wind-FROM direction in radians ( |
vertical_mps |
Vertical wind component (m/s; positive = updraft). |
Length-3 numeric vector c(wx, wy, wz) (m/s).
Equilibrium yaw of repose and convergence rate
yaw_of_repose( stability_factor, velocity_mps, spin_rate_rad_s, wind_velocity_mps = 0, pitch_rate_rad_s = 0, air_density_kg_m3 = 1.225, caliber_inches = 0.308, length_inches = 1.24, mass_grains = 168, mach = 2, bullet_type = "match", use_pitch_damping = TRUE )yaw_of_repose( stability_factor, velocity_mps, spin_rate_rad_s, wind_velocity_mps = 0, pitch_rate_rad_s = 0, air_density_kg_m3 = 1.225, caliber_inches = 0.308, length_inches = 1.24, mass_grains = 168, mach = 2, bullet_type = "match", use_pitch_damping = TRUE )
stability_factor |
Gyroscopic stability Sg. |
velocity_mps |
Velocity (m/s). |
spin_rate_rad_s |
Spin rate (rad/s). |
wind_velocity_mps |
Crosswind velocity (m/s). |
pitch_rate_rad_s |
Pitch rate (rad/s). |
air_density_kg_m3 |
Air density (kg/m^3). |
caliber_inches |
Caliber (inches). |
length_inches |
Length (inches). |
mass_grains |
Mass (grains). |
mach |
Mach number. |
bullet_type |
Bullet type: |
use_pitch_damping |
Logical. |
Named list with yaw_rad and convergence_rate.
(moa, mil) adjusted by elevation CFCompute zero-banner dial readouts (moa, mil) adjusted by elevation CF
zero_banner_dial_values( angle_deg, angle_rad = angle_deg * pi/180, elevation_cf = 1 )zero_banner_dial_values( angle_deg, angle_rad = angle_deg * pi/180, elevation_cf = 1 )
angle_deg |
Zero angle in degrees. |
angle_rad |
Zero angle in radians. |
elevation_cf |
Elevation tracking correction factor. |
Named list with moa and mil.