lob 0.11.0
Exterior ballistics library — API + technical reference
Loading...
Searching...
No Matches
lob.h File Reference
#include <stddef.h>
#include <stdint.h>
#include "lob/lob_export.hpp"

Go to the source code of this file.

Classes

struct  LobGravity
 Gravity vector. More...
 
struct  LobWind
 Wind vector. More...
 
struct  LobCoriolis
 Coriolis effect parameters. More...
 
struct  LobContext
 Structure of parameters consumed by the solver. More...
 
struct  LobOutput
 Structure holding the output results of a ballistic calculation. More...
 
struct  LobBuilder
 Opaque builder type for constructing LobContext objects. More...
 

Macros

#define LOB_SPLINE_SEGMENTS   15
 The number of spline pieces comprising a drag function.
 
#define LOB_BUILDER_BUFFER_SIZE   272
 The size in bytes of the builder buffer.
 

Typedefs

typedef uint8_t LobDragFunctionT
 Drag function type.
 
typedef uint8_t LobAtmosphereReferenceT
 Atmosphere reference type.
 
typedef uint8_t LobClockAngleT
 Clock angle positions for wind direction.
 
typedef uint8_t LobErrorT
 Error codes returned by the builder.
 

Enumerations

enum  {
  kLobDragFunctionG1 = 1 , kLobDragFunctionG2 = 2 , kLobDragFunctionG5 = 5 , kLobDragFunctionG6 = 6 ,
  kLobDragFunctionG7 = 7 , kLobDragFunctionG8 = 8
}
 
enum  { kLobAtmosphereReferenceArmyStandardMetro = 0 , kLobAtmosphereReferenceIcao }
 
enum  {
  kLobClockAngleI = 1 , kLobClockAngleII = 2 , kLobClockAngleIII = 3 , kLobClockAngleIV = 4 ,
  kLobClockAngleV = 5 , kLobClockAngleVI = 6 , kLobClockAngleVII = 7 , kLobClockAngleVIII = 8 ,
  kLobClockAngleIX = 9 , kLobClockAngleX = 10 , kLobClockAngleXI = 11 , kLobClockAngleXII = 12
}
 
enum  {
  kLobErrorNone = 0 , kLobErrorAirPressureOOR , kLobErrorAltitudeOfBarometerOOR , kLobErrorAltitudeOfFiringSiteOOR ,
  kLobErrorAltitudeOfThermometerOOR , kLobErrorAzimuthOOR , kLobErrorBallisticCoefficientOOR , kLobErrorBallisticCoefficientRequired ,
  kLobErrorBaseDiameterOOR , kLobErrorBcBandsInvalid , kLobErrorBcBandsNotMonotonic , kLobErrorBcBandsTooShort ,
  kLobErrorDiameterOOR , kLobErrorHumidityOOR , kLobErrorInitialVelocityRequired , kLobErrorInternalError ,
  kLobErrorLatitudeOOR , kLobErrorLengthOOR , kLobErrorMachDragTableInvalid , kLobErrorMachDragTableNotMonotonic ,
  kLobErrorMachDragTableTooShort , kLobErrorMassOOR , kLobErrorMaximumTimeOOR , kLobErrorMeplatDiameterOOR ,
  kLobErrorNoseLengthOOR , kLobErrorNotFormed , kLobErrorOgiveRtROOR , kLobErrorRangeAngleOOR ,
  kLobErrorTailLengthOOR , kLobErrorWindHeadingOOR , kLobErrorZeroAngleOOR , kLobErrorZeroDataRequired ,
  kLobErrorZeroDistanceOOR , kLobErrorZeroUnreachable , kLobErrorNumberOfErrors
}
 

Functions

const char * LobVersion (void)
 Gets the library version in major.minor.patch format.
 
void LobBuilderInit (LobBuilder *pbuilder)
 Initializes a builder to default state. No-op if pbuilder is null.
 
void LobBuilderDestroy (LobBuilder *pbuilder)
 Destroys a builder and releases resources. No-op if pbuilder is null.
 
void LobBuilderCopy (LobBuilder *dst, const LobBuilder *src)
 Copies builder state from src to dst. No-op if either is null.
 
LobBuilderLobBuilderReset (LobBuilder *pbuilder)
 Resets a builder state by re-initializing. No-op if pbuilder is null.
 
LobBuilderLobBuilderBallisticCoefficientPsi (LobBuilder *pbuilder, double value)
 Sets the ballistic coefficient (Psi).
 
LobBuilderLobBuilderBCAtmosphere (LobBuilder *pbuilder, LobAtmosphereReferenceT type)
 Sets the atmosphere reference associated with ballistic coefficient.
 
LobBuilderLobBuilderBCDragFunction (LobBuilder *pbuilder, LobDragFunctionT type)
 Sets the drag function associated with ballistic coefficient.
 
LobBuilderLobBuilderDiameterInch (LobBuilder *pbuilder, double value)
 Sets the projectile diameter (caliber) in inches.
 
LobBuilderLobBuilderMeplatDiameterInch (LobBuilder *pbuilder, double value)
 Sets the projectile meplat diameter in inches.
 
LobBuilderLobBuilderBaseDiameterInch (LobBuilder *pbuilder, double value)
 Sets the projectile base diameter in inches.
 
