lob 0.11.0
Exterior ballistics library — API + technical reference
Loading...
Searching...
No Matches
Getting Started

Getting Started

lob requires C++14 and floating-point support.

Building

lob is CMake FetchContent-friendly with no dependencies.

cmake -B build -DLOB_DEVELOPER_MODE=ON
cmake --build build
ctest --test-dir build

For documentation (requires developer mode for the docs target):

cmake -B build -DLOB_DEVELOPER_MODE=ON -DBUILD_DOCS=ON
cmake --build build --target docs
# html in build/docs/html/index.html

See BUILDING.md for install/packaging options.

Minimal forward solve

At the heart of lob is the builder → context → solve pipeline (Builder, Design Decisions).

#include "lob.hpp"
.Build();
std::array<uint32_t, 3> ranges{300, 600, 900}; // feet, strictly increasing
std::array<lob::Output, 3> outs{};
const size_t n = lob::Solve(ctx, ranges, &outs);
for (size_t i = 0; i < n; ++i)
// outs[i].elevation is inches of drop at outs[i].range (feet)
;
Builder class for constructing Context objects with a friendly interface.
Definition lob.hpp:202
Context Build()
Builds the Context object with the configured parameters.
Definition lob.hpp:759
Builder & InitialVelocityFps(uint16_t value)
Sets the initial velocity of the projectile in feet per second.
Definition lob.hpp:488
Builder & BallisticCoefficientPsi(double value)
Sets the ballistic coefficient (Psi).
Definition lob.hpp:240
Builder & ZeroDistanceYds(double value)
Sets the zero distance in yards.
Definition lob.hpp:532
size_t Solve(const Context &ctx, const uint32_t *pranges, Output *pouts, size_t size)
Solves the exterior ballistics problem for a given set of ranges. Results contain a forward-solution.
Definition lob.hpp:781
Structure of parameters consumed by the solver.
Definition lob.hpp:108

Builder validates and returns an error in Context::error if required inputs are missing (BC, velocity, zero). Check ctx.error == lob::ErrorT::kNone before solving.

Richer example

The same builders scale: add atmosphere, wind, Coriolis, twist and geometry as needed — see README.md for a copy-pasteable richer builder (G7, 155 gr, Milwaukee example). Any subset may be supplied; lob fills the rest with defaults or derives higher-fidelity corrections when geometry is complete (Spin Drift and Aerodynamic Jump). Missing data degrades fidelity rather than failing.

Inverse solve

// Forward: inches of drop
lob::Solve(ctx, ranges, &outs);
// Fast one-step conversion of an existing forward result:
lob::FastInverse(ctx, &outs); // elevation/deflection become MOA
// Full iterative solve for MOA adjustments:
lob::SolveInverse(ctx, ranges, &outs); // elevation/deflection are MOA
size_t FastInverse(const Context &ctx, Output *pouts, size_t size)
Converts forward-solution output to inverse-solution adjustments.
Definition lob.hpp:831
size_t SolveInverse(const Context &ctx, const uint32_t *pranges, Output *pouts, size_t size)
Solves the exterior ballistics problem for a given set of ranges. Results contain an inverse-solution...
Definition lob.hpp:881

See Inverse Solve for the difference between the two and when to prefer each.

Units

lob stores everything internally in feet, seconds, pounds and radians. The public API accepts customary units (inches, yards, fps, grains, inHg, degrees F, MOA/MIL/degrees/Iphy) and the headers expose free conversion helpers (LobMoaToMil, lob::MoaToMil, etc.). See Units and Design Decisions.

From here, the natural reading order is: Builder for the construction pipeline, ODE Integration for the integration method, and Validation for how correctness is established.