Package 'ballistics'

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

Help Index


List ProfileData fields carried by the .a7p export format

Description

List ProfileData fields carried by the .a7p export format

Usage

a7p_carried_fields()

Value

Character vector of carried field names.


Powder-temperature-adjusted muzzle velocity from BallisticInputs

Description

Powder-temperature-adjusted muzzle velocity from BallisticInputs

Usage

adjusted_muzzle_velocity(inputs = ballistic_inputs())

Arguments

inputs

Ballistic inputs list (SI).

Value

Adjusted muzzle velocity (m/s).


Format an angular or quantized-click adjustment with optional bias and tracking CF

Description

Format an angular or quantized-click adjustment with optional bias and tracking CF

Usage

adjustment_display(
  drop_yd,
  range_yd,
  unit = c("mil", "moa", "smoa", "iphy", "clicks"),
  click_spec = NULL,
  bias_mil = 0,
  cf = 1
)

Arguments

drop_yd

Linear drop (same unit as range_yd).

range_yd

Range.

unit

One of "mil", "moa", "smoa", "iphy", "clicks".

click_spec

Optional click graduation string (required for quantized clicks).

bias_mil

Optional zero-set angular bias in MIL.

cf

Tracking correction factor (default 1.0).

Value

Named list with value, unit_label, and quantized.


Angular conversion factor for a click base unit (mil, moa, smoa)

Description

Angular conversion factor for a click base unit (mil, moa, smoa)

Usage

adjustment_factor(base = c("mil", "moa", "smoa"))

Arguments

base

One of "mil", "moa", "smoa".

Value

Numeric scalar conversion factor.


Bullet-type advanced spin drift (meters)

Description

Bullet-type advanced spin drift (meters)

Usage

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"
)

Arguments

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: "match" (or "bthp", "boat_tail"), "vld", "hybrid" or "flat_base". Any other name is an error.

Value

Spin drift in meters.


Advanced gyroscopic stability accounting for bullet type and boat tail

Description

Advanced gyroscopic stability accounting for bullet type and boat tail

Usage

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
)

Arguments

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: "match" (or "bthp"), "vld", "hybrid" or "hunting". Any other name is an error.

has_boat_tail

Logical.

has_plastic_tip

Ignored by the engine's model; kept for compatibility. See courtney_miller_plastic_tip() for a plastic-tip correction.

Value

Stability factor Sg.


Legacy advanced yaw of repose helper

Description

Legacy advanced yaw of repose helper

Usage

advanced_yaw_of_repose(
  stability_factor,
  velocity_mps,
  crosswind_mps,
  spin_rate_rad_s,
  air_density_kg_m3 = 1.225,
  caliber_m = 0.00782
)

Arguments

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).

Value

Yaw angle (rad).


Detailed aerodynamic jump components

Description

Detailed aerodynamic jump components

Usage

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
)

Arguments

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).

Value

Named list with all 6 AerodynamicJumpComponents fields.


Compute aerodynamic-jump launch-angle offset (radians)

Description

Compute aerodynamic-jump launch-angle offset (radians)

Usage

aerodynamic_jump_launch_offset(inputs = ballistic_inputs(), atmosphere = NULL)

Arguments

inputs

Ballistic inputs list (SI).

atmosphere

Optional atmosphere list.

Value

Numeric scalar launch angle offset in radians.


Evaluate local air properties aloft and downrange (atmosphere::air_at)

Description

Evaluate local air properties aloft and downrange (atmosphere::air_at)

Usage

air_at(
  atmosphere = NULL,
  downrange_m = 0,
  altitude_m = 0,
  atmo_segments = NULL
)

Arguments

atmosphere

Named list specifying either station air (altitude_m, temperature_c, pressure_hpa, humidity_percent) or uniform air (density_kg_m3, speed_of_sound_mps).

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 (temperature_c, pressure_hpa, humidity_percent, until_m).

Value

A data.frame with density_kg_m3, speed_of_sound_mps, temperature_k, and pressure_pa.


CIPM moist-air density calculation (vectorized)

Description

CIPM moist-air density calculation (vectorized)

Usage

air_density_cipm(temp_c = 15, pressure_hpa = 1013.25, humidity_percent = 50)

Arguments

temp_c

Temperature in Celsius (numeric vector).

pressure_hpa

Station pressure in hPa (numeric vector).

humidity_percent

Relative humidity percent ⁠0..100⁠ (numeric vector).

Value

Numeric vector of air densities in kg/m^3.


Convert and analyze velocity-banded BC segments with family recommendation

Description

Convert and analyze velocity-banded BC segments with family recommendation

Usage

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
)

Arguments

segments

Velocity-banded BC segments data.frame/list.

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 (NULL for list, or "table", "csv", "json").

Value

Named list (BcSegmentAnalysisV1) or formatted string.


Angular acceleration moment / moment_of_inertia (rad/s^2)

Description

Angular acceleration moment / moment_of_inertia (rad/s^2)

Usage

angular_acceleration(moment, moment_of_inertia)

Arguments

moment

Moment (N*m).

moment_of_inertia

Moment of inertia (kg*m^2).

Value

Angular acceleration (rad/s^2).


Solve a trajectory and apply a Mach-keyed DSF table post-correction

Description

Solve a trajectory and apply a Mach-keyed DSF table post-correction

Usage

apply_dsf_trajectory(
  inputs = ballistic_inputs(),
  dsf_points,
  wind = NULL,
  atmosphere = NULL,
  max_range_m = 1500
)

Arguments

inputs

BallisticInputs list (SI).

dsf_points

A data.frame or list of ⁠{mach, dsf}⁠ points.

wind

Optional WindConditions list (SI).

atmosphere

Optional AtmosphericConditions list (SI).

max_range_m

Maximum integration range (m).

Value

An object of class "ballistics_trajectory" with DSF-adjusted drops.


Apply form factor to a base drag coefficient

Description

Apply form factor to a base drag coefficient

Usage

apply_form_factor(
  cd_base,
  bullet_name = NULL,
  drag_model = "G1",
  use_form_factor = TRUE
)

Arguments

cd_base

Base drag coefficient.

bullet_name

Optional bullet name string.

drag_model

Drag model string.

use_form_factor

Logical.

Value

Adjusted drag coefficient.


Apply low-Reynolds-number drag correction

Description

Apply low-Reynolds-number drag correction

Usage

apply_reynolds_correction(
  base_cd,
  velocity_mps,
  diameter_inches,
  air_density_kg_m3,
  temperature_c,
  mach
)

Arguments

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.

Value

Corrected drag coefficient.


Mark a vector to always serialize as a JSON array (even when length 1)

Description

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).

Usage

as_json_array(x)

Arguments

x

An R vector or list.

Value

x with S3 class "ballistics_array" prepended.


Mark an empty list to serialize as an empty JSON object {}

Description

Mark an empty list to serialize as an empty JSON object {}

Usage

as_json_object(x = list())

Arguments

x

An R list (default list()).

Value

x with S3 class "ballistics_object" prepended.


Mark a list as an already-resolved solve request

Description

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.

Usage

as_resolved_request(x)

Arguments

x

A ResolvedSolveRequestV1 list.

Value

x, with class "ballistics_resolved_request" added.


Create a downrange atmosphere-segment (AtmoSock) handle

Description

Create a downrange atmosphere-segment (AtmoSock) handle

Usage

atmo_sock(segments)

Arguments

segments

A data.frame or list with columns/fields temperature_c, pressure_hpa, humidity_percent, and until_m.

Value

An opaque handle of class "AtmoSockHandle".


Construct an AtmosphericConditions configuration list

Description

Omitted (NULL) temperature or pressure preserves StationAtmospherePresence semantics so ICAO standard air at altitude is resolved automatically.

Usage

atmospheric_conditions(
  temperature = NULL,
  pressure = NULL,
  humidity = 50,
  altitude = 0
)

Arguments

temperature

Ambient temperature (C in metric, F in imperial), or NULL.

pressure

Absolute station pressure (hPa in metric, inHg in imperial), or NULL.

humidity

Relative humidity percent (⁠0..100⁠; sensor band ⁠-5..105⁠).

altitude

Station altitude (m in metric, ft in imperial).

Value

Named list of atmospheric conditions.


Construct a BallisticInputs configuration list

Description

Creates a named list of ballistic input parameters. Any omitted fields use ballistics-engine's BallisticInputs::default() values.

Usage

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,
  ...
)

Arguments

bc_value

Ballistic coefficient (G1, G7, etc.).

bc_type

Drag model ("G1", "G2", "G5", "G6", "G7", "G8", "GI", "GS", "RA4").

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; TRUE for right-hand twist.

use_rk4

Logical; use RK4 integration.

use_adaptive_rk45

Logical; use adaptive RK45 integration.

enable_trajectory_sampling

Logical; populate sampled_points.

sample_interval

Sampling interval (m in metric, yards in imperial).

...

Any additional BallisticInputs fields (e.g., enable_coriolis, latitude, shot_azimuth, cant_angle, enable_magnus, enable_advanced_effects, use_enhanced_spin_drift, enable_wind_shear, wind_shear_model, enable_pitch_damping, enable_precession_nutation, enable_aerodynamic_jump, bc_reference_standard, drops_reference, powder_temp_curve, bc_segments, bc_segments_data, custom_drag_table, cd_scale, custom_drag_reference, sight_offset_lateral_m, zero_poi_vertical_m, zero_poi_horizontal_m, powder_temp, powder_temp_sensitivity, powder_temp_curve, etc.). A field whose name states a unit (⁠*_m⁠, ⁠*_c⁠, ⁠*_mps⁠) is in that unit in both unit systems. In imperial, powder_temp is in °F, powder_temp_sensitivity in fps per °F and powder_temp_curve is (°F, fps) pairs; in metric, °C, m/s per °C and (°C, m/s).

Value

A named list suitable for solve_trajectory(), calculate_zero_angle(), run_monte_carlo(), and ballistics_solver().


Physical and numerical constants from ballistics-engine

Description

Physical and numerical constants from ballistics-engine

Usage

ballistics_constants()

Value

Named list of all physical and numerical constants exported by ballistics_engine::constants and core solver limits.


Create a stateful BallisticsSolver handle

Description

Wraps 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()⁠.

Usage

ballistics_solver(inputs = ballistic_inputs(), wind = NULL, atmosphere = NULL)

Arguments

inputs

List of ballistic inputs (SI units; see ballistic_inputs()).

wind

Optional list of wind conditions (SI units).

atmosphere

Optional list of atmospheric conditions (SI units).

Value

An external pointer handle of class "BallisticsSolver".


Load a legacy offline binary BC correction table (BcCorrectionTable)

Description

Load a legacy offline binary BC correction table (BcCorrectionTable)

Usage

bc_table_load(path)

Arguments

path

File path to the binary BC table.

Value

An opaque handle of class "BcTableHandle".


Convert a caliber in inches to its integer 5D table key

Description

Convert a caliber in inches to its integer 5D table key

Usage

bc5d_caliber_to_key(caliber_in)

Arguments

caliber_in

Caliber in inches (e.g. 0.308).

Value

Integer caliber key.


Create a directory-backed 5D BC table manager (Bc5dTableManager)

Description

Create a directory-backed 5D BC table manager (Bc5dTableManager)

Usage

bc5d_manager(table_dir = NULL)

Arguments

table_dir

Optional directory containing caliber-specific 5D BC tables (if NULL, creates an empty manager).

Value

An opaque handle of class "Bc5dManagerHandle".


Parse a 5D ML BC table (Bc5dTable) from raw bytes

Description

Parse a 5D ML BC table (Bc5dTable) from raw bytes

Usage

bc5d_table_from_bytes(bytes)

Arguments

bytes

An R raw vector.

Value

An opaque handle of class "Bc5dTableHandle".


