Choose your language and start calculating trajectories in minutes.
🐍 Python
Installation
pip install ballistics-engine
Quick Start
from ballistics_engine import BallisticsCalculator
# Create calculator with bullet parameters
calc = BallisticsCalculator(
velocity_fps=2800, # Muzzle velocity
bc=0.295, # Ballistic coefficient
diameter_inches=0.308, # Bullet diameter
mass_grains=168, # Bullet mass
drag_model="G7", # Drag model
zero_range_yards=100 # Zero range
)
# Calculate trajectory
trajectory = calc.calculate_trajectory(max_range_yards=1000)
# Print results
for point in trajectory:
print(f"Range: {point['range_yards']}yd | "
f"Drop: {point['drop_inches']:.2f}in | "
f"Velocity: {point['velocity_fps']:.0f}fps")
✨ Features
- Multiple drag models (G1, G7, custom)
- Wind drift calculations
- Coriolis effect support
- Spin drift modeling
🚀 Performance
- Rust-powered core (15-20x faster)
- NumPy integration
- Vectorized operations
- Multi-platform wheels
🎓 Documentation
- Full type hints
- Comprehensive examples
- API reference
- Physics documentation
🐡 BSD Support
FreeBSD, OpenBSD & NetBSD
PyPI doesn't accept BSD platform tags, but we build native wheels for BSD systems. Download directly:
-
FreeBSD 14.2 x86_64 (Python 3.11) - 319KB
SHA256: 4819092bbffe05558c9988b72ce79c79016dd3ae955805fa7ad05ef924dcd97a -
OpenBSD 7.8 x86_64 (Python 3.12) - 324KB
SHA256: 6a36a9b79037995c2a133e4de0363fa7e4d1f13801a9bbb722850e787f3cb7c9 -
NetBSD 10.1 x86_64 (Python 3.11) - 325KB
SHA256: d0ce0bd9aebb6fee4dfd7a6c485a42a261f422b4705988cf0fe8a5dea8e4f337
# Download the appropriate wheel for your BSD system
# Verify the SHA256 hash (recommended):
shasum -a 256 ballistics_engine-0.13.3-*.whl
# Then install with pip:
pip install ballistics_engine-0.13.3-*.whl
💎 Ruby
⚠️ Prerequisites Required
This gem contains a native Rust extension that must be compiled during installation. You need Rust and Cargo installed:
# Install Rust using rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Or via package manager:
# macOS: brew install rust
# Linux: apt install cargo rustc (Debian/Ubuntu)
# dnf install cargo rust (Fedora/RHEL)
Note: The gem is distributed as source code and compiles the native extension during installation. Rust/Cargo is required for all installations.
Installation
gem install ballistics-engine
Quick Start
require 'ballistics_engine'
# Create calculator with bullet parameters
calc = BallisticsEngine::Calculator.new(
velocity_fps: 2800, # Muzzle velocity
bc: 0.295, # Ballistic coefficient
diameter_inches: 0.308, # Bullet diameter
mass_grains: 168, # Bullet mass
drag_model: "G7", # Drag model
zero_range_yards: 100 # Zero range
)
# Calculate trajectory
trajectory = calc.calculate_trajectory(max_range_yards: 1000)
# Print results
trajectory.each do |point|
puts "Range: #{point[:range_yards]}yd | " \
"Drop: #{point[:drop_inches].round(2)}in | " \
"Velocity: #{point[:velocity_fps].round}fps"
end
💎 Ruby-Friendly
- Idiomatic Ruby API
- Hash-based returns
- Keyword arguments
- Symbol keys
⚡ Native Performance
- Rust extension via Magnus
- Zero-copy data transfer
- Native Ruby objects
- Fast calculations
🔧 Easy Integration
- Rails compatible
- Works with bundler
- No external dependencies
- Pre-compiled gems
📦 JavaScript/TypeScript
Installation
npm install ballistics-engine
Quick Start (Object-Oriented API)
import { Calculator } from 'ballistics-engine';
// Create calculator with fluent API
const calc = new Calculator()
.setVelocity(2800) // Muzzle velocity (fps)
.setBC(0.295) // Ballistic coefficient
.setDiameter(0.308) // Bullet diameter (inches)
.setMass(168) // Bullet mass (grains)
.setDragModel("G7") // Drag model
.setZeroRange(100) // Zero range (yards)
.setMaxRange(1000); // Max range (yards)
// Calculate full trajectory
const trajectory = calc.getFullTrajectory();
// Print results
trajectory.forEach(point => {
console.log(
`Range: ${point.range_yards}yd | ` +
`Drop: ${point.drop_inches.toFixed(2)}in | ` +
`Velocity: ${point.velocity_fps.toFixed(0)}fps`
);
});
// Calculate single point
const point = calc.calculateTrajectory(500);
console.log(`500yd drop: ${point.drop_inches.toFixed(2)}in`);
JavaScript (Node.js or Browser)
const { Calculator } = require('ballistics-engine');
const calc = new Calculator()
.setVelocity(2800)
.setBC(0.295)
.setDiameter(0.308)
.setDragModel("G7")
.setZeroRange(100);
const trajectory = calc.getFullTrajectory();
console.log(trajectory);
🎯 TypeScript First
- Full type definitions included
- IntelliSense support
- Compile-time safety
- Auto-completion
🌐 Universal
- Works in Node.js
- Works in browsers
- WebAssembly powered
- Zero dependencies
⚡ Fast & Small
- WebAssembly performance
- ~300KB WASM bundle
- Tree-shakeable
- Modern ES modules