LobBuilderLobBuilderLengthInch (LobBuilder *pbuilder, double value)
 Sets the projectile length in inches.
 
LobBuilderLobBuilderNoseLengthInch (LobBuilder *pbuilder, double value)
 Sets the projectile nose length in inches.
 
LobBuilderLobBuilderTailLengthInch (LobBuilder *pbuilder, double value)
 Sets the projectile tail length in inches.
 
LobBuilderLobBuilderOgiveRtR (LobBuilder *pbuilder, double value)
 Sets the Rt/R ratio of the projectile ogive.
 
LobBuilderLobBuilderSplineFitTable (LobBuilder *pbuilder, const float *pmachs, const float *pdrags, size_t size)
 Loads a custom Mach vs Drag table for the projectile.
 
LobBuilderLobBuilderBCVelocityBands (LobBuilder *pbuilder, const float *pfps, const float *pbcs, size_t size)
 Loads ballistic coefficients measured at multiple velocities.
 
LobBuilderLobBuilderMassGrains (LobBuilder *pbuilder, double value)
 Sets the projectile mass in grains.
 
LobBuilderLobBuilderInitialVelocityFps (LobBuilder *pbuilder, uint16_t value)
 Sets the initial velocity of the projectile in feet per second.
 
LobBuilderLobBuilderOpticHeightInches (LobBuilder *pbuilder, double value)
 Sets the height of the optic above the bore in inches.
 
LobBuilderLobBuilderTwistInchesPerTurn (LobBuilder *pbuilder, double value)
 Sets the twist rate of the barrel in inches per turn.
 
LobBuilderLobBuilderZeroAngleMOA (LobBuilder *pbuilder, double value)
 Sets the angle between the sight and launch angle used to achieve zero.
 
LobBuilderLobBuilderZeroDistanceYds (LobBuilder *pbuilder, double value)
 Sets the zero distance in yards.
 
LobBuilderLobBuilderZeroImpactHeightInches (LobBuilder *pbuilder, double value)
 Sets the zero impact height in inches.
 
LobBuilderLobBuilderAltitudeOfFiringSiteFt (LobBuilder *pbuilder, double value)
 Sets the altitude of the firing site in feet.
 
LobBuilderLobBuilderAirPressureInHg (LobBuilder *pbuilder, double value)
 Sets the air pressure in inches of mercury (inHg).
 
LobBuilderLobBuilderAltitudeOfBarometerFt (LobBuilder *pbuilder, double value)
 Sets the altitude of the location where air pressure was taken in feet.
 
LobBuilderLobBuilderTemperatureDegF (LobBuilder *pbuilder, double value)
 Sets the temperature in degrees Fahrenheit.
 
LobBuilderLobBuilderAltitudeOfThermometerFt (LobBuilder *pbuilder, double value)
 Sets the altitude of the location where temperature was taken in feet.
 
LobBuilderLobBuilderRelativeHumidityPercent (LobBuilder *pbuilder, double value)
 Sets the relative humidity at the firing site in percent.
 
LobBuilderLobBuilderWindHeading (LobBuilder *pbuilder, LobClockAngleT value)
 Sets the wind heading using a clock angle.
 
LobBuilderLobBuilderWindHeadingDeg (LobBuilder *pbuilder, double value)
 Sets the wind heading in degrees.
 
LobBuilderLobBuilderWindSpeedFps (LobBuilder *pbuilder, double value)
 Sets the wind speed in feet per second.
 
LobBuilderLobBuilderWindSpeedMph (LobBuilder *pbuilder, double value)
 Sets the wind speed in miles per hour.
 
LobBuilderLobBuilderAzimuthDeg (LobBuilder *pbuilder, double value)
 Sets the azimuth (bearing) of the target in degrees.
 
LobBuilderLobBuilderLatitudeDeg (LobBuilder *pbuilder, double value)
 Sets the latitude of the firing location in degrees.
 
LobBuilderLobBuilderRangeAngleDeg (LobBuilder *pbuilder, double value)
 Sets the range angle (inclination) to the target in degrees.
 
LobBuilderLobBuilderMinimumSpeed (LobBuilder *pbuilder, uint16_t value)
 Sets the minimum speed threshold for the solver.
 
LobBuilderLobBuilderMinimumEnergy (LobBuilder *pbuilder, uint16_t value)
 Sets the minimum energy threshold for the solver.
 
LobBuilderLobBuilderMaximumTime (LobBuilder *pbuilder, double value)
 Sets the maximum time of flight for the solver.
 
LobBuilderLobBuilderStepSize (LobBuilder *pbuilder, uint16_t value)
 Sets the step size for the numerical solver.
 
void LobBuilderBuild (LobBuilder *pbuilder, LobContext *presult)
 Builds the LobContext object with the configured parameters.
 
size_t LobSolve (const LobContext *pctx, const uint32_t *pranges, LobOutput *pouts, size_t size)
 Solves the exterior ballistics problem for a given set of ranges. Results contain a forward-solution.
 
size_t LobFastInverse (const LobContext *pctx, LobOutput *pouts, size_t size)
 Converts forward-solution output to inverse-solution adjustments.
 
size_t LobSolveInverse (const LobContext *pctx, const uint32_t *pranges, LobOutput *pouts, size_t size)
 Solves the exterior ballistics problem for a given set of ranges. Results contain an inverse-solution.
 
