lob 0.11.0
Exterior ballistics library — API + technical reference
Loading...
Searching...
No Matches
BC Bands Worked Example

BC Bands Worked Example

This page complements BC/Velocity-Band Transformation with a visual and a copy-pasteable trajectory. All data are from the test suite so the numbers are checkable.

Resulting drag curve

G1 reference vs BC-band transformed drag curve

*Figure — same as in BC/Velocity-Band Transformation — G1 reference (blue) and the curve transformed with bands 0.20@2000, 0.30@2500, 0.40@3000 fps (red) at ISA c=1116 fps (band Machs ≈1.79, 2.24, 2.69, marked). Dashed gray is G1/0.30. Static docs/figures/bc_transformation.svg from source/tables.hpp via the same PCHIP as the library.*

How to read it:

  • Low BC (0.20) → high drag (/0.20 = 5×); high BC (0.40) → lower drag (/0.40 = 2.5×).
  • Between marks the curve is smooth PCHIP, not kinked.
  • Outside marks scaling is flat — parallels the reference shifted by the edge BC. See BC/Velocity-Band Transformation for the math and flat-padding rationale.

Worked example — bands to trajectory

#include <array>
#include <cassert>
#include <cstdint>
#include "lob/lob.hpp"
const float fps[] = {2000.f, 2500.f, 3000.f};
const float bcs[] = {0.20f, 0.30f, 0.40f};
.BCDragFunction(lob::DragFunctionT::kG1) // or G7 for the usual use
.DiameterInch(0.308)
.MassGrains(168.0)
.BCVelocityBands(fps, bcs, 3) // last call wins
.Build();
assert(ctx.error == lob::ErrorT::kNone);
// Inspect the scaled drag (optional):
lob::spline::CurveView curve(lob::spline::kKnots, ctx.drags);
// curve.Eval(1500.f/ctx.speed_of_sound) ≈ Cd_std/0.20 (below bands)
// curve.Eval(2250.f/ctx.speed_of_sound) between /0.20 and /0.30
// Trajectory:
std::array<uint32_t,4> ranges{300, 600, 900, 1200}; // feet
std::array<lob::Output,4> outs{};
lob::Solve(ctx, ranges, &outs); // forward (inches)
lob::SolveInverse(ctx, ranges, &outs); // or MOA adjustments directly
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 & MassGrains(double value)
Sets the projectile mass in grains.
Definition lob.hpp:478
Builder & InitialVelocityFps(uint16_t value)
Sets the initial velocity of the projectile in feet per second.
Definition lob.hpp:488
Builder & DiameterInch(double value)
Sets the projectile diameter (caliber) in inches.
Definition lob.hpp:300
Builder & BCAtmosphere(AtmosphereReferenceT type)
Sets the atmosphere reference associated with ballistic coefficient.
Definition lob.hpp:250
Builder & BCVelocityBands(const float *pfps, const float *pbcvs, size_t size)
Loads ballistic coefficients measured at multiple velocities.
Definition lob.hpp:435
Builder & ZeroDistanceYds(double value)
Sets the zero distance in yards.
Definition lob.hpp:532
Builder & BCDragFunction(DragFunctionT type)
Sets the drag function associated with ballistic coefficient.
Definition lob.hpp:275
@ kIcao
International Civil Aviation Organization (ICAO)
Definition lob.hpp:35
@ kNone
Definition lob.hpp:61
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
@ kG1
G1 drag function.
Definition lob.hpp:22
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
Structure of parameters consumed by the solver.
Definition lob.hpp:108
std::array< float, kLobCoeffsSize > drags
Drag curve coefficients.
Definition lob.hpp:122
ErrorT error
Error status after build.
Definition lob.hpp:126

For comparison, a constant BC=0.30 is Builder().BallisticCoefficientPsi(0.30) and yields a proportionally scaled curve — the bands case uses more drag low and less drag high, so the trajectory drops less at short range and more at long range than the BC=0.30 baseline.

The three regimes are locked by test/source/lob_builder_test.cpp (BCVelocityBandsNonConstantClampingAndInterpolation): below the slowest band clamped to first BC, between bands strictly between the bracketing scalings and matching the retardation product to 2e-3, above the fastest band clamped to last BC.

Limitations in this example

Same limits as the transformation itself — see BC/Velocity-Band Transformation for the full list (N bounds, monotonicity, Mach <5, last-setter wins, flat extrapolation). The point of the figure is that you can see the flat extrapolation outside the marks.