Load a caliber-specific 5D ML BC table (Bc5dTable) from disk

Description

Load a caliber-specific 5D ML BC table (Bc5dTable) from disk

Usage

bc5d_table_load(path, verified = FALSE, caliber_in = NULL)

Arguments

path

File path to a .bin / .bc5d table file.

verified

Logical; use verified path cache (bc_table_5d::path_cache).

caliber_in

Optional expected caliber in inches (used when verified = TRUE).

Value

An opaque handle of class "Bc5dTableHandle".


Boundary-layer wind-shear speed ratio vs. height above launch

Description

Boundary-layer wind-shear speed ratio vs. height above launch

Usage

boundary_layer_speed_ratio(
  height_rel_launch_m,
  model = c("logarithmic", "power_law", "ekman_spiral", "none", "custom_layers")
)

Arguments

height_rel_launch_m

Numeric vector of heights relative to launch (m).

model

One of "none", "logarithmic", "power_law", "ekman_spiral", "custom_layers".

Value

Numeric vector of wind-speed scaling ratios.


Brent's method 1D root finder backed by Rust (angle_calculations::brent_root_find)

Description

Brent's method 1D root finder backed by Rust (angle_calculations::brent_root_find)

Usage

brent_root_find(f, a, b, x_tolerance = 1e-08, max_iterations = 100)

Arguments

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.

Value

Named list with angle_rad (the root), iterations_used, final_error, success.


Invoke the unified versioned JSON command bridge (ballistics_engine::bridge)

Description

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.

Usage

bridge_call(request, raw_json = FALSE)

Arguments

request

Either a named R list (e.g. list(api_version = 1L, command = "meta.capabilities")) or a raw UTF-8 JSON envelope string.

raw_json

Logical; if TRUE and request is a JSON string, returns the raw JSON response string directly without parsing into R objects.

Value

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

Description

Calculate air density and speed of sound at one or more altitudes

Usage

calculate_atmosphere(
  altitude_m = 0,
  temp_override_c = NULL,
  press_override_hpa = NULL,
  humidity_percent = 50
)

Arguments

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 50).

Value

A data.frame with altitude_m, density_kg_m3, and speed_of_sound_mps.


Circular Error Probable (CEP, 50% radius) from 2D impact coordinates

Description

Circular Error Probable (CEP, 50% radius) from 2D impact coordinates

Usage

calculate_cep(wind_drift, drop)

Arguments

wind_drift

Numeric vector of lateral impacts.

drop

Numeric vector of vertical impacts.

Value

Numeric scalar CEP.


Solve wind-aware moving-target intercept lead

Description

Solve wind-aware moving-target intercept lead

Usage

calculate_lead(
  inputs = ballistic_inputs(),
  speed,
  angle_deg = 90,
  range = 500,
  wind = NULL,
  atmosphere = NULL,
  units = c("metric", "imperial")
)

Arguments

inputs

BallisticInputs list.

speed

Target speed (m/s in metric, mph in imperial).

angle_deg

Target travel angle relative to line of sight (degrees; 90 = crossing).

range

Target range (m in metric, yd in imperial).

wind

Optional WindConditions list.

atmosphere

Optional AtmosphericConditions list.

units

Unit system ("metric" or "imperial").

Value

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)

Description

Calculate the zero launch angle (radians)

Usage

calculate_zero_angle(
  inputs = ballistic_inputs(),
  target_distance = 100,
  target_height = NULL,
  wind = NULL,
  atmosphere = NULL,
  resolved = FALSE,
  units = c("metric", "imperial")
)

Arguments

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 inputs$muzzle_height. NULL (the default) zeroes on the line of sight, muzzle_height + sight_height, as the CLI does; 0 would be the bore line, one sight height low.

wind

Optional wind conditions list.

atmosphere

Optional atmospheric conditions list.

resolved

Logical; if TRUE, treats atmosphere as already resolved.

units

Unit system ("metric" or "imperial").

Value

Numeric scalar zero angle in radians.


Find near and far zero crossing distances from a launch angle

Description

Find near and far zero crossing distances from a launch angle

Usage

calculate_zero_range(
  inputs = ballistic_inputs(),
  zero_angle_rad,
  target_height = NULL,
  wind = NULL,
  atmosphere = NULL,
  resolved = FALSE,
  units = c("metric", "imperial")
)

Arguments

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 inputs$muzzle_height. NULL (the default) finds the line-of-sight crossings, muzzle_height + sight_height, as the CLI does; 0 would find the bore-line crossings.

wind

Optional wind conditions list.

atmosphere

Optional atmospheric conditions list.

resolved

Logical; treat atmosphere as already resolved.

units

Unit system ("metric" or "imperial").

Value

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

Description

Validate combined station air conditions

Usage

check_station_air(
  temperature_c = 15,
  pressure_hpa = 1013.25,
  humidity_percent = 50,
  altitude_m = 0
)

Arguments

temperature_c

Ambient temperature (C).

pressure_hpa

Station pressure (hPa).

humidity_percent

Relative humidity percent (⁠-5..105⁠).

altitude_m

Station altitude (m).

Value

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

Description

Assess whether a bullet stays gyroscopically stable through terminal range

Usage

check_trajectory_stability(
  muzzle_stability,
  muzzle_velocity_fps,
  terminal_velocity_fps,
  spin_decay_factor = 0.95
)

Arguments

muzzle_stability

Muzzle Sg.

muzzle_velocity_fps

Muzzle velocity (fps).

terminal_velocity_fps

Terminal velocity (fps).

spin_decay_factor

Spin retention factor (⁠0..1⁠).

Value

Named list with is_stable, terminal_stability, assessment.


List all ballistics-engine CLI commands and surface availability

Description

List all ballistics-engine CLI commands and surface availability

Usage

cli_commands()

Value

A data.frame with columns name and availability.


Compute whole turret clicks for a linear drop at a range

Description

Compute whole turret clicks for a linear drop at a range

Usage

clicks_for(drop_yd, range_yd, click_spec = "0.1mil")

Arguments

drop_yd

Linear drop (in the same length unit as range_yd).

range_yd

Range (same length unit as drop_yd).

click_spec

Click graduation string.

Value

Signed click count.


Predict empirical BC degradation cluster and optional velocity-adjusted BC

Description

Predict empirical BC degradation cluster and optional velocity-adjusted BC

Usage

cluster_bc_predict(
  caliber_in,
  weight_grains,
  bc,
  drag_model = "G1",
  velocity_fps = NULL
)

Arguments

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.

Value

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.


Advance combined precession/nutation AngularState by one step dt

Description

Advance combined precession/nutation AngularState by one step dt

Usage

combined_angular_motion(
  params,
  angular_state,
  time_s,
  dt,
  initial_disturbance = 0.01
)

Arguments

params

Named list of PrecessionNutationParams fields.

angular_state

Named list of AngularState fields (pitch_angle, yaw_angle, pitch_rate, yaw_rate, precession_angle, nutation_phase).

time_s

Current flight time (s).

dt

Time step (s).

initial_disturbance

Initial tip-off disturbance (rad).

Value

Updated AngularState list.


Generate a come-ups elevation adjustment card (card_service::come_ups_v1)

Description

Generate a come-ups elevation adjustment card (card_service::come_ups_v1)

Usage

come_ups(request)

Arguments

request

Named list matching CardRequestV1: muzzle_velocity, ballistic_coefficient, drag_model ("g1", "g7", ...), mass, diameter, sight_height, zero_distance, start, end, step, units ("imperial" or "metric"), adjustment_unit, and atmosphere and wind fields. An omitted sight_height is the CLI's 2 in (50 mm in metric); elevation_click_value / windage_click_value apply only to the "clicks" unit.

Value

An object of S3 class "ballistics_card" (CardResponseV1).


Compare multiple ballistic loads side-by-side (terminal_commands::compare)

Description

Compare multiple ballistic loads side-by-side (terminal_commands::compare)

Usage

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")
)

Arguments

loads

Either a character vector of CLI-style load specs or a list of load lists (name, drag_model, bc, mass, velocity, diameter).

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 ("mil", "moa", "smoa", "iphy", "clicks").

windage_unit

Windage unit.

elevation_click

Optional elevation click spec (e.g. "0.1mil").

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 "absolute" or "qnh".

humidity

Optional relative humidity percent.

altitude

Optional altitude (m or ft).

units

Unit system ("metric" or "imperial").

format

Output format ("table", "json", "csv").

Value

Named list with text, warnings, and notes.


Convert a compass wind bearing to shooter-relative angle

Description

Convert a compass wind bearing to shooter-relative angle

Usage

compass_to_shooter_bearing(bearing, shot_azimuth, radians = FALSE)

Arguments

bearing

Compass wind-FROM bearing (degrees or radians).

shot_azimuth

Shot compass bearing (degrees or radians).

radians

Logical; TRUE if inputs/output are radians, FALSE for degrees.

Value

Shooter-relative wind-FROM angle.


Compute instantaneous 6-DOF equations-of-motion derivatives

Description

Compute instantaneous 6-DOF equations-of-motion derivatives

Usage

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
)

Arguments

pos

Length-3 numeric vector c(x, y, z) (m).

vel

Length-3 numeric vector c(vx, vy, vz) (m/s).

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.

Value

Length-6 numeric vector c(vx, vy, vz, ax, ay, az).


Compute Weapon Employment Zone (WEZ) hit probability vs. range

Description

Compute Weapon Employment Zone (WEZ) hit probability vs. range

Usage

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")
)

Arguments

velocity

Muzzle velocity (m/s in metric, fps in imperial).

angle

Zero/launch angle in radians. NULL (the default) zeroes the rifle the way the WEZ flies it: level, in still air, on its line of sight (the engine's WEZ bore height of 1.5 m plus its default sight height), at 100 m in metric or 100 yd in imperial.

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 parse_target_size() ("18x30", or "5" for a circle of radius 5; inches in imperial, cm in metric) or list (radius_m or width_m/height_m).

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 "G7").

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 (⁠0..100⁠).

units

Unit system ("metric" or "imperial").

Value

An object of S3 class "ballistics_wez".


95% confidence ellipse from 2D impact coordinates

Description

95% confidence ellipse from 2D impact coordinates

Usage

confidence_ellipse(wind_drift, drop)

Arguments

wind_drift

Numeric vector of lateral impacts.

drop

Numeric vector of vertical impacts.

Value

Named list with center_x, center_y, semi_major, semi_minor, angle_rad.


Create an anytime-valid BernoulliConfidenceSequence handle

Description

Create an anytime-valid BernoulliConfidenceSequence handle

Usage

confidence_sequence(level = c("p95", "p90", "p99"))

Arguments

level

Confidence level: "p90", "p95" (default), or "p99".

Value

An opaque handle of class "ConfidenceSeqHandle".


Convert a scalar BC between drag-model families at a given Mach number

Description

Convert a scalar BC between drag-model families at a given Mach number

Usage

convert_bc_at_mach(
  source_bc,
  source_model = "G1",
  target_model = "G7",
  mach = 2
)

Arguments

source_bc

Source ballistic coefficient.

source_model

Source drag model (e.g. "G1").

target_model

Target drag model (e.g. "G7").

mach

Mach number.

Value

Named list (ScalarBcConversionV1).


Convert a scalar BC between drag-model families at a given velocity (fps)

Description

Convert a scalar BC between drag-model families at a given velocity (fps)

Usage

convert_bc_at_velocity(
  source_bc,
  source_model = "G1",
  target_model = "G7",
  velocity_fps = 2650,
  speed_of_sound_fps = 340.29/0.3048
)

Arguments

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, 340.29 / 0.3048, about 1116.437 fps, as the CLI's bc-convert).

Value

Named list (ScalarBcConversionV1).


Convert velocity-banded BC segments between reference drag families