double LobMoaToMil (double value)
 Converts minutes of angle (MOA) to milliradians (MIL).
 
double LobMoaToDeg (double value)
 Converts minutes of angle (MOA) to degrees.
 
double LobMoaToIphy (double value)
 Converts minutes of angle (MOA) to inches per hundred yards (IPHY).
 
double LobMoaToInch (double value, double range_ft)
 Converts minutes of angle (MOA) to projected inches at a given range in feet.
 
double LobMilToMoa (double value)
 Converts milliradians (MIL) to minutes of angle (MOA).
 
double LobMilToDeg (double value)
 Converts milliradians (MIL) to degrees.
 
double LobMilToIphy (double value)
 Converts milliradians (MIL) to inches per hundred yards (IPHY).
 
double LobMilToInch (double value, double range_ft)
 Converts milliradians (MIL) to projected inches at a given range in feet.
 
double LobDegToMoa (double value)
 Converts degrees to minutes of angle (MOA).
 
double LobDegToMil (double value)
 Converts degrees to milliradians (MIL).
 
double LobInchToMoa (double value, double range_ft)
 Inches of projection at a given range to minutes of angle (MOA).
 
double LobInchToMil (double value, double range_ft)
 Inches of projection at a given range to milliradians (MIL).
 
double LobInchToDeg (double value, double range_ft)
 Inches of projection at a given range to degrees.
 
double LobJToFtLbs (double value)
 Converts joules to foot-pounds.
 
double LobFtLbsToJ (double value)
 Converts foot-pounds to joules.
 
double LobMToYd (double value)
 Converts meters to yards.
 
double LobYdToFt (double value)
 Converts yards to feet.
 
double LobMToFt (double value)
 Converts meters to feet.
 
double LobFtToIn (double value)
 Converts feet to inches.
 
double LobMmToIn (double value)
 Converts millimeters to inches.
 
double LobCmToIn (double value)
 Converts centimeters to inches.
 
double LobYdToM (double value)
 Converts yards to meters.
 
double LobFtToM (double value)
 Converts feet to meters.
 
double LobFtToYd (double value)
 Converts feet to yards.
 
double LobInToMm (double value)
 Converts inches to millimeters.
 
double LobInToCm (double value)
 Converts inches to centimeters.
 
double LobInToFt (double value)
 Converts inches to feet.
 
double LobPaToInHg (double value)
 Converts pascals to inches of mercury.
 
double LobMbarToInHg (double value)
 Converts millibars to inches of mercury.
 
double LobPsiToInHg (double value)
 Converts pounds per square inch (PSI) to inches of mercury.
 
double LobLbsToGrain (double value)
 Converts pounds to grains.
 
double LobGToGrain (double value)
 Converts grams to grains.
 
double LobKgToGrain (double value)
 Converts kilograms to grains.
 
double LobKgSqMToPmsi (double value)
 Converts kilograms per square meter to pounds mass per square inch.
 
double LobFpsToMps (double value)
 Converts feet per second to meters per second.
 
double LobMpsToFps (double value)
 Converts meters per second to feet per second.
 
double LobKphToMph (double value)
 Converts kilometers per hour to miles per hour.
 
double LobKnToMph (double value)
 Converts Knots to miles per hour.
 
double LobMsToS (double value)
 Converts milliseconds to seconds.
 
double LobUsToS (double value)
 Converts microseconds to seconds.
 
double LobSToMs (double value)
 Converts seconds to milliseconds.
 
double LobSToUs (double value)
 Converts seconds to microseconds.
 
double LobDegCToDegF (double value)
 Converts degrees celsius to degrees fahrenheit.
 

Macro Definition Documentation

◆ LOB_BUILDER_BUFFER_SIZE

#define LOB_BUILDER_BUFFER_SIZE   272

The size in bytes of the builder buffer.

◆ LOB_SPLINE_SEGMENTS

#define LOB_SPLINE_SEGMENTS   15

The number of spline pieces comprising a drag function.

Typedef Documentation

◆ LobAtmosphereReferenceT

typedef uint8_t LobAtmosphereReferenceT

Atmosphere reference type.

◆ LobClockAngleT

typedef uint8_t LobClockAngleT

Clock angle positions for wind direction.

◆ LobDragFunctionT

typedef uint8_t LobDragFunctionT

Drag function type.

◆ LobErrorT

typedef uint8_t LobErrorT

Error codes returned by the builder.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kLobClockAngleI 

one o'clock

kLobClockAngleII 

two o'clock

kLobClockAngleIII 

three o'clock

kLobClockAngleIV 

four o'clock

kLobClockAngleV 

five o'clock

kLobClockAngleVI 

six o'clock

kLobClockAngleVII 

seven o'clock

kLobClockAngleVIII 

eight o'clock

kLobClockAngleIX 

nine o'clock

kLobClockAngleX 

ten o'clock

kLobClockAngleXI 

eleven o'clock

kLobClockAngleXII 

twelve o'clock

◆ anonymous enum

anonymous enum
Enumerator
kLobAtmosphereReferenceArmyStandardMetro 

Army Standard Metro.

kLobAtmosphereReferenceIcao 

International Civil Aviation Organization (ICAO)

