astro.Function.spinOrbitResonance - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki

@elite-dangerous-almanac/core / astro / spinOrbitResonance

Function: spinOrbitResonance()

spinOrbitResonance(body): SpinOrbitResonance | null

Defined in: src/astro/body-orbit.ts:175

The simple whole-number resonance between a body's spin and its orbit, when there is one.

Parameters

body

BodyProperties

The body. Needs RotationPeriod and OrbitalPeriod. Both are seconds, and only their ratio matters.

Returns

SpinOrbitResonance | null

The resonance, or null when either period is missing or the ratio is not close to any simple one — most bodies are in no resonance at all.

Remarks

A body in a spin-orbit resonance turns a whole number of times for a whole number of orbits. 1:1 is tidal locking — one face kept to the primary, which the scan also reports as TidalLock — and 3:2 is the next most common, the resonance Mercury sits in.

Both terms are searched up to 5, and a ratio counts as a resonance when it lands within 1% of it. A retrograde rotation is written as a negative period; the resonance is a ratio of magnitudes, so a retrograde tidally-locked body still reads 1:1.

Throws

If body is not an object.

Example

import { spinOrbitResonance } from '@elite-dangerous-almanac/core/astro/body-orbit';

// One rotation per orbit: tidally locked.
spinOrbitResonance({ RotationPeriod: 86400, OrbitalPeriod: 86400 }); // -> { rotations: 1, orbits: 1 }

// Mercury: three rotations every two orbits.
spinOrbitResonance({ RotationPeriod: 5067360, OrbitalPeriod: 7600544 }); // -> { rotations: 3, orbits: 2 }

spinOrbitResonance({ RotationPeriod: 86400, OrbitalPeriod: 271828 }); // -> null
⚠️ **GitHub.com Fallback** ⚠️