|
lob 0.11.0
Exterior ballistics library — API + technical reference
|
lob integrates the classic 3-DOF point-mass equations (McCoy, Modern Exterior Ballistics, Ch. 3, 10). The state is s = (p, v, TOF) with p ∈ FeetT³, v ∈ FpsT³ (source/ode.hpp, source/cartesian.hpp).
Down-range x is the independent variable. Let w be the wind vector, c the Coriolis vector, g gravity, ρ air density, Cd(M) the Mach- dependent drag coefficient and
Then in the time domain
Dividing by vx gives the down-range form actually integrated (source/solve_step.cpp):
DsDx returns (dp/dx, dv/dx). When vx ≤ 0 the derivative is zeroed (source/solve_step.cpp DsDx) and the step clamps vx to zero — the projectile is falling straight down (source/solve_step.cpp SolveStep).
drag_coeff is ρ·π / 8 (density term) for all paths; for the single-BC path the BC is divided into the spline coefficients drags[60] = coefs/(BC·conversion) (source/calc.hpp, source/lob_builder.cpp). For custom tables and BC bands the spline already embeds 1/BC and drag_coeff remains ρ·π / 8 at BC=1. Per step, FastDsDx uses firing-site drag_coeff/c, while DsDx scales them by ρ/ρ0/c/c0 via k_lapse as described in Atmospheric Model (source/solve_step.cpp).
Coriolis is expanded as
with the three scalars precomputed in BuildCoriolis (source/lob_builder.cpp). Gravity is rotated by the range (inclination) angle: gx = −g sin(rangeAngle), gy = −g cos(rangeAngle) (source/lob_builder.cpp).
The integrator is Heun's method (RK2 predictor-corrector, source/ode.hpp): y_{n+1}= y_n + (k1+k2)/2 · Δx with k1=f(x_n,y_n), k2=f(x_n+Δx, y_n+k1·Δx). Δx is one yard by default (36 in) or ctx.step_size inches if non-zero, clamped to not over-shoot the requested target x (source/solve_step.cpp ComputeStep). TOF is integrated as the third component of f via d(TOF)/dx = 1/vx in DsDxCore (source/solve_step.cpp), not by a separate trapezoidal post-step.
This is the same step used by both forward and inverse solves and by the zero-angle seed search, with FastSolveStep/FastDsDx (firing-site density) for forward/zero/Boatright and SolveStep/DsDx (lapse-scaled) for drop>100ft inverse ranges. See ODE Integration for accuracy notes.
deflection and as aerodynamic_jump added to the launch angle.Fast* firing-site for forward and drop≤100ft inverse, and per-step k_lapse lapse for drop>100ft inverse.