◆ anonymous enum

anonymous enum
Enumerator
kLobDragFunctionG1 

G1 drag function.

kLobDragFunctionG2 

G2 drag function.

kLobDragFunctionG5 

G5 drag function.

kLobDragFunctionG6 

G6 drag function.

kLobDragFunctionG7 

G7 drag function.

kLobDragFunctionG8 

G8 drag function.

◆ anonymous enum

anonymous enum
Enumerator
kLobErrorNone 
kLobErrorAirPressureOOR 
kLobErrorAltitudeOfBarometerOOR 
kLobErrorAltitudeOfFiringSiteOOR 
kLobErrorAltitudeOfThermometerOOR 
kLobErrorAzimuthOOR 
kLobErrorBallisticCoefficientOOR 
kLobErrorBallisticCoefficientRequired 
kLobErrorBaseDiameterOOR 
kLobErrorBcBandsInvalid 
kLobErrorBcBandsNotMonotonic 
kLobErrorBcBandsTooShort 
kLobErrorDiameterOOR 
kLobErrorHumidityOOR 
kLobErrorInitialVelocityRequired 
kLobErrorInternalError 
kLobErrorLatitudeOOR 
kLobErrorLengthOOR 
kLobErrorMachDragTableInvalid 
kLobErrorMachDragTableNotMonotonic 
kLobErrorMachDragTableTooShort 
kLobErrorMassOOR 
kLobErrorMaximumTimeOOR 
kLobErrorMeplatDiameterOOR 
kLobErrorNoseLengthOOR 
kLobErrorNotFormed 
kLobErrorOgiveRtROOR 
kLobErrorRangeAngleOOR 
kLobErrorTailLengthOOR 
kLobErrorWindHeadingOOR 
kLobErrorZeroAngleOOR 
kLobErrorZeroDataRequired 
kLobErrorZeroDistanceOOR 
kLobErrorZeroUnreachable 
kLobErrorNumberOfErrors 
Note
Total number of enumerated Errors

Function Documentation

◆ LobBuilderAirPressureInHg()

LobBuilder * LobBuilderAirPressureInHg ( LobBuilder * pbuilder,
double value )
extern

Sets the air pressure in inches of mercury (inHg).

Parameters
pbuilderPointer to the builder.
valueThe air pressure in inHg.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderAltitudeOfBarometerFt()

LobBuilder * LobBuilderAltitudeOfBarometerFt ( LobBuilder * pbuilder,
double value )
extern

Sets the altitude of the location where air pressure was taken in feet.

Note
This only has an effect if the air pressure was taken from a site other than the firing site with a different altitude such as a nearby weather station.
Parameters
pbuilderPointer to the builder.
valueThe altitude in feet.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderAltitudeOfFiringSiteFt()

LobBuilder * LobBuilderAltitudeOfFiringSiteFt ( LobBuilder * pbuilder,
double value )
extern

Sets the altitude of the firing site in feet.

Parameters
pbuilderPointer to the builder.
valueThe altitude in feet.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderAltitudeOfThermometerFt()

LobBuilder * LobBuilderAltitudeOfThermometerFt ( LobBuilder * pbuilder,
double value )
extern

Sets the altitude of the location where temperature was taken in feet.

Note
This only has an effect if the temperature was taken from a site other than the firing site with a different altitude such as a nearby weather station.
Parameters
pbuilderPointer to the builder.
valueThe altitude in feet.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderAzimuthDeg()

LobBuilder * LobBuilderAzimuthDeg ( LobBuilder * pbuilder,
double value )
extern

Sets the azimuth (bearing) of the target in degrees.

Note
Used for making coriolis effect corrections.
Parameters
pbuilderPointer to the builder.
valueThe azimuth in degrees.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderBallisticCoefficientPsi()

LobBuilder * LobBuilderBallisticCoefficientPsi ( LobBuilder * pbuilder,
double value )
extern

Sets the ballistic coefficient (Psi).

Parameters
pbuilderPointer to the builder.
valueThe ballistic coefficient value.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderBaseDiameterInch()

LobBuilder * LobBuilderBaseDiameterInch ( LobBuilder * pbuilder,
double value )
extern

Sets the projectile base diameter in inches.

Parameters
pbuilderPointer to the builder.
valueThe base diameter in inches.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderBCAtmosphere()

LobBuilder * LobBuilderBCAtmosphere ( LobBuilder * pbuilder,
LobAtmosphereReferenceT type )
extern

Sets the atmosphere reference associated with ballistic coefficient.

Parameters
pbuilderPointer to the builder.
typeThe atmosphere reference type.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderBCDragFunction()

LobBuilder * LobBuilderBCDragFunction ( LobBuilder * pbuilder,
LobDragFunctionT type )
extern

Sets the drag function associated with ballistic coefficient.

Note
Does not clear a table loaded via LobBuilderSplineFitTable or LobBuilderBCVelocityBands; those override the drag function at Build time. If both table types are configured, the last call wins regardless of order. Call LobBuilderReset to return to a standard drag function.
Parameters
pbuilderPointer to the builder.
typeThe drag function type.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderBCVelocityBands()

LobBuilder * LobBuilderBCVelocityBands ( LobBuilder * pbuilder,
const float * pfps,
const float * pbcs,
size_t size )
extern

