From ab7d454db1ab5914db404728280a700c71684f67 Mon Sep 17 00:00:00 2001 From: Senrokai Date: Thu, 24 Sep 2026 22:09:36 +0200 Subject: [PATCH] Read Mercury's obliquity in the arcminutes its Horizons page gives it in Mercury's page states "Obliquity to orbit[1] = 2.11' +/- 0.1'", in arcminutes, where every other page writes degrees. The pattern took the number alone, so bodies.json had Mercury tilted 2.11 degrees, sixty times too far, and the system view drew it that way. It now reads the arcminute mark and divides by 60: 0.0352 degrees, against the 0.034 the IAU's pole for Mercury makes with its orbit. Co-Authored-By: Claude Opus 5.5 (1M context) --- src/app/shared/astro/horizons-page.spec.ts | 9 ++++++++- src/app/shared/astro/horizons-page.ts | 9 +++++++-- src/assets/data/bodies.json | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/app/shared/astro/horizons-page.spec.ts b/src/app/shared/astro/horizons-page.spec.ts index 44938ef..ad1e141 100644 --- a/src/app/shared/astro/horizons-page.spec.ts +++ b/src/app/shared/astro/horizons-page.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { extractGmKm3PerS2, extractRadiusKm, extractRotationPeriodHours, isTidallyLocked } from './horizons-page'; +import { extractGmKm3PerS2, extractObliquityDeg, extractRadiusKm, extractRotationPeriodHours, isTidallyLocked } from './horizons-page'; // Lines as the Horizons pages print them. const JUPITER = ` Vol. Mean Radius (km) = 69911+-6 Flattening = 0.06487 @@ -57,3 +57,10 @@ describe('Horizons page GM', () => { expect(extractGmKm3PerS2(HYPERION)).toBeUndefined(); }); }); + +describe('Horizons page obliquity', () => { + it('reads the arcminutes Mercury gives its tilt in, and the degrees every other page uses', () => { + expect(extractObliquityDeg(" Obliquity to orbit[1] = 2.11' +/- 0.1' Hill's sphere rad. Rp = 94.4 ")).toBeCloseTo(2.11 / 60, 9); + expect(extractObliquityDeg(' Obliquity to orbit = 25.19 deg Max. angular diam. = 17.9"')).toBe(25.19); + }); +}); diff --git a/src/app/shared/astro/horizons-page.ts b/src/app/shared/astro/horizons-page.ts index 16cb634..0cf02d9 100644 --- a/src/app/shared/astro/horizons-page.ts +++ b/src/app/shared/astro/horizons-page.ts @@ -38,7 +38,8 @@ const ROTATION_PERIOD_PATTERNS = [ /Rotation(?:al)?\s*period[^=]*=\s*(-?[\d.]+)\s*(h|hr|hrs|d|day|days)\b/i ]; const SYNCHRONOUS_PATTERN = /Rotation(?:al)?\s*period\s*=?\s*:?\s*Synchronous/i; -const OBLIQUITY_PATTERN = /Obliquity\s*to\s*orbit[^=]*=\s*(-?[\d.]+)/i; +/** `25.19 deg` on most pages, `2.11' +/- 0.1'` in arcminutes on Mercury's. */ +const OBLIQUITY_PATTERN = /Obliquity\s*to\s*orbit[^=]*=\s*(-?[\d.]+)\s*(')?/i; /** `GM (km^3/s^2) = 106.10` on a moon's page, `GM (planet) km^3/s^2 = 869.326` on Pluto's. */ const GM_PATTERN = /GM\s*(?:\(planet\)\s*)?,?\s*\(?km\^3\/s\^2\)?\s*=\s*([\d.]+)/i; @@ -74,9 +75,13 @@ export function extractRotationPeriodHours(text: string): number | undefined { return undefined; } +/** + * Tilt of the rotation axis from the orbit, in degrees. Mercury's page gives its tilt in + * arcminutes, which read as degrees made it 2.11 where the IAU's pole puts it at 0.034. + */ export function extractObliquityDeg(text: string): number | undefined { const match = text.match(OBLIQUITY_PATTERN); - return match ? Number(match[1]) : undefined; + return match ? Number(match[1]) / (match[2] ? 60 : 1) : undefined; } /** diff --git a/src/assets/data/bodies.json b/src/assets/data/bodies.json index db4912e..e929fd3 100644 --- a/src/assets/data/bodies.json +++ b/src/assets/data/bodies.json @@ -24,7 +24,7 @@ }, "orbitSource": "JPL approximate mean elements (Standish), fit for 3000 BC to AD 3000", "rotationPeriodHours": 1407.512239412851, - "obliquityDeg": 2.11 + "obliquityDeg": 0.035166666666666666 }, { "id": "venus",