Description

Convert velocity-banded BC segments between reference drag families

Usage

convert_bc_segments(
  segments,
  source_model = "G1",
  target_model = "G7",
  speed_of_sound_fps = 340.29/0.3048
)

Arguments

segments

A data.frame or list of ⁠{velocity_min, velocity_max, bc_value}⁠.

source_model

Source drag model.

target_model

Target drag model.

speed_of_sound_fps

Speed of sound in fps.

Value

Named list (BandedBcConversionV1).


Back-solve true muzzle velocity from a downrange chronograph reading

Description

Back-solve true muzzle velocity from a downrange chronograph reading

Usage

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")
)

Arguments

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

"G1" or "G7".

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 NULL.

pressure

Station pressure (hPa in metric, inHg in imperial), or NULL.

humidity_pct

Relative humidity percent (⁠0..100⁠).

altitude

Station altitude (m in metric, ft in imperial).

bc_segments

Optional velocity-BC segments data.frame/list.

units

Unit system ("metric" or "imperial").

Value

Named list with muzzle_velocity_mps (or muzzle_velocity_fps) and iterations.


Courtney-Miller plastic-tip stability correction

Description

Courtney-Miller plastic-tip stability correction

Usage

courtney_miller_plastic_tip(
  uncorrected_sg,
  caliber_inches,
  total_length_inches,
  tip_length_inches
)

Arguments

uncorrected_sg

Uncorrected Miller Sg.

caliber_inches

Caliber (inches).

total_length_inches

Total length including tip (inches).

tip_length_inches

Plastic tip length (inches).

Value

Corrected Sg.


Crosswind aerodynamic-jump sensitivity (MOA per m/s)

Description

Crosswind aerodynamic-jump sensitivity (MOA per m/s)

Usage

crosswind_jump_sensitivity(
  muzzle_velocity_mps,
  spin_rate_rad_s,
  caliber_m,
  mass_kg,
  twist_rate_calibers,
  is_right_twist = TRUE
)

Arguments

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.

Value

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

Description

Damped yaw of repose and convergence rate

Usage

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"
)

Arguments

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: "match" (the match boat-tail set), "match_boat_tail", "match_flat_base", "vld", "hunting" or "fmj". Any other name is an error.

Value

Named list with yaw_rad and convergence_rate.


Decode and validate a solve-json v1 request

Description

Decode and validate a solve-json v1 request

Usage

decode_solve_request_v1(request)

Arguments

request

Named R list or JSON string conforming to SolveRequestV1.

Value

Validated request list, or a SolveErrorEnvelopeV1 list on error.


Get legacy default form factor by bullet name and drag model

Description

Get legacy default form factor by bullet name and drag model

Usage

default_form_factor(bullet_name, drag_model = "G1")

Arguments

bullet_name

Bullet name string.

drag_model

Drag model string.

Value

Numeric form factor.


Estimate default barrel twist rate (inches/turn) targeting Sg = 2.0

Description

Estimate default barrel twist rate (inches/turn) targeting Sg = 2.0

Usage

default_twist_inches(diameter_m, mass_kg, muzzle_velocity_mps)

Arguments

diameter_m

Bullet diameter (m).

mass_kg

Bullet mass (kg).

muzzle_velocity_mps

Muzzle velocity (m/s).

Value

Twist rate in inches per turn.


Run the versioned atmosphere.density_altitude v1 service

Description

Run the versioned atmosphere.density_altitude v1 service

Usage

density_altitude(request)

Arguments

request

Named list conforming to DensityAltitudeRequestV1 (containing atmosphere with explicit-SI temperature_k, pressure_pa, relative_humidity fraction ⁠0..1⁠, altitude_m, pressure_reference).

Value

Named list representing DensityAltitudeResponseV1.


Density-matched standard altitude (meters)

Description

Density-matched standard altitude (meters)

Usage

density_matched_altitude(
  temperature_c,
  station_pressure_hpa,
  humidity_percent = 50
)

Arguments

temperature_c

Ambient temperature in Celsius.

station_pressure_hpa

Station pressure in hPa.

humidity_percent

Relative humidity percent (⁠0..100⁠).

Value

Density-matched standard altitude in meters.


Interpolate Mach-keyed BC segments

Description

Interpolate Mach-keyed BC segments

Usage

derivatives_interpolated_bc(mach, segments, inputs = NULL)

Arguments

mach

Numeric vector of Mach numbers.

segments

2-column data.frame or matrix of ⁠(mach, bc)⁠.

inputs

Optional BallisticInputs list.

Value

Numeric vector of interpolated BCs.


Derive a Mach-keyed DSF point from an observed drop (truing_service::derive_dsf_point_v1)

Description

Derive a Mach-keyed DSF point from an observed drop (truing_service::derive_dsf_point_v1)

Usage

derive_dsf_point(request)

Arguments

request

Named list matching DsfDeriveRequestV1.

Value

Named list (DsfPointResultV1).


Compute a dial/hold/hybrid engagement plan via truing_service::dial_plan_v1

Description

Compute a dial/hold/hybrid engagement plan via truing_service::dial_plan_v1

Usage

dial_plan(request)

Arguments

request

Named list matching DialPlanRequestV1.

Value

Named list (DialPlanReportV1).


Discretize a candidate range interval (yards) for truing experiment planning

Description

Discretize a candidate range interval (yards) for truing experiment planning

Usage

discretize_truing_ranges(start_yd, end_yd, step_yd)

Arguments

start_yd

Start range (yd).

end_yd

End range (yd).

step_yd

Step (yd).

Value

Numeric vector of candidate ranges in yards.


Query PDF dope card pagination layout (rows_per_page, page_count)

Description

Query PDF dope card pagination layout (rows_per_page, page_count)

Usage

dope_card_layout_info(row_count, font_scale = 1)

Arguments

row_count

Number of rows to print.

font_scale

Font scale factor in ⁠[0.5, 3.0]⁠ (default 1.0).

Value

Named list with rows_per_page and page_count.


Evaluate standard reference drag coefficient Cd(Mach) (vectorized)

Description

Evaluate standard reference drag coefficient Cd(Mach) (vectorized)

Usage

drag_coefficient(mach, drag_model = "G7")

Arguments

mach

Numeric vector of Mach numbers.

drag_model

One of "G1", "G2", "G5", "G6", "G7", "G8", "GI", "GS", "RA4".

Value

Numeric vector of drag coefficients.


Evaluate drag coefficient with optional transonic and Reynolds corrections

Description

Evaluate drag coefficient with optional transonic and Reynolds corrections

Usage

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
)

Arguments

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 ("spitzer", "round_nose", "flat_base", "boat_tail").

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.

Value

Numeric vector of corrected drag coefficients.


Construct a custom or reference DragTable handle

Description

Construct a custom or reference DragTable handle

Usage

drag_table(mach = NULL, cd = NULL, csv = NULL, file = NULL, reference = NULL)

Arguments

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 ("G1", "G7", etc.).

Value

An opaque handle of class "DragTableHandle".


Convert linear drop and range into angular turret adjustment (vectorized)

Description

Convert linear drop and range into angular turret adjustment (vectorized)

Usage

drop_to_adjustment(drop_yd, range_yd, unit = c("mil", "moa", "smoa", "iphy"))

Arguments

drop_yd

Numeric vector of drops (same unit as range_yd).

range_yd

Numeric vector of ranges.

unit

One of "mil", "moa", "smoa", "iphy".

Value

Numeric vector of angular adjustments.


Create a Mach-keyed Drop Scale Factor (DsfTable) handle

Description

Create a Mach-keyed Drop Scale Factor (DsfTable) handle

Usage

dsf_table(points = NULL)

Arguments

points

Optional data.frame or list of ⁠{mach, dsf}⁠ points.

Value

An opaque handle of class "DsfTableHandle".


Compute the DSF truing window start distance (meters) from Mach 0.9 distance

Description

Compute the DSF truing window start distance (meters) from Mach 0.9 distance

Usage

dsf_window_start(mach_0_9_distance_m)

Arguments

mach_0_9_distance_m

Distance (m) where velocity drops below Mach 0.9.

Value

Numeric scalar distance in meters, or NULL.


Dynamic gyroscopic stability from bullet geometry and spin rate

Description

Dynamic gyroscopic stability from bullet geometry and spin rate

Usage

dynamic_stability_spin(
  bullet_mass_grains,
  velocity_mps,
  spin_rate_rad_s,
  caliber_inches,
  length_inches,
  air_density_kg_m3 = 1.225
)

Arguments

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).

Value

Stability factor.


Compute effective gyroscopic stability factor (Sg) from BallisticInputs

Description

Compute effective gyroscopic stability factor (Sg) from BallisticInputs

Usage

effective_sg(inputs = ballistic_inputs(), temp_c = 15, press_hpa = 1013.25)

Arguments

inputs

Ballistic inputs list (SI).

temp_c

Ambient temperature (C).

press_hpa

Station pressure (hPa).

Value

Effective Miller stability factor Sg.


Get the underlying ballistics-engine version

Description

Get the underlying ballistics-engine version

Usage

engine_version()

Value

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⁠).


Full enhanced spin drift decomposition (SpinDriftComponents)

Description

Full enhanced spin drift decomposition (SpinDriftComponents)

Usage

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
)

Arguments

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.

Value

Named list with all 11 SpinDriftComponents fields.


Simplified enhanced spin drift (meters)

Description

Simplified enhanced spin drift (meters)

Usage

enhanced_spin_drift_simple(
  time_s,
  stability,
  velocity_mps,
  twist_rate,
  is_twist_right = TRUE,
  caliber = 0.00782
)

Arguments

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.

Value

Spin drift in meters.


Epicyclic precession and nutation frequencies (rad/s)

Description

Epicyclic precession and nutation frequencies (rad/s)

Usage

epicyclic_frequencies(
  spin_inertia,
  transverse_inertia,
  spin_rate_rad_s,
  stability_factor
)

Arguments

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.

Value

Named list with precession_rad_s and nutation_rad_s.


Compute instantaneous epicyclic ⁠(pitch_rad, yaw_rad)⁠ at time t

Description

Compute instantaneous epicyclic ⁠(pitch_rad, yaw_rad)⁠ at time t

Usage

epicyclic_motion(
  spin_inertia,
  transverse_inertia,
  spin_rate_rad_s,
  stability_factor,
  time_s,
  initial_yaw_rad
)

Arguments

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).

Value

Named list with pitch_rad and yaw_rad.


Propagate input uncertainties to impact covariance and ranked variance shares

Description

Propagate input uncertainties to impact covariance and ranked variance shares

Usage

error_budget(request, sources, ranges_m, target = NULL)

Arguments

request

SolveRequestV1 or ResolvedSolveRequestV1.

sources

Named list or named numeric vector mapping InputAxis names to 1-sigma uncertainties in SI units (e.g. list(muzzle_velocity_mps = 3, wind_speed = 1.0)).

ranges_m

Numeric vector of ranges (m).

target

Optional TargetGeometryV1 list for analytical hit probability.

Value

An object of S3 class "ballistics_error_budget" (ErrorBudgetReportV1).


Estimate ballistic coefficient from observed drop or velocity data

Description

Estimate ballistic coefficient from observed drop or velocity data

Usage

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")
)

Arguments

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 data.frame, matrix, or list of ⁠(distance, drop)⁠ or ⁠(distance, velocity)⁠ pairs (in SI meters & m/s for metric, or yards & inches/fps for imperial).

drag_model

Drag model string (default "G7").

mode

Fit mode: "drop" or "velocity".

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 ("metric" or "imperial").

Value

Named list with bc, rms_error, drag_model, mode, at_bound.


Empirically estimate velocity-banded BC segments from bullet characteristics

Description

Empirically estimate velocity-banded BC segments from bullet characteristics