Loads ballistic coefficients measured at multiple velocities.

A projectile's effective BC varies with velocity. Supplying BCs at several velocities tailors the drag function set via LobBuilderBCDragFunction to better fit the projectile's actual velocity-dependent drag. A constant BC across all bands reproduces the result of LobBuilderBallisticCoefficientPsi with that BC.

Note
The BCs use the same units as LobBuilderBallisticCoefficientPsi and respect the atmosphere reference set via LobBuilderBCAtmosphere.
Warning
The caller must keep pfps and pbcs valid until LobBuilderBuild is called. The builder copies no data; the pointers are referenced during Build().
Parameters
pbuilderPointer to the builder.
pfpsPointer to an array of velocity values in feet per second.
pbcsPointer to an array of associated ballistic coefficients.
sizeThe number of velocity-bc pairs. Must be at least 2 and at most 16; velocities must be positive and strictly increasing, BCs positive, and the highest velocity below Mach 5.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderBuild()

void LobBuilderBuild ( LobBuilder * pbuilder,
LobContext * presult )
extern

Builds the LobContext object with the configured parameters.

Parameters
pbuilderPointer to the builder.
presultPointer to the LobContext to populate. Null pointers are ignored (the call is a no-op).

◆ LobBuilderCopy()

void LobBuilderCopy ( LobBuilder * dst,
const LobBuilder * src )
extern

Copies builder state from src to dst. No-op if either is null.

◆ LobBuilderDestroy()

void LobBuilderDestroy ( LobBuilder * pbuilder)
extern

Destroys a builder and releases resources. No-op if pbuilder is null.

◆ LobBuilderDiameterInch()

LobBuilder * LobBuilderDiameterInch ( LobBuilder * pbuilder,
double value )
extern

Sets the projectile diameter (caliber) in inches.

Parameters
pbuilderPointer to the builder.
valueThe diameter in inches.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderInit()

void LobBuilderInit ( LobBuilder * pbuilder)
extern

Initializes a builder to default state. No-op if pbuilder is null.

◆ LobBuilderInitialVelocityFps()

LobBuilder * LobBuilderInitialVelocityFps ( LobBuilder * pbuilder,
uint16_t value )
extern

Sets the initial velocity of the projectile in feet per second.

Parameters
pbuilderPointer to the builder.
valueThe initial velocity in fps.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderLatitudeDeg()

LobBuilder * LobBuilderLatitudeDeg ( LobBuilder * pbuilder,
double value )
extern

Sets the latitude of the firing location in degrees.

Note
Used for making coriolis effect corrections.
Parameters
pbuilderPointer to the builder.
valueThe latitude in degrees.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderLengthInch()

LobBuilder * LobBuilderLengthInch ( LobBuilder * pbuilder,
double value )
extern

Sets the projectile length in inches.

Parameters
pbuilderPointer to the builder.
valueThe length in inches.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderMassGrains()

LobBuilder * LobBuilderMassGrains ( LobBuilder * pbuilder,
double value )
extern

Sets the projectile mass in grains.

Parameters
pbuilderPointer to the builder.
valueThe mass in grains.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderMaximumTime()

LobBuilder * LobBuilderMaximumTime ( LobBuilder * pbuilder,
double value )
extern

Sets the maximum time of flight for the solver.

Parameters
pbuilderPointer to the builder.
valueThe maximum time in seconds after which the solver will stop calculations.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderMeplatDiameterInch()

LobBuilder * LobBuilderMeplatDiameterInch ( LobBuilder * pbuilder,
double value )
extern

Sets the projectile meplat diameter in inches.

Parameters
pbuilderPointer to the builder.
valueThe meplat in inches.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderMinimumEnergy()

LobBuilder * LobBuilderMinimumEnergy ( LobBuilder * pbuilder,
uint16_t value )
extern

Sets the minimum energy threshold for the solver.

Parameters
pbuilderPointer to the builder.
valueThe minimum energy in foot-pounds (ft*lbf) at which the solver will stop calculations.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderMinimumSpeed()

LobBuilder * LobBuilderMinimumSpeed ( LobBuilder * pbuilder,
uint16_t value )
extern

Sets the minimum speed threshold for the solver.

Parameters
pbuilderPointer to the builder.
valueThe minimum speed in feet per second (fps) at which the solver will stop calculations.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderNoseLengthInch()

LobBuilder * LobBuilderNoseLengthInch ( LobBuilder * pbuilder,
double value )
extern

Sets the projectile nose length in inches.

Parameters
pbuilderPointer to the builder.
valueThe nose length in inches.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderOgiveRtR()

LobBuilder * LobBuilderOgiveRtR ( LobBuilder * pbuilder,
double value )
extern

Sets the Rt/R ratio of the projectile ogive.

Parameters
pbuilderPointer to the builder.
valueThe Rt/R ratio.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderOpticHeightInches()

LobBuilder * LobBuilderOpticHeightInches ( LobBuilder * pbuilder,
double value )
extern

Sets the height of the optic above the bore in inches.

Parameters
pbuilderPointer to the builder.
valueThe optic height in inches.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderRangeAngleDeg()

LobBuilder * LobBuilderRangeAngleDeg ( LobBuilder * pbuilder,
double value )
extern

Sets the range angle (inclination) to the target in degrees.

