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_direction_std_dev,
21 run_monte_carlo_with_wind, run_monte_carlo_with_wind_and_direction_std_dev,
22 AtmosphericConditions, BallisticInputs, BallisticsError, BcEstimate, BcFitMode,
23 MonteCarloParams, MonteCarloResults, TrajectoryPoint, TrajectoryResult, TrajectorySolver,
24 WindConditions, DEFAULT_HIT_RADIUS_M, MAX_TRAJECTORY_POINTS, TARGET_NOT_REACHED_SENTINEL_M,
25};
26pub use atmosphere::{AtmoSegment, AtmoSock};
27pub use drag_model::DragModel;
28pub use moving_target::{calculate_lead, lead_from_tof, LeadComponents, LeadError, LeadSolution};
29
30// Module declarations
31pub mod cli_api;
32pub mod moving_target;
33mod drag_model;
34pub mod ffi;
35#[cfg(target_arch = "wasm32")]
36pub mod wasm;
37#[cfg(test)]
38mod wasm_tests;
39// MBA-154: Make constants public for ballistics_rust wrapping
40pub mod atmosphere;
41pub mod constants;
42pub mod drag;
43mod drag_tables;
44pub mod wind;
45// MBA-153: Make wind_shear public for ballistics_rust wrapping
46pub mod wind_shear;
47// MBA-154: Make derivatives public for ballistics_rust wrapping
48pub mod derivatives;
49pub mod trajectory_sampling;
50// MBA-154: Make fast_trajectory public for ballistics_rust wrapping
51pub mod fast_trajectory;
52// MBA-155: Add advanced integration methods (RK4, RK45)
53pub mod trajectory_integration;
54// MBA-149 Phase 5 Priority 2: Export enhanced spin_drift
55pub mod pitch_damping;
56pub mod spin_decay;
57pub mod spin_drift;
58pub mod spin_drift_advanced;
59// MBA-149 Phase 5 Priority 2: Export enhanced precession_nutation
60pub mod precession_nutation;
61// MBA-153: Make aerodynamic_jump public for ballistics_rust wrapping
62pub mod aerodynamic_jump;
63// MBA-149 Phase 5 Priority 2: Export enhanced angle_calculations
64pub mod angle_calculations;
65pub mod transonic_drag;
66// MBA-153: Make reynolds public for ballistics_rust wrapping
67pub mod reynolds;
68// MBA-149 Phase 5 Priority 2: Export enhanced form_factor
69pub mod form_factor;
70// MBA-153: Make monte_carlo public for ballistics_rust wrapping
71pub mod bc_estimation;
72pub mod cluster_bc;
73pub mod monte_carlo;
74pub mod stability;
75pub mod stability_advanced;
76
77// Online mode: HTTP client for Flask API (feature-gated)
78#[cfg(feature = "online")]
79pub mod api_client;
80
81// BC5D table auto-download (feature-gated)
82#[cfg(feature = "online")]
83pub mod bc_table_download;
84
85// BC correction table for offline mode
86pub mod bc_table;
87
88// 5D BC correction tables (caliber-specific, ML-derived)
89pub mod bc_table_5d;
90
91// Internal type alias for compatibility
92pub(crate) type InternalBallisticInputs = BallisticInputs;
93
94// BC segment data for velocity-dependent BC
95#[derive(Debug, Clone)]
96pub struct BCSegmentData {
97 pub velocity_min: f64,
98 pub velocity_max: f64,
99 pub bc_value: f64,
100}