Usage

estimate_bc_segments(
  base_bc,
  caliber_in = 0.308,
  weight_grains = 168,
  model = "Match",
  drag_model = "G7"
)

Arguments

base_bc

Nominal BC.

caliber_in

Bullet diameter (inches).

weight_grains

Bullet mass (grains).

model

Bullet model string (e.g. "ELD-M", "SMK").

drag_model

Drag model string (e.g. "G7").

Value

A data.frame with columns velocity_min, velocity_max, bc_value.


Estimate bullet length (meters) from diameter and mass

Description

Estimate bullet length (meters) from diameter and mass

Usage

estimate_bullet_length(diameter_m, mass_kg)

Arguments

diameter_m

Bullet diameter (m).

mass_kg

Bullet mass (kg).

Value

Estimated bullet length in meters.


Evaluate bullet load against all USPSA, IDPA, and SASS power-factor divisions

Description

Evaluate bullet load against all USPSA, IDPA, and SASS power-factor divisions

Usage

evaluate_power_factor(weight_gr, velocity_fps)

Arguments

weight_gr

Bullet weight in grains.

velocity_fps

Muzzle velocity in fps.

Value

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

Description

Explain differences between two solve requests by symmetric counterfactual group swaps

Usage

explain_difference(request_a, request_b, ranges_m)

Arguments

request_a

Baseline SolveRequestV1 or ResolvedSolveRequestV1.

request_b

Comparison SolveRequestV1 or ResolvedSolveRequestV1.

ranges_m

Numeric vector of ranges (m).

Value

Named list (SolutionDiffReportV1).


Export a ProfileData list to an ArcherBC2 .a7p binary file

Description

Export a ProfileData list to an ArcherBC2 .a7p binary file

Usage

export_a7p(profile, file = NULL)

Arguments

profile

Named list matching ProfileData.

file

Optional output file path to write the .a7p bytes to disk.

Value

Named list with bytes (R raw), dropped_fields, not_carried, and warnings.


FAA-rule density altitude (feet)

Description

FAA-rule density altitude (feet)

Usage

faa_density_altitude(station_pressure_hpa, temperature_f)

Arguments

station_pressure_hpa

Station pressure in hPa.

temperature_f

Ambient temperature in degrees Fahrenheit.

Value

Density altitude in feet.


Fast fixed-step trajectory integration

Description

Exposes ⁠ballistics_engine::fast_trajectory::fast_integrate⁠ and fast_integrate_with_segments.

Usage

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
)

Arguments

inputs

Ballistic inputs list (SI).

initial_state

Length-6 numeric vector c(x, y, z, vx, vy, vz) (m, m/s).

t_span

Length-2 numeric vector c(t_start, t_end) (s).

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 data.frame/list.

atmo_segments

Optional downrange atmosphere segments data.frame/list.

query_times

Optional numeric vector of query times (s) for dense interpolation.

Value

List with success, trajectory (data.frame), t_events, and interpolated.


Format a built-in reference drag curve as table, CSV, or JSON text

Description

Format a built-in reference drag curve as table, CSV, or JSON text

Usage

format_reference_drag_curve(
  drag_model = "G7",
  format = c("table", "csv", "json")
)

Arguments

drag_model

Drag model string.

format

One of "table", "csv", "json".

Value

Character scalar.


Format a ReticleDescription as table or JSON text

Description

Format a ReticleDescription as table or JSON text

Usage

format_reticle_description(reticle, format = c("table", "json"))

Arguments

reticle

Named list (ReticleDescription).

format

"table" or "json".

Value

Character scalar.


SAAMI free-recoil momentum-balance calculator

Description

SAAMI free-recoil momentum-balance calculator

Usage

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")
)

Arguments

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: "rifle", "pistol", "shotgun_average", or "shotgun_long".

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 ("metric" or "imperial").

Value

Named list with recoil_velocity_mps, recoil_energy_j, impulse_ns, gas_velocity_mps (plus imperial equivalents when units = "imperial").


Render a printable PDF dope card directly from DopeCardConfig and CardRows

Description

Render a printable PDF dope card directly from DopeCardConfig and CardRows

Usage

generate_dope_card_pdf(
  config,
  rows,
  range_unit = c("yards", "meters"),
  file = NULL
)

Arguments

config

Named list of DopeCardConfig fields (rifle_name, location, bullet, weight_gr, bc, drag_model, velocity_fps, font_scale or font_preset, elevation_unit_label, windage_unit_label, etc.).

rows

A data.frame or list of CardRow entries (range, drop_adj, wind_adj, velocity, energy, time, etc.).

range_unit

"yards" or "meters".

file

Optional file path to write the PDF bytes to disk.

Value

An R raw vector containing the PDF document bytes.


Pure gyroscopic spin drift component (meters)

Description

Pure gyroscopic spin drift component (meters)

Usage

gyroscopic_drift(
  stability_factor,
  yaw_rad,
  velocity_mps,
  time_s,
  is_right_twist = TRUE
)

Arguments

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.

Value

Gyroscopic drift in meters.


Solve an interpolated drop-vs-range HoldCurve handle

Description

Supports ⁠$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(...)⁠.

Usage

hold_curve(load = list(), max_range_m = 1500)

Arguments

load

Named list matching HoldCurveLoad (velocity_mps, bc, mass_kg, diameter_m, drag_model, sight_height_m, zero_distance_m, temperature_c, pressure_hpa, humidity, altitude_m, wind_speed_mps, wind_direction_deg).

max_range_m

Maximum curve range in meters.

Value

An opaque handle of class "HoldCurveHandle".


Locate a ⁠(drop_mil, wind_mil)⁠ hold point within a reticle

Description

Locate a ⁠(drop_mil, wind_mil)⁠ hold point within a reticle

Usage

hold_point_in_reticle(
  drop_mil,
  wind_mil,
  magnification = 10,
  reticle,
  format = NULL
)

Arguments

drop_mil

Required holdover (MIL, positive down).

wind_mil

Required wind hold (MIL, positive right).

magnification

Scope magnification.

reticle

Named list (ReticleDescription).

format

Optional text format (NULL for structured list, or "table" / "json").

Value

Named list (ReticleHold) or formatted string.


Identify bullet type classification, sectional density, and degradation factors

Description

Identify bullet type classification, sectional density, and degradation factors

Usage

identify_bullet_type(
  model = "Match",
  weight_grains = 168,
  caliber_in = 0.308,
  bc_value = NULL,
  drag_model = "G7"
)

Arguments

model

Bullet model string.

weight_grains

Bullet weight (grains).

caliber_in

Bullet diameter (inches).

bc_value

Optional BC value.

drag_model

Drag model string.

Value

Named list with bullet_type, sectional_density, drop, transition_curve.


Import an ArcherBC2 .a7p binary ballistic profile

Description

Import an ArcherBC2 .a7p binary ballistic profile

Usage

import_a7p(bytes = NULL, file = NULL, name_override = NULL, zero_click = NULL)

Arguments

bytes

An R raw vector of .a7p file bytes (or supply file).

file

Optional file path to read .a7p bytes from disk.

name_override

Optional replacement profile name.

zero_click

Optional source-device click graduation (e.g. "0.1mil") to convert stored device zero clicks into linear POI offsets.

Value

Named list with profile, envelope, unknown_field_count, and report (mapped, unmapped, warnings).


Import a third-party .reticle XML drawing document

Description

Import a third-party .reticle XML drawing document

Usage

import_reticle_document(xml = NULL, file = NULL)

Arguments

xml

XML string (or pass file to read from disk).

file

Optional path to a .reticle XML file.

Value

Named list with reticle (ReticleDescription) and report.


Import a Ventum JSON reticle specification

Description

Import a Ventum JSON reticle specification

Usage

import_ventum_reticle(json = NULL, file = NULL)

Arguments

json

JSON string (or pass file to read from disk).

file

Optional path to a Ventum JSON reticle file.

Value

Named list with reticle (ReticleDescription) and report.


Low-level ODE trajectory integration (RK4 / RK45 / Euler)

Description

Exposes ⁠ballistics_engine::trajectory_integration::try_integrate_trajectory⁠.

Usage

integrate_trajectory(
  initial_state,
  t_span = c(0, 5),
  params = list(),
  method = c("RK45", "RK4", "Euler"),
  tolerance = 1e-06,
  max_step = 0.01
)

Arguments

initial_state

Length-6 numeric vector c(x, y, z, vx, vy, vz).

t_span

Length-2 numeric vector c(t_start, t_end).

params

Named list of TrajectoryParams fields (mass_kg, bc, drag_model, wind_segments, atmosphere, target_distance_m, etc.).

method

Integrator method: "RK45", "RK4", or "Euler".

tolerance

Relative/absolute error tolerance for adaptive RK45.

max_step

Maximum integration step size (s).

Value

A data.frame with columns ⁠t, x, y, z, vx, vy, vz⁠.


Interpolate a measured powder temperature-to-velocity curve

Description

Interpolate a measured powder temperature-to-velocity curve

Usage

interpolate_powder_curve(curve, temps_c)

Arguments

curve

2-column data.frame or matrix of ⁠(temperature_c, velocity_mps)⁠.

temps_c

Numeric vector of query temperatures in Celsius.

Value

Numeric vector of interpolated muzzle velocities (m/s).


Compute moving-target lead components from an explicit time of flight

Description

Compute moving-target lead components from an explicit time of flight

Usage

lead_from_tof(speed_mps, angle_deg = 90, tof_s, range_m)

Arguments

speed_mps

Target speed (m/s).

angle_deg

Target heading angle relative to line of sight (degrees; 90 = crossing).

tof_s

Bullet time of flight (s).

range_m

Target range (m).

Value

Named list with lead_m, lead_mil, lead_moa.


Limit-cycle yaw angle (radians)

Description

Limit-cycle yaw angle (radians)

Usage

limit_cycle_yaw(
  velocity_mps,
  spin_rate_rad_s,
  stability_factor,
  spin_inertia = NULL,
  transverse_inertia = NULL
)

Arguments

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).

Value

Limit-cycle yaw angle (rad).


Litz crosswind aerodynamic-jump estimator (MOA)

Description

Litz crosswind aerodynamic-jump estimator (MOA)

Usage

litz_crosswind_jump(
  sg,
  length_calibers,
  crosswind_from_right_mph,
  is_right_twist = TRUE
)

Arguments

sg

Gyroscopic stability factor Sg.

length_calibers

Bullet length in calibers.

crosswind_from_right_mph

Signed crosswind from right (mph).

is_right_twist

Logical.

Value

Signed vertical aerodynamic jump in MOA.


Litz spin drift approximation (vectorized)

Description

Litz spin drift approximation (vectorized)

Usage

litz_spin_drift(
  sg,
  t_s,
  is_twist_right = TRUE,
  units = c("metric", "imperial")
)

Arguments

sg

Numeric vector of gyroscopic stability factors (Sg).

t_s

Numeric vector of times of flight (seconds).

is_twist_right

Logical; TRUE for right-hand twist (only used in metric signed output).

units

"metric" (signed meters) or "imperial" (unsigned inches).

Value

Numeric vector of spin drift displacements.


Local atmosphere lapse from base station conditions

Description

Local atmosphere lapse from base station conditions

Usage

local_atmosphere(
  altitude_m,
  base_alt_m = 0,
  base_temp_c = 15,
  base_press_hpa = 1013.25,
  base_ratio = 1,
  humidity_percent = 50
)

Arguments

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 NULL, uses dry legacy path).

Value

Named list with density_kg_m3 and speed_of_sound_mps.


Detect whether text looks like a .drg Doppler drag file

Description

Detect whether text looks like a .drg Doppler drag file

Usage

looks_like_drg(text)

Arguments

text

Character scalar.

Value