Parameters
pbuilderPointer to the builder.
valueThe range angle in degrees.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderRelativeHumidityPercent()

LobBuilder * LobBuilderRelativeHumidityPercent ( LobBuilder * pbuilder,
double value )
extern

Sets the relative humidity at the firing site in percent.

Parameters
pbuilderPointer to the builder.
valueThe relative humidity in percent.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderReset()

LobBuilder * LobBuilderReset ( LobBuilder * pbuilder)
extern

Resets a builder state by re-initializing. No-op if pbuilder is null.

◆ LobBuilderSplineFitTable()

LobBuilder * LobBuilderSplineFitTable ( LobBuilder * pbuilder,
const float * pmachs,
const float * pdrags,
size_t size )
extern

Loads a custom Mach vs Drag table for the projectile.

This is a direct alternative to using a ballistic coefficient and a reference drag function.

Note
If the table does not span Mach 0..5 it is extrapolated; if extrapolation would produce invalid drag, Build returns kLobErrorMachDragTableInvalid — pad the table with explicit entries at 0 and/or 5.0 to define the desired edge behavior.
Warning
The caller must keep pmachs and pdrags valid until LobBuilderBuild is called. The builder copies no data; the pointers are referenced during Build().
Parameters
pbuilderPointer to the builder.
pmachsPointer to an array of mach values.
pdragsPointer to an array of associated drag values.
sizeThe number of mach-drag pairs in the table.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderStepSize()

LobBuilder * LobBuilderStepSize ( LobBuilder * pbuilder,
uint16_t value )
extern

Sets the step size for the numerical solver.

Note
If set to zero (the default) the solver uses a 1-yard step.
Parameters
pbuilderPointer to the builder.
valueThe spatial step size in inches. 0 = default.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderTailLengthInch()

LobBuilder * LobBuilderTailLengthInch ( LobBuilder * pbuilder,
double value )
extern

Sets the projectile tail length in inches.

Parameters
pbuilderPointer to the builder.
valueThe tail length in inches.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderTemperatureDegF()

LobBuilder * LobBuilderTemperatureDegF ( LobBuilder * pbuilder,
double value )
extern

Sets the temperature in degrees Fahrenheit.

Parameters
pbuilderPointer to the builder.
valueThe temperature in degrees F.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderTwistInchesPerTurn()

LobBuilder * LobBuilderTwistInchesPerTurn ( LobBuilder * pbuilder,
double value )
extern

Sets the twist rate of the barrel in inches per turn.

Note
Used to calculate adjustments for spin drift and aerodynamic jump.
Parameters
pbuilderPointer to the builder.
valueThe twist rate in inches per turn.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderWindHeading()

LobBuilder * LobBuilderWindHeading ( LobBuilder * pbuilder,
LobClockAngleT value )
extern

Sets the wind heading using a clock angle.

Note
Twelve O'Clock is pure tailwind, Six O'Clock is a pure headwind.
Parameters
pbuilderPointer to the builder.
valueThe wind heading as a clock angle.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderWindHeadingDeg()

LobBuilder * LobBuilderWindHeadingDeg ( LobBuilder * pbuilder,
double value )
extern

Sets the wind heading in degrees.

Note
0 is pure tailwind, 180 is pure headwind.
Parameters
pbuilderPointer to the builder.
valueThe wind heading in degrees.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderWindSpeedFps()

LobBuilder * LobBuilderWindSpeedFps ( LobBuilder * pbuilder,
double value )
extern

Sets the wind speed in feet per second.

Parameters
pbuilderPointer to the builder.
valueThe wind speed in fps.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderWindSpeedMph()

LobBuilder * LobBuilderWindSpeedMph ( LobBuilder * pbuilder,
double value )
extern

Sets the wind speed in miles per hour.

Parameters
pbuilderPointer to the builder.
valueThe wind speed in mph.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderZeroAngleMOA()

LobBuilder * LobBuilderZeroAngleMOA ( LobBuilder * pbuilder,
double value )
extern

Sets the angle between the sight and launch angle used to achieve zero.

Note
This is a portable zero value useful when firing conditions differ from zeroing conditions.
Parameters
pbuilderPointer to the builder.
valueThe zero angle in MOA.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderZeroDistanceYds()

LobBuilder * LobBuilderZeroDistanceYds ( LobBuilder * pbuilder,
double value )
extern

Sets the zero distance in yards.

Parameters
pbuilderPointer to the builder.
valueThe zero distance in yards.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobBuilderZeroImpactHeightInches()

LobBuilder * LobBuilderZeroImpactHeightInches ( LobBuilder * pbuilder,
double value )
extern

Sets the zero impact height in inches.

Note
This would be used if zeroing three inches high at 100 yards for example.
Parameters
pbuilderPointer to the builder.
valueThe zero impact height in inches.
Returns
Pointer to the builder, or nullptr if pbuilder is null.

◆ LobCmToIn()

double LobCmToIn ( double value)
extern

Converts centimeters to inches.

Parameters
valueLength in centimeters.
Returns
Equivalent length in inches.

◆ LobDegCToDegF()

double LobDegCToDegF ( double value)
extern

Converts degrees celsius to degrees fahrenheit.

Parameters
valueTemperature in degrees celsius.
Returns
Equivalent temperature in degrees fahrenheit.

