API Reference / syntheticPositions · function

Function: syntheticPositions()

function syntheticPositions(sys, tDays): Record<string, SyntheticPosition>;

Positions of every body at one instant — the core position-over-time contract. Pure: a function of (sys, t) only.

When sys.observer is set, each other body's position is geocentric/apparent as seen from the observer body (its heliocentric vector subtracted), so an outer body shows a real apparent retrograde arc around opposition. The observer body itself is reported at its own heliocentric place. With no observer the positions are heliocentric.

Parameters

ParameterTypeDescription
sysSyntheticSystemThe authored system.
tDaysnumberThe instant, in the same day units as each body's periodDays and epoch.

Returns

Record<string, SyntheticPosition>

Position per body id (lonDeg, latDeg, r).

Example

const sys: SyntheticSystem = {
  id: "twin-moons",
  bodies: [
    { id: "fast", mode: "periodic", periodDays: 20, phaseDeg: 0 },
    { id: "slow", mode: "periodic", periodDays: 80, phaseDeg: 0 },
  ],
};
syntheticPositions(sys, 0).fast.lonDeg;  // 0
syntheticPositions(sys, 5).fast.lonDeg;  // 90  (a quarter of its 20-day period)

Start building

Quickstart →