Skip to main content

ballistics_engine/
lib.rs

1//! # Ballistics Engine
2//!
3//! High-performance ballistics trajectory calculation engine with comprehensive physics modeling.
4//!
5//! ## Interactive Web Demo
6//!
7//! Try the ballistics engine directly in your browser at [https://ballistics.rs/](https://ballistics.rs/)
8//!
9//! ## Features
10//!
11//! - Professional-grade trajectory calculations with multiple drag models
12//! - Advanced physics including spin drift, Coriolis effect, and Magnus force
13//! - Monte Carlo simulations for uncertainty analysis
14//! - WebAssembly support for browser-based applications
15//! - FFI bindings for iOS and Android development
16
17// Re-export the main types and functions
18pub use cli_api::{
19    calculate_zero_angle, calculate_zero_angle_with_conditions, estimate_bc_fit,
20    estimate_bc_from_trajectory, run_monte_carlo, run_monte_carlo_with_wind, AtmosphericConditions,
21    BallisticInputs, BallisticsError, BcEstimate, BcFitMode, MonteCarloParams, MonteCarloResults,
22    TrajectoryPoint, TrajectoryResult, TrajectorySolver, WindConditions, DEFAULT_HIT_RADIUS_M,
23};
24pub use atmosphere::{AtmoSegment, AtmoSock};
25pub use drag_model::DragModel;
26
27// Module declarations
28pub mod cli_api;
29mod drag_model;
30pub mod ffi;
31#[cfg(target_arch = "wasm32")]
32pub mod wasm;
33#[cfg(test)]
34mod wasm_tests;
35// MBA-154: Make constants public for ballistics_rust wrapping
36pub mod atmosphere;
37pub mod constants;
38pub mod drag;
39mod drag_tables;
40pub mod wind;
41// MBA-153: Make wind_shear public for ballistics_rust wrapping
42pub mod wind_shear;
43// MBA-154: Make derivatives public for ballistics_rust wrapping
44pub mod derivatives;
45pub mod trajectory_sampling;
46// MBA-154: Make fast_trajectory public for ballistics_rust wrapping
47pub mod fast_trajectory;
48// MBA-155: Add advanced integration methods (RK4, RK45)
49pub mod trajectory_integration;
50// MBA-149 Phase 5 Priority 2: Export enhanced spin_drift
51pub mod pitch_damping;
52pub mod spin_decay;
53pub mod spin_drift;
54pub mod spin_drift_advanced;
55// MBA-149 Phase 5 Priority 2: Export enhanced precession_nutation
56pub mod precession_nutation;
57// MBA-153: Make aerodynamic_jump public for ballistics_rust wrapping
58pub mod aerodynamic_jump;
59// MBA-149 Phase 5 Priority 2: Export enhanced angle_calculations
60pub mod angle_calculations;
61pub mod transonic_drag;
62// MBA-153: Make reynolds public for ballistics_rust wrapping
63pub mod reynolds;
64// MBA-149 Phase 5 Priority 2: Export enhanced form_factor
65pub mod form_factor;
66// MBA-153: Make monte_carlo public for ballistics_rust wrapping
67pub mod bc_estimation;
68pub mod cluster_bc;
69pub mod monte_carlo;
70pub mod stability;
71pub mod stability_advanced;
72
73// Online mode: HTTP client for Flask API (feature-gated)
74#[cfg(feature = "online")]
75pub mod api_client;
76
77// BC5D table auto-download (feature-gated)
78#[cfg(feature = "online")]
79pub mod bc_table_download;
80
81// BC correction table for offline mode
82pub mod bc_table;
83
84// 5D BC correction tables (caliber-specific, ML-derived)
85pub mod bc_table_5d;
86
87// Internal type alias for compatibility
88pub(crate) type InternalBallisticInputs = BallisticInputs;
89
90// BC segment data for velocity-dependent BC
91#[derive(Debug, Clone)]
92pub struct BCSegmentData {
93    pub velocity_min: f64,
94    pub velocity_max: f64,
95    pub bc_value: f64,
96}