◆ LobDegToMil()

double LobDegToMil ( double value)
extern

Converts degrees to milliradians (MIL).

Parameters
valueAngle in degrees.
Returns
Equivalent angle in MIL.

◆ LobDegToMoa()

double LobDegToMoa ( double value)
extern

Converts degrees to minutes of angle (MOA).

Parameters
valueAngle in degrees.
Returns
Equivalent angle in MOA.

◆ LobFastInverse()

size_t LobFastInverse ( const LobContext * pctx,
LobOutput * pouts,
size_t size )
extern

Converts forward-solution output to inverse-solution adjustments.

Note
A one-step approximation. Only convert outputs whose forward solution reached the target range; fall-short trajectories yield meaningless results. Entries with non-finite elevation or deflection are skipped and not counted.
Parameters
pctxPointer to context parameters for the calculation.
poutsPointer to an array of forward-solution outputs to convert in place.
sizeThe number of outputs to convert.
Returns
The number of successful conversions, or 0 on invalid arguments. Entries with zero range are skipped and not counted.

◆ LobFpsToMps()

double LobFpsToMps ( double value)
extern

Converts feet per second to meters per second.

Parameters
valueSpeed in feet per second.
Returns
Equivalent speed in meters per second.

◆ LobFtLbsToJ()

double LobFtLbsToJ ( double value)
extern

Converts foot-pounds to joules.

Parameters
valueEnergy in foot-pounds.
Returns
Equivalent energy in joules.

◆ LobFtToIn()

double LobFtToIn ( double value)
extern

Converts feet to inches.

Parameters
valueLength in feet.
Returns
Equivalent length in inches.

◆ LobFtToM()

double LobFtToM ( double value)
extern

Converts feet to meters.

Parameters
valueLength in feet.
Returns
Equivalent length in meters.

◆ LobFtToYd()

double LobFtToYd ( double value)
extern

Converts feet to yards.

Parameters
valueLength in feet.
Returns
Equivalent length in yards.

◆ LobGToGrain()

double LobGToGrain ( double value)
extern

Converts grams to grains.

Parameters
valueMass in grams.
Returns
Equivalent mass in grains.

◆ LobInchToDeg()

double LobInchToDeg ( double value,
double range_ft )
extern

Inches of projection at a given range to degrees.

Parameters
valueProjected inches.
range_ftRange in feet.
Returns
Equivalent angle in degrees.

◆ LobInchToMil()

double LobInchToMil ( double value,
double range_ft )
extern

Inches of projection at a given range to milliradians (MIL).

Parameters
valueProjected inches.
range_ftRange in feet.
Returns
Equivalent angle in MIL.

◆ LobInchToMoa()

double LobInchToMoa ( double value,
double range_ft )
extern

Inches of projection at a given range to minutes of angle (MOA).

Parameters
valueProjected inches.
range_ftRange in feet.
Returns
Equivalent angle in MOA.

◆ LobInToCm()

double LobInToCm ( double value)
extern

Converts inches to centimeters.

Parameters
valueLength in inches.
Returns
Equivalent length in centimeters.

◆ LobInToFt()

double LobInToFt ( double value)
extern

Converts inches to feet.

Parameters
valueLength in inches.
Returns
Equivalent length in feet.

◆ LobInToMm()

double LobInToMm ( double value)
extern

Converts inches to millimeters.

Parameters
valueLength in inches.
Returns
Equivalent length in millimeters.

◆ LobJToFtLbs()

double LobJToFtLbs ( double value)
extern

Converts joules to foot-pounds.

Parameters
valueEnergy in joules.
Returns
Equivalent energy in foot-pounds.

◆ LobKgSqMToPmsi()

double LobKgSqMToPmsi ( double value)
extern

Converts kilograms per square meter to pounds mass per square inch.

Parameters
valueSectional density in Kg/m^2.
Returns
Equivalent sectional density in lb/in^2.

◆ LobKgToGrain()

double LobKgToGrain ( double value)
extern

Converts kilograms to grains.

Parameters
valueMass in kilograms.
Returns
Equivalent mass in grains.

◆ LobKnToMph()

double LobKnToMph ( double value)
extern

Converts Knots to miles per hour.

Parameters
valueSpeed in Knots.
Returns
Equivalent speed in miles per hour.

◆ LobKphToMph()

double LobKphToMph ( double value)
extern

Converts kilometers per hour to miles per hour.

Parameters
valueSpeed in kilometers per hour.
Returns
Equivalent speed in miles per hour.

◆ LobLbsToGrain()

double LobLbsToGrain ( double value)
extern

Converts pounds to grains.

Parameters
valueMass in pounds.
Returns
Equivalent mass in grains.

◆ LobMbarToInHg()

double LobMbarToInHg ( double value)
extern

Converts millibars to inches of mercury.

Parameters
valuePressure in millibars.
Returns
Equivalent pressure in inches of mercury.

◆ LobMilToDeg()

double LobMilToDeg ( double value)
extern

Converts milliradians (MIL) to degrees.

Parameters
valueAngle in MIL.
Returns
Equivalent angle in degrees.

◆ LobMilToInch()

double LobMilToInch ( double value,
double range_ft )
extern

Converts milliradians (MIL) to projected inches at a given range in feet.