Logical scalar.


Magnus lateral drift component (meters)

Description

Magnus lateral drift component (meters)

Usage

magnus_drift(
  velocity_mps,
  spin_rate_rad_s,
  yaw_rad,
  air_density_kg_m3,
  caliber_inches,
  time_s,
  mass_grains
)

Arguments

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).

Value

Magnus drift component in meters.


Linear-interpolated percentile over a sorted numeric vector

Description

Linear-interpolated percentile over a sorted numeric vector

Usage

mc_percentile(sorted_values, p)

Arguments

sorted_values

Sorted numeric vector.

p

Probability in ⁠[0, 1]⁠ (as stats::quantile()'s probs): 0.5 is the median.

Value

Numeric scalar percentile.


Moist-air speed of sound (vectorized)

Description

Moist-air speed of sound (vectorized)

Usage

moist_speed_of_sound(
  temp_k = 288.15,
  pressure_pa = 101325,
  humidity_percent = 50
)

Arguments

temp_k

Temperature in Kelvin (numeric vector).

pressure_pa

Pressure in Pascals (numeric vector).

humidity_percent

Relative humidity percent ⁠0..100⁠ (numeric vector).

Value

Numeric vector of speeds of sound in m/s.


Axial moment of inertia Ix (kg*m^2)

Description

Axial moment of inertia Ix (kg*m^2)

Usage

moment_of_inertia(mass_kg, caliber_m, length_m, shape = "boat_tail")

Arguments

mass_kg

Mass (kg).

caliber_m

Caliber (m).

length_m

Length (m).

shape

Shape for the moment of inertia: "cylinder", "ogive" or "boat_tail". Any other name is an error.

Value

Axial moment of inertia (kg*m^2).


Compute moving-target uncertainty ring radius

Description

Compute moving-target uncertainty ring radius

Usage

mover_ring(target_speed_mps, time_s, downrange_m)

Arguments

target_speed_mps

Target speed (m/s).

time_s

Time of flight (s).

downrange_m

Downrange distance (m).

Value

Named list with radius_m and radius_mil.


Multi-observation joint MV and BC truing

Description

Multi-observation joint MV and BC truing

Usage

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")
)

Arguments

observations

data.frame(range_yd, drop), list of observations, or character vector of "range:drop" strings.

drop_unit

"mil", "moa", or "in".

bc_input

Nominal BC.

drag_model

"G1" or "G7".

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 1.0).

units

Unit system for parsing string observations ("imperial" or "metric").

Value

Named list (MultiTruingReport).


Compute the recommended MV calibration range window (meters) from Mach 1.2 distance

Description

Compute the recommended MV calibration range window (meters) from Mach 1.2 distance

Usage

mv_calibration_window(mach_1_2_distance_m)

Arguments

mach_1_2_distance_m

Distance (m) where velocity drops below Mach 1.2.

Value

Named list list(near_m, far_m), or NULL.


Damped nutation amplitude at time t

Description

Damped nutation amplitude at time t

Usage

nutation_amplitude(
  initial_disturbance_rad,
  time_s,
  nutation_frequency,
  damping_factor,
  spin_rate_rad_s
)

Arguments

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).

Value

Nutation amplitude (rad).


Bivariate normal hit probability over a rectangular or circular target

Description

Bivariate normal hit probability over a rectangular or circular target

Usage

p_hit_bivariate(var_drop, var_wind, cov, target)

Arguments

var_drop

Drop variance (m^2).

var_wind

Windage variance (m^2).

cov

Drop-windage covariance (m^2).

target

Target geometry list: either list(circle = list(radius_m = ...)) / list(rect = list(width_m = ..., height_m = ...)) or the flat shorthand list(radius_m = ...) / list(width_m = ..., height_m = ...).

Value

Hit probability in ⁠[0, 1]⁠.


Parse a turret click graduation specification (e.g. "0.1mil", "0.25moa", "1/8moa")

Description

Parse a turret click graduation specification (e.g. "0.1mil", "0.25moa", "1/8moa")

Usage

parse_click_value(spec)

Arguments

spec

Click graduation string.

Value

Named list with size, base, and size_mil.


Parse a .drg Doppler drag-curve text file or string

Description

Parse a .drg Doppler drag-curve text file or string

Usage

parse_drg(text = NULL, file = NULL)

Arguments

text

.drg file contents as a string (or set file to read from disk).

file

Optional path to a .drg file.

Value

Named list with name and points (data.frame(mach, cd)).


Parse a powder temperature sweep specification

Description

Parse a powder temperature sweep specification

Usage

parse_powder_sweep(spec)

Arguments

spec

Sweep string "START:END:STEP" (e.g. "0:100:10"), as the CLI's --powder-sweep.

Value

Numeric vector of temperatures.


Parse a WEZ target-size specification string (e.g. "18x30", "5")

Description

Parse a WEZ target-size specification string (e.g. "18x30", "5")

Usage

parse_target_size(spec, units = c("metric", "imperial"))

Arguments

spec

Target size, as the CLI's monte-carlo --target-size: "WIDTHxHEIGHT" for a rectangle, or a single number for a circle of that RADIUS; inches in imperial, cm in metric, with no unit suffix.

units

Unit system ("metric" or "imperial").

Value

Named list describing the metric target geometry.


Parse a target specification string (e.g. "rect:18x30", "circle:10")

Description

Parse a target specification string (e.g. "rect:18x30", "circle:10")

Usage

parse_target_spec(spec, units = c("metric", "imperial"))

Arguments

spec

Target specification string, as the CLI's hold-corridor --target: rect:WIDTHxHEIGHT or circle:DIAMETER, in inches for imperial and cm for metric.

units

Unit system ("metric" or "imperial").

Value

Parsed TargetSpec list.


Parse a wind direction token (degrees, or a clock position like "3oc" or "10h30")

Description

Parse a wind direction token (degrees, or a clock position like "3oc" or "10h30")

Usage

parse_wind_direction(token, standalone = FALSE)

Arguments

token

Direction string.

standalone

Logical; use standalone parser rules.

Value

Named list with degrees and was_clock.


Parse a wind-truing observation string (e.g. "600:-8.5")

Description

Parse a wind-truing observation string (e.g. "600:-8.5")

Usage

parse_wind_observation(spec, units = c("imperial", "metric"))

Arguments

spec

Observation string ⁠RANGE:RIGHT_IN[:SIGMA]⁠, as the CLI's true-wind --miss: the range (yd in imperial, m in metric) and the miss to the RIGHT in inches (negative = left), in both unit systems, with an optional standard deviation in inches.

units

Unit system ("imperial" or "metric").

Value

Named list (WindObservation).


Parse a named wind-scenario set document

Description

Parse a named wind-scenario set document

Usage

parse_wind_scenario_set(text, units = c("metric", "imperial"))

Arguments

text

JSON/text wind-scenario set specification.

units

Unit system ("metric" or "imperial").

Value

Parsed WindScenarioSetV1 list.


Parse a CLI-style wind segment specification string

Description

Parse a CLI-style wind segment specification string

Usage

parse_wind_segment(spec, imperial = FALSE)

Arguments

spec

Wind segment string, ⁠SPEED:ANGLE:UNTIL[:VERTICAL]⁠, as the CLI's --wind-segment (e.g. "10:90:500", "10:3oc:500", "10:10h30:500:1"). The angle is degrees or a clock position (⁠3oc⁠, ⁠10h30⁠).

imperial

Logical; interpret speed/distance in imperial units (mph/yd).

Value

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).


Generate a printable PDF dope card via card_service::pdf_card_v1

Description

Generate a printable PDF dope card via card_service::pdf_card_v1

Usage

pdf_card(request, stored_card = NULL, file = NULL)

Arguments

request

Named list matching CardRequestV1 (including optional pdf options).

stored_card

Optional StoredCardV1 list to render pre-computed rows directly.

file

Optional file path to write the generated PDF bytes to disk.

Value

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

Description

Format footer BC label text for velocity-keyed BC ladders on printed dope cards

Usage

pdf_ladder_bc_label(drag_model, band_bcs, fallback_bc, interior_gap = FALSE)

Arguments

drag_model

Drag model string (e.g. "G7").

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.

Value

Formatted footer label string.


List all 32 perturbation input axes and their metadata

Description

List all 32 perturbation input axes and their metadata

Usage

perturbation_axes()

Value

A data.frame with columns axis, group, kind, unit, requires_rezero, domain_lower, domain_upper.


List perturbation axes belonging to a named InputGroup

Description

List perturbation axes belonging to a named InputGroup

Usage

perturbation_axes_in_group(group)

Arguments

group

Group name (e.g. "atmosphere", "wind", "muzzle_velocity").

Value

Character vector of axis names.


Bisect a single continuous InputAxis against a monotone R predicate

Description

Bisect a single continuous InputAxis against a monotone R predicate

Usage

perturbation_bisect_axis(
  request,
  axis,
  range_m,
  lower,
  upper,
  predicate,
  tolerance = 1e-04
)

Arguments

request

SolveRequestV1 list, or a resolved request (see as_resolved_request()).

axis

Continuous axis name.

range_m

Evaluation range (m).

lower

Lower search bound.

upper

Upper search bound.

predicate

R function ⁠function(obs)⁠ returning logical (TRUE/FALSE), where obs is a list ⁠(range_m, drop_m, windage_m, time_s, velocity_mps)⁠.

tolerance

Bisection stopping tolerance in axis units.

Value

Numeric boundary value, or NULL if not bracketed.


Compute central-difference drop and windage sensitivities along one InputAxis

Description

Compute central-difference drop and windage sensitivities along one InputAxis

Usage

perturbation_central_difference(request, axis, ranges_m, step = NULL)

Arguments

request

SolveRequestV1 list, or a resolved request (see as_resolved_request()).

axis

Continuous axis name (see perturbation_axes()).

ranges_m

Numeric vector of ranges (m).

step

Optional finite-difference step size.

Value

A data.frame with columns ⁠range_m, d_drop_d_x, d_windage_d_x, step_used, scheme⁠.


Evaluate a SolveRequestV1 at explicit downrange distances via the perturbation kernel

Description

Evaluate a SolveRequestV1 at explicit downrange distances via the perturbation kernel

Usage

perturbation_evaluate(request, ranges_m)

Arguments

request

SolveRequestV1 list or JSON string, or a resolved request (see as_resolved_request()).

ranges_m

Numeric vector of downrange distances (m).

Value

A data.frame with columns ⁠range_m, drop_m, windage_m, time_s, velocity_mps⁠.


Read the value of a single InputAxis from a solve request

Description

Read the value of a single InputAxis from a solve request

Usage

perturbation_read_axis(request, axis)

Arguments

request

SolveRequestV1 list, or a resolved request (see as_resolved_request()).

axis

Axis name (see perturbation_axes()).

Value

Scalar value of that axis, or NULL if unavailable.


Return a copy of a solve request with one InputAxis modified

Description

Return a copy of a solve request with one InputAxis modified

Usage

perturbation_with_axis(request, axis, value)

Arguments

request

SolveRequestV1 list, or a resolved request (see as_resolved_request()).

axis

Axis name (see perturbation_axes()).

value

New axis value.

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.


Pitch damping coefficient C_mq + C_m_alpha_dot vs. Mach (vectorized)

Description

Pitch damping coefficient C_mq + C_m_alpha_dot vs. Mach (vectorized)

Usage

pitch_damping_coefficient(mach, bullet_type = "match")

Arguments

mach

Numeric vector of Mach numbers.

bullet_type

Pitch-damping bullet type: "match" (the match boat-tail set), "match_boat_tail", "match_flat_base", "vld", "hunting" or "fmj". Any other name is an error.

Value

Numeric vector of pitch damping coefficients.


Pitch damping aerodynamic moment (N*m)

