API Reference / Turbo · class

Class: Turbo

Runtime evaluator for a turbo pack — a segmented Chebyshev fit of the engine's apparent longitude over a fixed range and body set. Evaluating a longitude costs a couple dozen multiply-adds, so a century-scale transit scan that calls it tens of thousands of times runs in milliseconds. Construct one from a pack you minted offline; it does no fitting, no I/O, and needs no Engine.

Example

const turbo = new Turbo(pack); // a TurboPack generated for your range/bodies
if (turbo.has("mars")) turbo.longitude("mars", jd);

Constructors

Constructor

new Turbo(pack): Turbo;

Parameters

ParameterTypeDescription
packTurboPackA TurboPack: the fitted segments plus its jd0/jd1 range, minted offline for your bodies and span.

Returns

Turbo

Properties

PropertyModifierTypeDescription
<a id="jd0"></a> jd0readonlynumberStart of the pack's valid Julian Day (UT) range.
<a id="jd1"></a> jd1readonlynumberEnd of the pack's valid Julian Day (UT) range.

Methods

has()

has(body): boolean;

Whether this pack can evaluate a given body.

Parameters

ParameterTypeDescription
bodystringBody id to test.

Returns

boolean

true if Turbo.longitude accepts body.


longitude()

longitude(body, jd): number;

Apparent ecliptic longitude (degrees) of a body from the turbo pack, in the pack's own zodiac. The hot path for bulk scans.

Parameters

ParameterTypeDescription
bodystringA body id the pack contains (see Turbo.has).
jdnumberJulian Day (UT), within [jd0, jd1].

Returns

number

Ecliptic longitude in degrees, [0, 360).

Throws

Error if the pack lacks body, or jd is outside [jd0, jd1].

Start building

Quickstart →