Parameters
valueAngle in MIL.
range_ftRange in feet.
Returns
Equivalent projected inches.

◆ LobMilToIphy()

double LobMilToIphy ( double value)
extern

Converts milliradians (MIL) to inches per hundred yards (IPHY).

Parameters
valueAngle in MIL.
Returns
Equivalent angle in IPHY.

◆ LobMilToMoa()

double LobMilToMoa ( double value)
extern

Converts milliradians (MIL) to minutes of angle (MOA).

Parameters
valueAngle in MIL.
Returns
Equivalent angle in MOA.

◆ LobMmToIn()

double LobMmToIn ( double value)
extern

Converts millimeters to inches.

Parameters
valueLength in millimeters.
Returns
Equivalent length in inches.

◆ LobMoaToDeg()

double LobMoaToDeg ( double value)
extern

Converts minutes of angle (MOA) to degrees.

Parameters
valueAngle in MOA.
Returns
Equivalent angle in degrees.

◆ LobMoaToInch()

double LobMoaToInch ( double value,
double range_ft )
extern

Converts minutes of angle (MOA) to projected inches at a given range in feet.

Parameters
valueAngle in MOA.
range_ftRange in feet.
Returns
Equivalent projected inches.

◆ LobMoaToIphy()

double LobMoaToIphy ( double value)
extern

Converts minutes of angle (MOA) to inches per hundred yards (IPHY).

Parameters
valueAngle in MOA.
Returns
Equivalent angle in IPHY.

◆ LobMoaToMil()

double LobMoaToMil ( double value)
extern

Converts minutes of angle (MOA) to milliradians (MIL).

Parameters
valueAngle in MOA.
Returns
Equivalent angle in MIL.

◆ LobMpsToFps()

double LobMpsToFps ( double value)
extern

Converts meters per second to feet per second.

Parameters
valueSpeed in meters per second.
Returns
Equivalent speed in feet per second.

◆ LobMsToS()

double LobMsToS ( double value)
extern

Converts milliseconds to seconds.

Parameters
valueTime in milliseconds.
Returns
Equivalent time in seconds.

◆ LobMToFt()

double LobMToFt ( double value)
extern

Converts meters to feet.

Parameters
valueLength in meters.
Returns
Equivalent length in feet.

◆ LobMToYd()

double LobMToYd ( double value)
extern

Converts meters to yards.

Parameters
valueLength in meters.
Returns
Equivalent length in yards.

◆ LobPaToInHg()

double LobPaToInHg ( double value)
extern

Converts pascals to inches of mercury.

Parameters
valuePressure in pascals.
Returns
Equivalent pressure in inches of mercury.

◆ LobPsiToInHg()

double LobPsiToInHg ( double value)
extern

Converts pounds per square inch (PSI) to inches of mercury.

Parameters
valuePressure in PSI.
Returns
Equivalent pressure in inches of mercury.

◆ LobSolve()

size_t LobSolve ( const LobContext * pctx,
const uint32_t * pranges,
LobOutput * pouts,
size_t size )
extern

Solves the exterior ballistics problem for a given set of ranges. Results contain a forward-solution.

Note
A forward-solution solves for the expected change in elevation and deflection (in inches) at a given range.
Parameters
pctxPointer to context parameters for the calculation.
prangesPointer to an array of ranges (in feet) to solve for.
poutsPointer to an array where the output results will be stored.
sizeThe number of ranges to solve for.
Returns
The number of successful solutions.

◆ LobSolveInverse()

size_t LobSolveInverse ( const LobContext * pctx,
const uint32_t * pranges,
LobOutput * pouts,
size_t size )
extern

Solves the exterior ballistics problem for a given set of ranges. Results contain an inverse-solution.

Note
An inverse-solution solves for the adjustments (in MOA) required to hit at a given range. Entries with zero range are counted but their adjustments are zeroed. Adjustments for ranges the projectile cannot reach (fall-short solutions) are not produced; solving stops at the first such entry. Unlike LobFastInverse, a fall-short entry is not silently given a meaningless adjustment.
Parameters
pctxPointer to context parameters for the calculation.
prangesPointer to an array of ranges (in feet) to solve for.
poutsPointer to an array where the output results will be stored.
sizeThe number of ranges to solve for.
Returns
The number of successful solutions.

◆ LobSToMs()

double LobSToMs ( double value)
extern

Converts seconds to milliseconds.

Parameters
valueTime in seconds.
Returns
Equivalent time in milliseconds.

◆ LobSToUs()

double LobSToUs ( double value)
extern

Converts seconds to microseconds.

Parameters
valueTime in seconds.
Returns
Equivalent time in microseconds.

◆ LobUsToS()

double LobUsToS ( double value)
extern

Converts microseconds to seconds.

Parameters
valueTime in microseconds.
Returns
Equivalent time in seconds.

◆ LobVersion()

const char * LobVersion ( void )
extern

Gets the library version in major.minor.patch format.

◆ LobYdToFt()

double LobYdToFt ( double value)
extern

Converts yards to feet.

Parameters
valueLength in yards.
Returns
Equivalent length in feet.

◆ LobYdToM()

double LobYdToM ( double value)
extern

Converts yards to meters.

Parameters
valueLength in yards.
Returns
Equivalent length in meters.