Description

Pitch damping aerodynamic moment (N*m)

Usage

pitch_damping_moment(
  pitch_rate_rad_s,
  velocity_mps,
  air_density_kg_m3,
  caliber_m,
  length_m,
  mach,
  bullet_type = "match"
)

Arguments

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: "match" (the match boat-tail set), "match_boat_tail", "match_flat_base", "vld", "hunting" or "fmj". Any other name is an error.

Value

Pitch damping moment (N*m).


Plan dial, hold, or hybrid engagement corrections for an optic

Description

Plan dial, hold, or hybrid engagement corrections for an optic

Usage

plan_corrections(
  correction,
  optic,
  range_m = 500,
  elevation_cf = 1,
  windage_cf = 1,
  preferences = NULL
)

Arguments

correction

Named list list(elevation_mil = ..., windage_mil = ...).

optic

Named list matching OpticProfile.

range_m

Target range (m).

elevation_cf

Elevation tracking CF (default 1.0).

windage_cf

Windage tracking CF (default 1.0).

preferences

Optional Preferences list: prefer_hold (logical) and max_hold_mil.

Value

Named list (DialPlanReportV1).


Design an optimal observation-range plan for identifiable MV/BC truing

Description

Design an optimal observation-range plan for identifiable MV/BC truing

Usage

plan_truing_experiment(request)

Arguments

request

Named list matching TruingExperimentPlanRequestV1.

Value

Named list (TruingExperimentPlanV1).


Plot a trajectory

Description

Plot a trajectory

Usage

## S3 method for class 'ballistics_trajectory'
plot(x, y = c("drop", "height", "velocity", "energy", "windage"), ...)

Arguments

x

A "ballistics_trajectory".

y

What to plot against range: "drop" (drop below the line of sight, drawn with the axis running downward so the curve falls as the bullet does), "height" (the solver-frame height y), "velocity", "energy" or "windage".

...

Passed to graphics::plot().


Compute competition power factor (weight_gr * velocity_fps / 1000, vectorized)

Description

Compute competition power factor (weight_gr * velocity_fps / 1000, vectorized)

Usage

power_factor(weight_gr, velocity_fps, scored = FALSE)

Arguments

weight_gr

Numeric vector of bullet weights in grains.

velocity_fps

Numeric vector of muzzle velocities in fps.

scored

Logical; if TRUE, applies competition truncation rules.

Value

Numeric vector of power factors.


Precession frequency helper from pitch_damping

Description

Precession frequency helper from pitch_damping

Usage

precession_with_damping(
  spin_rate_rad_s,
  spin_inertia,
  transverse_inertia,
  stability_factor
)

Arguments

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.

Value

Precession frequency (rad/s).


Predict gyroscopic stability downrange given velocity drop and spin retention

Description

Predict gyroscopic stability downrange given velocity drop and spin retention

Usage

predict_stability_at_distance(
  initial_stability,
  initial_velocity_fps,
  current_velocity_fps,
  spin_decay_factor = 0.95
)

Arguments

initial_stability

Muzzle Sg.

initial_velocity_fps

Muzzle velocity (fps).

current_velocity_fps

Velocity at range (fps).

spin_decay_factor

Spin retention factor (⁠0..1⁠).

Value

Predicted Sg downrange.


Pressure altitude from station pressure

Description

Pressure altitude from station pressure

Usage

pressure_altitude(station_pressure_hpa, method = c("icao", "nws_ft"))

Arguments

station_pressure_hpa

Numeric vector of station pressures in hPa.

method

"icao" (layered ICAO in meters) or "nws_ft" (NWS troposphere formula in feet).

Value

Numeric vector of pressure altitudes (m for "icao", ft for "nws_ft").


Extract a validated OpticProfile from a ProfileData list

Description

Extract a validated OpticProfile from a ProfileData list

Usage

profile_optic(profile)

Arguments

profile

Named list matching ProfileData.

Value

Named list (OpticProfile), or NULL if no optic fields are set.


Quantize an angular correction onto a turret click detent lattice

Description

Quantize an angular correction onto a turret click detent lattice

Usage

quantize_angle(angle, click_spec = "0.1mil")

Arguments

angle

Angle in the click's own base unit.

click_spec

Click graduation string (e.g. "0.1mil").

Value

Named list with clicks and residual.


Fast ballistic drop approximation (inches)

Description

Fast ballistic drop approximation (inches)

Usage

quick_drop_estimate(
  muzzle_velocity_fps,
  distance_yards,
  bullet_mass_grains,
  bc
)

Arguments

muzzle_velocity_fps

Muzzle velocity (fps).

distance_yards

Range (yards).

bullet_mass_grains

Bullet mass (grains).

bc

Ballistic coefficient.

Value

Estimated drop in inches.


Generate a full range table card (card_service::range_table_v1)

Description

Generate a full range table card (card_service::range_table_v1)

Usage

range_table(request)

Arguments

request

Named list matching CardRequestV1.

Value

An object of S3 class "ballistics_card" (CardResponseV1).


Recommend the best-fitting reference drag family for velocity-banded BC segments

Description

Recommend the best-fitting reference drag family for velocity-banded BC segments

Usage

recommend_bc_family(
  segments,
  source_model = "G1",
  candidates = c("G1", "G7", "G8"),
  speed_of_sound_fps = 340.29/0.3048
)

Arguments

segments

Velocity-banded BC segments data.frame/list.

source_model

Source drag model.

candidates

Character vector of candidate drag models.

speed_of_sound_fps

Speed of sound in fps.

Value

Named list (BcFamilyRecommendationV1).


Reduce sea-level QNH altimeter pressure to local station pressure

Description

Reduce sea-level QNH altimeter pressure to local station pressure

Usage

reduce_qnh(qnh_hpa, altitude_m)

Arguments

qnh_hpa

Sea-level QNH pressure in hPa (numeric vector).

altitude_m

Station altitude in meters (numeric vector).

Value

Numeric vector of local station pressures in hPa.


Retrieve a built-in reference ⁠(mach, cd)⁠ drag table as a data.frame

Description

Retrieve a built-in reference ⁠(mach, cd)⁠ drag table as a data.frame

Usage

reference_drag_table(drag_model = "G7")

Arguments

drag_model

Drag model string ("G1", "G7", etc.).

Value

A data.frame with columns mach and cd.


Render a multi-series Unicode Braille or ASCII chart string

Description

Render a multi-series Unicode Braille or ASCII chart string

Usage

render_terminal_chart(
  series,
  width_cells = 60,
  height_cells = 18,
  style = c("braille", "ascii")
)

Arguments

series

Named list of 2-column data.frames or matrices ⁠(x, y)⁠.

width_cells

Width in terminal character cells.

height_cells

Height in terminal character cells.

style

"braille" or "ascii".

Value

Character scalar containing the rendered chart.


Resolve powder-temperature-adjusted muzzle velocity (m/s)

Description

Resolve powder-temperature-adjusted muzzle velocity (m/s)

Usage

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
)

Arguments

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 ⁠(temp_c, velocity_mps)⁠ curve.

powder_curve_temp_c

Optional explicit powder temperature (C) for curve lookup.

Value

Adjusted muzzle velocity in m/s.


Infer projectile shape from model name, caliber, weight, and drag model

Description

Infer projectile shape from model name, caliber, weight, and drag model

Usage

resolve_projectile_shape(
  bullet_model = NULL,
  caliber_in = 0.308,
  weight_grains = 168,
  drag_model = "G7"
)

Arguments

bullet_model

Optional bullet model name.

caliber_in

Bullet diameter (inches).

weight_grains

Bullet mass (grains).

drag_model

Drag model string.

Value

Character scalar shape name.


Resolve station temperature and pressure honoring presence and pressure mode

Description

Resolve station temperature and pressure honoring presence and pressure mode

Usage

resolve_station_conditions(
  temperature_c = 15,
  pressure_hpa = 1013.25,
  altitude_m = 0,
  pressure_mode = c("absolute", "qnh"),
  temperature_supplied = FALSE,
  pressure_supplied = FALSE
)

Arguments

temperature_c

Temperature in Celsius.

pressure_hpa

Pressure in hPa.

altitude_m

Station altitude in meters.

pressure_mode

"absolute" or "qnh".

temperature_supplied

Logical; whether temperature was explicitly supplied.

pressure_supplied

Logical; whether pressure was explicitly supplied.

Value

Named list with resolved temperature_c and pressure_hpa.


Generate a BDC reticle from ⁠(range, drop_mil)⁠ pairs

Description

Generate a BDC reticle from ⁠(range, drop_mil)⁠ pairs

Usage

reticle_bdc_from_drops(drops)

Arguments

drops

2-column data.frame, matrix, or list of ⁠(range, drop_mil)⁠.

Value

Named list (ReticleDescription).


Fetch a built-in reticle description by catalog ID

Description

Fetch a built-in reticle description by catalog ID

Usage

reticle_by_id(id)

Arguments

id

Catalog ID (see reticle_catalog()).

Value

Named list (ReticleDescription).


List all built-in named reticles in reticle_catalog

Description

List all built-in named reticles in reticle_catalog

Usage

reticle_catalog()

Value

A data.frame with columns id, display_name, source, notes.


Generate a standard parametric mil-dot reticle

Description

Generate a standard parametric mil-dot reticle

Usage

reticle_mil_dot(dots_per_side = 5)

Arguments

dots_per_side

Number of mil dots per side (default 5).

Value

Named list (ReticleDescription).


Generate a uniform MIL hash grid reticle

Description

Generate a uniform MIL hash grid reticle

Usage

reticle_mil_grid(spacing_mil = 0.5, extent_mil = 10)

Arguments

spacing_mil

Mark spacing in MIL.

extent_mil

Maximum extent in MIL.

Value

Named list (ReticleDescription).


Scale reticle marks for an explicit magnification (FFP or SFP)

Description

Scale reticle marks for an explicit magnification (FFP or SFP)

Usage

reticle_scaled_marks(reticle, magnification = 10)

Arguments

reticle

Named list (ReticleDescription).

magnification

Scope magnification.

Value

A data.frame with columns down_mil, right_mil, kind, label.


Generate a Christmas-tree holdover reticle

Description

Generate a Christmas-tree holdover reticle

Usage

reticle_tree(rows = 10, row_spacing_mil = 1, spread_step_mil = 0.5)

Arguments

rows

Number of elevation rows.

row_spacing_mil

Vertical spacing between rows (MIL).

spread_step_mil

Horizontal windage hash spacing (MIL).

Value

Named list (ReticleDescription).


Compute turret revolution annotation ⁠(revolution, remainder_clicks)⁠

Description

Compute turret revolution annotation ⁠(revolution, remainder_clicks)⁠

Usage

revolution_annotation(clicks_from_zero, clicks_per_rev)

Arguments

clicks_from_zero

Signed clicks from zero.

clicks_per_rev

Clicks per turret revolution.

Value

Named list with revolution and remainder_clicks, or NULL.


Run a Monte Carlo ballistic dispersion simulation

Description

Run a Monte Carlo ballistic dispersion simulation

Usage

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")
)

Arguments

inputs

Base BallisticInputs list (see ballistic_inputs()).

wind

Optional base WindConditions list.

atmosphere

Optional base AtmosphericConditions list.

params

Named list of MonteCarloParams (num_simulations, velocity_std_dev, angle_std_dev, bc_std_dev, wind_speed_std_dev, target_distance, base_wind_speed, base_wind_direction, azimuth_std_dev). The base wind may be given here or as wind, not both.

The launch geometry is the CLI's monte-carlo one (and the WEZ's): the bore 1.5 m above the ground and the ground at 0, unless inputs sets muzzle_height / ground_threshold. Results are in SI units whatever units is (units converts the inputs and hit_radius).

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 ("metric" or "imperial").

