🎯 Ballistics Engine :: Tools

High-performance trajectory calculations with professional physics

🐍 Python 💎 Ruby 📦 JavaScript/TypeScript ⚡ Rust-powered
Professional-grade ballistics calculations now available as easy-to-use libraries.
Choose your language and start calculating trajectories in minutes.

🐍 Python

Installation

Terminal
pip install ballistics-engine

Quick Start

Python
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:

Install on BSD
# 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 (if not already 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

Terminal
gem install ballistics-engine

Quick Start

Ruby
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

Terminal
npm install ballistics-engine

Quick Start (Object-Oriented API)

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

JavaScript
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

📚 Recommended Reading

As an Amazon Associate, we earn from qualifying purchases.