ballistics_rs is a Rust crate designed for external ballistics calculations. It provides utilities and equations to help developers create ballistics solver programs. This crate includes functions to calculate the speed of sound, kinetic energy, gyroscopic stability, and ballistic coefficient of projectiles.
Getting Started
To use ballistics_rs in your project, add the following to your Cargo.toml:
[]
= "0.1.3"
Usage
Speed of Sound
Calculate the speed of sound in air given the temperature:
use ;
let speed = calculate
.temperature
.call;
println!;
Kinetic Energy
Calculate the kinetic energy of a bullet:
use ;
let energy = calculate
.bullet_weight
.velocity
.call;
println!;
Aperture Sight Calibration
Determine the movement of your point of aim for each click of an aperture:
use ApertureSightCalibration;
let calibration = calculate
.sight_movement_twenty_clicks
.sight_radius
.call;
println!;
Form Factor
Calculate the form factor of a bullet:
use FormFactor;
let form_factor = calculate
.drag_coefficient
.standard_bullet_drag_coefficient
.call;
println!;
Velocity Projection
Project the velocity of a second bullet based on the weight and velocity of a first bullet:
use ;
let projected_velocity = calculate
.bullet_weight_1
.bullet_weight_2
.bullet_velocity_1
.call;
println!;
Lag Time
Calculate the lag time of a bullet:
use ;
let lag_time = calculate
.actual_time_of_flight
.distance
.muzzle_velocity
.call;
println!;
Wind Deflection
Calculate the wind deflection of a bullet:
use ;
let wind_deflection = calculate
.lag_time
.crosswind_speed
.call;
println!;
Aerodynamic Jump
Calculate the aerodynamic jump of a bullet:
use ;
let jump = calculate
.gyro_stability
.bullet_length
.call;
println!;
Gyroscopic Stability
Calculate the gyroscopic stability factor of a bullet:
use ;
let stability = calculate
.bullet_mass
.rifling_twist
.bullet_diameter
.bullet_length
.call;
let velocity_corrected = velocity_correction
.muzzle_velocity
.gyro_stability
.call;
let atmospheric_corrected = atmospheric_correction
.air_temp
.air_pressure
.gyro_stability
.call;
println!;
Ballistic Coefficient
Calculate the ballistic coefficient of a bullet:
use ;
let bc = calculate
.bullet_mass
.bullet_diameter
.form_factor
.call;
println!;
Constants
The crate also provides several constants for use in calculations:
STANDARD_GRAVITY: Standard gravitational constant (32.174 ft/s²).
use STANDARD_GRAVITY;
println!;
SPEED_OF_SOUND_SEA_LEVEL: Speed of sound at sea level (1116.28 ft/s).
use SPEED_OF_SOUND_SEA_LEVEL;
println!;
AIR_DENSITY_SEA_LEVEL: Air density at sea level (0.0765 lb/ft³).
use AIR_DENSITY_SEA_LEVEL;
println!;
STANDARD_PRESSURE: ICAO standard air pressure (29.92 inHg).
use STANDARD_PRESSURE;
println!;
STANDARD_TEMPERATURE: ICAO standard temperature (59.0 F).
use STANDARD_TEMPERATURE;
println!;