Value

An object of S3 class "ballistics_mc".


Run an adaptive-stopping seeded Monte Carlo simulation

Description

Stops early once the anytime-valid Bernoulli confidence sequence half-width reaches convergence$target_half_width.

Usage

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
)

Arguments

inputs

Base BallisticInputs list (SI).

wind

Optional base WindConditions list (SI).

atmosphere

Optional base AtmosphericConditions list (SI).

params

MonteCarloParams list (SI).

convergence

Named list with level ("p90"/"p95"/"p99"), target_half_width, min_samples, max_samples, batch_size.

hit_radius_m

Target hit radius in meters.

seed

RNG seed.

Value

Named list representing AdaptiveMcReportV1.


Subsample 2D Monte Carlo impact points for plotting

Description

Subsample 2D Monte Carlo impact points for plotting

Usage

sample_points_for_viz(wind_drift, drop, max_points = 500)

Arguments

wind_drift

Numeric vector of lateral impacts.

drop

Numeric vector of vertical impacts.

max_points

Maximum number of points to return.

Value

A data.frame with columns wind_drift and drop.


Sample a solved state trajectory at regular distance intervals

Description

Sample a solved state trajectory at regular distance intervals

Usage

sample_trajectory(trajectory, outputs = list(), step_m = 50, mass_kg = 0.01)

Arguments

trajectory

A data.frame or list containing t (or times), x, y, z, vx, vy, vz.

outputs

Named list of TrajectoryOutputs (target_distance_horiz_m, target_vertical_height_m, time_of_flight_s, max_ord_dist_horiz_m, sight_height_m).

step_m

Distance step size in meters.

mass_kg

Projectile mass in kg.

Value

A data.frame of sampled trajectory points with flags.


Sanitize a profile name for safe filesystem storage

Description

Sanitize a profile name for safe filesystem storage

Usage

sanitize_profile_name(raw)

Arguments

raw

Character scalar.

Value

Sanitized profile name string.


Sight correction (elevation_rad, windage_rad) for aerodynamic jump

Description

Sight correction (elevation_rad, windage_rad) for aerodynamic jump

Usage

sight_correction_for_jump(
  jump_components,
  zero_range_m = 100,
  sight_height_m = 0.05
)

Arguments

jump_components

Result list from aerodynamic_jump().

zero_range_m

Zero range (m).

sight_height_m

Sight height (m).

Value

Named list with elevation_rad and windage_rad, the correction in radians (the engine works in MOA; 1 MOA = pi / 10800 rad).


Build an explicit-SI SolveRequestV1 list

Description

Convenience 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_*()⁠.

Usage

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)
)

Arguments

mass_kg

Projectile mass (kg).

diameter_m

Projectile diameter (m).

drag_model

Reference drag model string (e.g. "g7", "g1").

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

"right" or "left".

length_m

Optional projectile length (m).

atmosphere

Named list for AtmosphereV1 (SI: temperature_k, pressure_pa, relative_humidity in ⁠0..1⁠, altitude_m).

wind

Named list for WindV1 (speed_mps, direction_from_rad, vertical_speed_mps, or segments).

solver

Named list for SolverV1 (method, time_step_s).

effects

Named list for EffectsV1.

sampling

Named list for SamplingV1 (interval_m).

Value

Named list ready for solve_v1().


Solve robust minimax hold corridors across named segmented-wind scenarios

Description

Solve robust minimax hold corridors across named segmented-wind scenarios

Usage

solve_robust_hold(
  scenarios,
  ranges_m,
  target = NULL,
  load = list(),
  format = NULL,
  units = c("metric", "imperial")
)

Arguments

scenarios

A parsed WindScenarioSetV1 list or raw scenario JSON text.

ranges_m

Numeric vector of target ranges in meters.

target

Optional TargetSpec list or spec string (e.g. "rect:18x30", inches in imperial, cm in metric).

load

Named list describing CorridorLoad (muzzle_velocity_mps, bc, drag_model, mass_kg, diameter_m, zero_distance_m, sight_height_m, atmosphere fields temperature_c, pressure_hpa, humidity_pct, altitude_m), in SI. Omitted fields take hold-corridor's defaults: drag model G1 and a sight height of 2 in (imperial) or 50 mm (metric). A typed temperature or pressure flies as typed at altitude; an omitted one is the standard atmosphere at altitude_m.

format

Optional output format (NULL for structured R list, or "table" / "json" for formatted text).

units

Unit system ("metric" or "imperial").

Value

Structured RobustHoldReportV1 list, or formatted string if format is set.


Solve a ballistic trajectory

Description

Runs ballistics_engine::TrajectorySolver and returns summary metrics plus a points data.frame (and sampled_points when sampling is enabled).

Usage

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
)

Arguments

inputs

List of ballistic inputs (see ballistic_inputs()).

wind

Optional list of wind conditions (see wind_conditions()).

atmosphere

Optional list of atmospheric conditions (see atmospheric_conditions()).

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 data.frame or list with speed_kmh, angle_deg (wind-FROM, degrees), until_m and optional vertical_mps. These keys state their units and are read in them whatever units is.

atmo_segments

Optional downrange atmosphere segments with temperature_c, pressure_hpa, humidity_percent and until_m, read in those units whatever units is.

units

Unit system: "metric" (SI, default) or "imperial".

auto_zero

Logical; if TRUE and inputs$muzzle_angle is not set, automatically solves the zero launch angle at inputs$target_distance before integrating. The rifle is zeroed on its line of sight (muzzle_height + sight_height), as the CLI zeroes, unless inputs$target_height gives another zero height in the same frame.

Value

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.


Single-shot Monte Carlo kernel evaluation (monte_carlo::solve_trajectory_for_monte_carlo)

Description

Single-shot Monte Carlo kernel evaluation (monte_carlo::solve_trajectory_for_monte_carlo)

Usage

solve_trajectory_mc(inputs = ballistic_inputs(), atmosphere = NULL)

Arguments

inputs

BallisticInputs list (SI).

atmosphere

Optional AtmosphericConditions list (SI).

Value

Named list (TrajectoryOutput: drop, wind_drift, time, velocity, energy, mach, spin_drift, distance).


Solve a trajectory using the versioned explicit-SI solve_v1 contract

Description

Solve a trajectory using the versioned explicit-SI solve_v1 contract

Usage

solve_v1(request, return_envelope = FALSE)

Arguments

request

Named R list or JSON string conforming to SolveRequestV1.

return_envelope

Logical; if TRUE, returns the SolveErrorEnvelopeV1 list on failure instead of raising an R error.

Value

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()).


Error function erf(x) from ballistics_engine::special (vectorized)

Description

Error function erf(x) from ballistics_engine::special (vectorized)

Usage

special_erf(x)

Arguments

x

Numeric vector.

Value

Numeric vector.


Complementary error function erfc(x) (vectorized)

Description

Complementary error function erfc(x) (vectorized)

Usage

special_erfc(x)

Arguments

x

Numeric vector.

Value

Numeric vector.


Log-beta function ln B(a, b) (vectorized)

Description

Log-beta function ln B(a, b) (vectorized)

Usage

special_ln_beta(a, b)

Arguments

a

Numeric vector.

b

Numeric vector.

Value

Numeric vector.


Log-gamma function ln Gamma(x) (vectorized)

Description

Log-gamma function ln Gamma(x) (vectorized)

Usage

special_ln_gamma(x)

Arguments

x

Numeric vector.

Value

Numeric vector.


Standard normal CDF Phi(z) (vectorized)

Description

Standard normal CDF Phi(z) (vectorized)

Usage

special_normal_cdf(z)

Arguments

z

Numeric vector.

Value

Numeric vector.


Aerodynamic spin-damping moment (N*m)

Description

Aerodynamic spin-damping moment (N*m)

Usage

spin_damping_moment(
  spin_rate_rad_s,
  velocity_mps,
  air_density_kg_m3,
  caliber_m,
  length_m,
  bullet_type = "match"
)

Arguments

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: "match", "hunting", "fmj" or "cast".

Value

Spin-damping moment (N*m).


Spin-rate retention factor (⁠0..1⁠) over elapsed flight time

Description

Spin-rate retention factor (⁠0..1⁠) over elapsed flight time

Usage

spin_decay_correction_factor(
  time_elapsed_s,
  velocity_mps,
  air_density_kg_m3,
  mass_grains,
  caliber_inches,
  length_inches,
  bullet_type = NULL
)

Arguments

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: "match", "hunting", "fmj" or "cast".

Value

Spin retention factor in ⁠[0, 1]⁠.


Spin decay angular deceleration rate (rad/s^2)

Description

Spin decay angular deceleration rate (rad/s^2)

Usage

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"
)

Arguments

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: "match", "hunting", "fmj" or "cast".

bullet_shape

Shape for the moment of inertia: "cylinder", "ogive" or "boat_tail".

Value

Spin decay rate (rad/s^2).


Spin drift with optional spin-decay factor (meters)

Description

Spin drift with optional spin-decay factor (meters)

Usage

spin_drift(
  time_s,
  stability_sg,
  twist_rate_in,
  is_twist_right = TRUE,
  decay_factor = NULL
)

Arguments

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 (⁠0..1⁠).

Value

Spin drift in meters.


Apply empirical ML correction to spin drift

Description

Apply empirical ML correction to spin drift

Usage

spin_drift_ml_correction(
  base_drift,
  stability,
  mach,
  time_s,
  caliber_inches,
  mass_grains
)

Arguments

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).

Value

Corrected spin drift (m).


Compute bullet spin rate from velocity and barrel twist

Description

Compute bullet spin rate from velocity and barrel twist

Usage

spin_rate(velocity_mps, twist_rate_inches)

Arguments

velocity_mps

Velocity (m/s).

twist_rate_inches

Twist rate (inches per turn).

Value

Named list with rps (rev/s) and rad_s (rad/s).


Miller gyroscopic stability coefficient Sg

Description

Miller gyroscopic stability coefficient Sg

Usage

stability_coefficient(
  inputs = ballistic_inputs(),
  altitude_m = 0,
  temperature_c = 15,
  pressure_hpa = 1013.25,
  density_ratio = 1
)

Arguments

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.

Value

Gyroscopic stability factor Sg.


Formatted gyroscopic stability analysis report (terminal_commands::stability)

Description

Formatted gyroscopic stability analysis report (terminal_commands::stability)

Usage

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")
)

Arguments

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 ("metric" or "imperial").

format

Output format ("table", "json", "csv").

Value

Formatted report string.


Create a validated StationAir handle

Description

Create a validated StationAir handle

Usage

station_air(
  altitude_m = 0,
  temperature_c = 15,
  pressure_hpa = 1013.25,
  humidity_percent = 50,
  density_ratio = NULL
)

Arguments

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 (⁠0..100⁠; sensor band ⁠-5..105⁠).

density_ratio

Optional explicit density ratio override.

Value

An opaque handle of class "StationAirHandle".


Resolve a physical station ⁠(altitude_m, temperature_c, pressure_hpa)⁠ from density altitude

Description

Resolve a physical station ⁠(altitude_m, temperature_c, pressure_hpa)⁠ from density altitude

Usage

station_for_density_altitude(density_altitude_m, explicit_temperature_c = NULL)

Arguments

density_altitude_m

Target density altitude in meters.

explicit_temperature_c

Optional explicit temperature override in Celsius.

Value

Named list with altitude_m, temperature_c, pressure_hpa.


Check plausibility of a station pressure reading at an altitude

Description

Check plausibility of a station pressure reading at an altitude

Usage

station_pressure_plausibility(station_pressure_pa, altitude_m)

Arguments

station_pressure_pa

Station pressure in Pascals.

altitude_m

Station altitude in meters.

Value

Named list with icao_standard_pa, ratio, and implausible.


Compute scope tracking correction factor from a tall-target test

Description

Compute scope tracking correction factor from a tall-target test

Usage

tall_target(request)

Arguments

request

Named list matching TallTargetRequestV1 (dialed, measured, range, unit, metric).

Value

Named list (TallTargetResultV1).


Create a Unicode Braille or ASCII terminal plotting canvas handle

Description

Create a Unicode Braille or ASCII terminal plotting canvas handle

Usage

terminal_canvas(
  width_cells = 60,
  height_cells = 20,
  style = c("braille", "ascii")
)

Arguments

width_cells

Width in terminal character cells.

height_cells

Height in terminal character cells.

style

"braille" or "ascii".

Value

An opaque handle of class "TerminalCanvasHandle".


Compute one-variable tolerance envelopes keeping impact inside a target

Description

Compute one-variable tolerance envelopes keeping impact inside a target

Usage

tolerance_envelope(request, axes, range_m, target, domains = NULL)

Arguments

request

SolveRequestV1 or ResolvedSolveRequestV1.

axes

Character vector of InputAxis names to envelope.

range_m

Target range (m).

target

TargetGeometryV1 list.

domains

Optional named list mapping axis names to c(lower, upper) search bounds.

Value

An object of S3 class "ballistics_tolerance" (ToleranceReportV1).


Check whether a scope tracking correction factor is within the valid physical range

Description

Check whether a scope tracking correction factor is within the valid physical range

Usage

tracking_cf_in_range(value)

Arguments

value

Numeric scalar tracking CF.

Value

Logical scalar.


Apply transonic wave-drag correction to base Cd (vectorized)

Description

Apply transonic wave-drag correction to base Cd (vectorized)

Usage

transonic_correction(
  mach,
  base_cd,
  shape = "boat_tail",
  include_wave_drag = TRUE
)

Arguments

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 base_cd read from a reference G table (e.g. drag_coefficient()) already includes transonic drag, so adding wave drag to it counts it twice.

Value

Numeric vector of corrected drag coefficients.


Transonic wave-drag rise factor vs. Mach (vectorized)

Description

Transonic wave-drag rise factor vs. Mach (vectorized)

Usage

transonic_drag_rise(mach, shape = "boat_tail")

Arguments

mach

Numeric vector of Mach numbers.

shape

Projectile shape ("spitzer", "boat_tail", "flat_base", "round_nose").

Value

Numeric vector of transonic drag rise factors.


Transverse moment of inertia Iy (kg*m^2)

Description

Transverse moment of inertia Iy (kg*m^2)

Usage

transverse_moment_of_inertia(mass_kg, caliber_m, length_m, shape = "boat_tail")

Arguments

mass_kg

Mass (kg).

caliber_m

Caliber (m).

length_m

Length (m).

shape

Bullet shape string.

Value

Transverse moment of inertia (kg*m^2).


Back-solve effective muzzle velocity from a single observed drop (MIL)

Description

Back-solve effective muzzle velocity from a single observed drop (MIL)

Usage

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")
)

Arguments

measured_drop_mil

Observed drop in MIL.

range

Target range (m in metric, yd in imperial).

bc

Ballistic coefficient.

drag_model

"G1" or "G7".

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 ("metric" or "imperial").

Value

Named list (TrueVelocityLocalResult), plus effective_velocity_mps in metric mode.


Back-solve effective crosswind from observed horizontal miss(es)

Description

Back-solve effective crosswind from observed horizontal miss(es)

Usage

true_wind(request, format = NULL, units = c("metric", "imperial"))

Arguments

request

Named list matching WindTruingRequest.

format

Optional output format (NULL for list, or "table", "json", "csv").

units

Unit system for formatted output ("metric" or "imperial").

Value

Named list (WindTruingReport) or formatted string.


Bayesian MAP uncertainty-aware joint MV/BC truing with covariance and predictive bands

Description

Bayesian MAP uncertainty-aware joint MV/BC truing with covariance and predictive bands

Usage

uncertainty_truing(request)

Arguments

request

Named list matching UncertaintyTruingRequestV1.

Value

Named list (UncertaintyTruingReportV1).


Convert quantities between the CLI's input units and the engine's internal units

Description

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.

Usage

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")
)

Arguments

value

Numeric vector of values to convert.

quantity

One of "velocity", "mass", "distance", "diameter", "sight_height", "wind", "temperature", "temperature_delta", "pressure", "altitude".

direction

Either "to_metric" (from the units column into the internal units) or "from_metric" (back).

units

Unit system ("imperial" or "metric").

Details

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

Value

Converted numeric vector.


Update projectile spin rate after elapsed flight time

Description

Update projectile spin rate after elapsed flight time

Usage

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
)

Arguments

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: "match", "hunting", "fmj" or "cast".

Value

Updated spin rate (rad/s).


Validate an OpticProfile configuration

Description

Validate an OpticProfile configuration

Usage

validate_optic(optic)

Arguments

optic

Named list matching OpticProfile.

Value

TRUE if valid; raises an error otherwise.


Validate a saved ballistic profile (ProfileData)

Description

Validate a saved ballistic profile (ProfileData)

Usage

validate_profile(profile)

Arguments

profile

Named list matching ProfileData (or JSON string).

Value

Named list with valid, warnings, air_refusal, flown_humidity, and flown_humidity_note.


Validate a relative humidity reading (with sensor-band tolerance)

Description

Validate a relative humidity reading (with sensor-band tolerance)

Usage

validate_relative_humidity(value, is_fraction = FALSE)

Arguments

value

Humidity value (⁠0..100⁠ percent, or ⁠0..1⁠ fraction if is_fraction = TRUE).

is_fraction

Logical; TRUE for ⁠0..1⁠ fraction wire unit.

Value

Named list with flown percent and fraction.


Validate a ReticleDescription

Description

Validate a ReticleDescription

Usage

validate_reticle(reticle)

Arguments

reticle

Named list (ReticleDescription).

Value

TRUE if valid; raises an error otherwise.


Validate a table/list of wind segments

Description

Validate a table/list of wind segments

Usage

validate_wind_segments(segments)

Arguments

segments

A data.frame or list of wind segments.

Value

TRUE if valid; raises an error otherwise.


Create a streaming Welford mean/variance accumulator handle

Description

Create a streaming Welford mean/variance accumulator handle

Usage

welford()

Value

An opaque handle of class "WelfordHandle".


Fixed-sample Wilson score confidence interval for a binomial proportion

Description

Fixed-sample Wilson score confidence interval for a binomial proportion

Usage

wilson_interval(successes, trials, level = c("p95", "p90", "p99"))

Arguments

successes

Number of hits/successes.

trials

Total number of trials.

level

Confidence level ("p90", "p95", "p99").

Value

Length-2 numeric vector c(lower, upper).


Compute the 3D wind vector at a 3D projectile position with optional wind shear

Description

Compute the 3D wind vector at a 3D projectile position with optional wind shear

Usage

wind_at_position(
  position,
  wind_segments,
  enable_wind_shear = FALSE,
  wind_shear_model = "logarithmic",
  shooter_altitude_m = 0
)

Arguments

position

Length-3 numeric vector c(x, y, z) (m).

wind_segments

Wind segments data.frame/list.

enable_wind_shear

Logical; apply boundary-layer wind shear.

wind_shear_model

Model name: "logarithmic" (or "log"), "power_law" (or "power"), "ekman_spiral", "custom_layers" or "none", any case. Any other name is an error (the engine itself would fly it as no shear).

shooter_altitude_m

Site altitude (m).

Value

Length-3 numeric wind vector (m/s).


Generate a multi-speed wind drift card (card_service::wind_card_v1)

Description

Generate a multi-speed wind drift card (card_service::wind_card_v1)

Usage

wind_card(request)

Arguments

request

Named list matching CardRequestV1 (including wind_speeds).

Value

An object of S3 class "ballistics_card" (CardResponseV1).


Construct a WindConditions configuration list

Description

Construct a WindConditions configuration list

Usage

wind_conditions(speed = 0, direction = 0, vertical_speed = 0)

Arguments

speed

Wind speed (m/s in metric, mph in imperial).

direction

Wind-FROM direction in radians (0 = headwind, pi/2 = from right).

vertical_speed

Vertical wind component (m/s in metric, mph in imperial; positive = updraft).

Value

Named list of wind conditions.


Create a 3D WindField handle (constant, profile, log, or ekman)

Description

Create a 3D WindField handle (constant, profile, log, or ekman)

Usage

wind_field(
  type = c("constant", "profile", "log", "ekman"),
  ...,
  height_offset_m = NULL
)

Arguments

type

One of "constant", "profile", "log", "ekman".

...

Parameters for the selected wind field:

  • "constant": wx, wy, wz (m/s).

  • "profile": levels (data.frame with altitude_m, speed_mps, direction_from_deg).

  • "log": reference_speed_mps, reference_height_m, roughness_m, direction_from_deg.

  • "ekman": geostrophic_mps, latitude_deg, eddy_viscosity_m2s, direction_from_deg.

height_offset_m

Optional vertical height offset (m) wrapped via HeightOffset.

Value

An opaque handle of class "WindFieldHandle".


Evaluate a WindShearProfile across altitudes

Description

Evaluate a WindShearProfile across altitudes

Usage

wind_shear_at_altitude(profile, altitudes_m)

Arguments

profile

Named list describing WindShearProfile (model, surface_wind, reference_height, roughness_length, power_exponent, geostrophic_wind, custom_layers).

altitudes_m

Numeric vector of altitudes (m).

Value

A data.frame with columns ⁠altitude_m, wx, wy, wz⁠.


Evaluate WindShearWindSock at a 3D position

Description

Evaluate WindShearWindSock at a 3D position

Usage

wind_shear_sock_vector(
  segments_mps,
  shear_profile = NULL,
  shooter_altitude_m = 0,
  position = c(0, 0, 0)
)

Arguments

segments_mps

data.frame(speed_mps, angle_deg, until_m).

shear_profile

Optional WindShearProfile list.

shooter_altitude_m

Site altitude (m).

position

Length-3 position vector c(x, y, z) (m).

Value

Length-3 numeric wind vector (m/s).


Create a downrange segmented WindSock handle

Description

Create a downrange segmented WindSock handle

Usage

wind_sock(segments)

Arguments

segments

A data.frame or list of wind segments (speed_kmh, angle_deg, until_m, optional vertical_mps).

Value

An opaque handle of class "WindSockHandle".


Convert wind speed, direction (radians), and vertical speed to a 3D wind vector

Description

Convert wind speed, direction (radians), and vertical speed to a 3D wind vector

Usage

wind_vector(speed_mps, direction_rad, vertical_mps = 0)

Arguments

speed_mps

Horizontal wind speed (m/s).

direction_rad

Wind-FROM direction in radians (0 = headwind, pi/2 = from right).

vertical_mps

Vertical wind component (m/s; positive = updraft).

Value

Length-3 numeric vector c(wx, wy, wz) (m/s).


Equilibrium yaw of repose and convergence rate

Description

Equilibrium yaw of repose and convergence rate

Usage

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
)

Arguments

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: "match" (default), "hunting", "fmj" or "vld". Any other name is an error.

use_pitch_damping

Logical.

Value

Named list with yaw_rad and convergence_rate.


Compute zero-banner dial readouts ⁠(moa, mil)⁠ adjusted by elevation CF

Description

Compute zero-banner dial readouts ⁠(moa, mil)⁠ adjusted by elevation CF

Usage

zero_banner_dial_values(
  angle_deg,
  angle_rad = angle_deg * pi/180,
  elevation_cf = 1
)

Arguments

angle_deg

Zero angle in degrees.

angle_rad

Zero angle in radians.

elevation_cf

Elevation tracking correction factor.

Value

Named list with moa and mil.