@essrt/physics 20.0.0 → 21.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +4 -4
  2. package/package.json +3 -8
  3. package/src/cardinal/one-source-structure.cjs +3 -2
  4. package/src/chain-cycles/index.cjs +12 -30
  5. package/src/constants/coefficients.d.ts +16 -92
  6. package/src/constants/coefficients.js +5 -21
  7. package/src/constants/generated.d.ts +12 -16
  8. package/src/constants/generated.js +21 -25
  9. package/src/deltat/deep-time.cjs +36 -92
  10. package/src/deltat/recession-history.cjs +2 -1
  11. package/src/earth/deep-orbital-history.cjs +4 -4
  12. package/src/earth/precession-composed.cjs +3 -3
  13. package/src/earth/year-lengths.cjs +16 -1
  14. package/src/eclipse/sun-planetary-completion.cjs +11 -12
  15. package/src/index.js +22 -46
  16. package/src/layer0/derive-params.js +10 -5
  17. package/src/layer0/index.js +27 -73
  18. package/src/layer1/index.js +6 -37
  19. package/src/model.js +190 -215
  20. package/src/moon/arguments.cjs +57 -83
  21. package/src/moon/deep-modes-artifact.cjs +2 -2
  22. package/src/moon/month-chain.cjs +25 -59
  23. package/src/moon/series.cjs +9 -5
  24. package/src/phase/deep-calendar.cjs +35 -80
  25. package/src/planets/chain-artifact.js +2 -2
  26. package/src/planets/geometry.cjs +52 -23
  27. package/src/planets/model.cjs +5 -5
  28. package/types/chain-cycles/index.d.cts +9 -4
  29. package/types/constants/coefficients.d.ts +16 -92
  30. package/types/constants/generated.d.ts +12 -16
  31. package/types/deltat/deep-time.d.cts +3 -16
  32. package/types/earth/year-lengths.d.cts +12 -0
  33. package/types/eclipse/sun-planetary-completion.d.cts +0 -9
  34. package/types/index.d.ts +2 -12
  35. package/types/layer0/derive-params.d.ts +7 -4
  36. package/types/layer0/index.d.ts +6 -13
  37. package/types/layer1/index.d.ts +0 -2
  38. package/types/model.d.ts +14 -11
  39. package/types/moon/arguments.d.cts +23 -22
  40. package/types/moon/deep-modes-artifact.d.cts +3 -3
  41. package/types/moon/month-chain.d.cts +7 -16
  42. package/types/moon/series.d.cts +2 -2
  43. package/types/phase/deep-calendar.d.cts +14 -50
  44. package/types/planets/geometry.d.cts +27 -11
  45. package/types/planets/model.d.cts +9 -3
  46. package/src/cardinal/index.cjs +0 -324
  47. package/src/moon/ecc-channel.cjs +0 -141
  48. package/src/phase/index.cjs +0 -186
  49. package/src/planets/ecc-channel.cjs +0 -59
  50. package/src/sun/longitude-correction.cjs +0 -68
  51. package/types/cardinal/index.d.cts +0 -80
  52. package/types/moon/ecc-channel.d.cts +0 -30
  53. package/types/phase/index.d.cts +0 -38
  54. package/types/planets/ecc-channel.d.cts +0 -20
  55. package/types/sun/longitude-correction.d.cts +0 -41
@@ -1,59 +0,0 @@
1
- /**
2
- * Planet eccentricity channel — THE shared implementation (Phase 8.3, L3).
3
- * The law-of-cosines oscillation every body's runtime eccentricity rides
4
- * (Earth on H/16, each planet on its OWN wobble period — S-P1):
5
- *
6
- * e(t) = √(base² + amp² − 2·base·amp·cos θ), θ = 2π·N·∫1/H dt
7
- *
8
- * — the distance between two circular orbits (body orbits the wobble
9
- * centre at radius amp; the centre orbits the Sun at radius base).
10
- *
11
- * Extracted from src/script.js computeEccentricityEarth (the browser's
12
- * 5-arg generic form) and tools/lib/orbital-engine.js computeEccentricity
13
- * (identical law; R6 aligned its phase to integrated). The structural twin
14
- * of moon/ecc-channel — but a DIFFERENT law (H/16 orbit law vs the Moon
15
- * channel's H/3 line; doc 66 keeps the two deliberately distinct).
16
- *
17
- * Engine null/toggle semantics stay ENGINE-SIDE, deliberately:
18
- * - the browser's cyclesBetween carries its DEEP_TIME_MODE toggle and maps
19
- * null (past tidal lock) → the MEAN eccentricity;
20
- * - the Node engine pre-computes its snapshot cycles and keeps them when
21
- * the integrated phase is null (its documented R6 flag polarity).
22
- * Both call the same law; the dispatch difference is recorded here so
23
- * nobody "unifies" it without measuring.
24
- */
25
-
26
- 'use strict';
27
-
28
- /**
29
- * The law of cosines over resolved cycles. null cycles → the MEAN
30
- * eccentricity √(base² + amp²) (past the tidal-lock asymptote).
31
- * @param {number | null} cycles @param {number} base @param {number} amplitude
32
- * @returns {number} */
33
- function eccentricityFromCycles(cycles, base, amplitude) {
34
- if (cycles === null) {
35
- return Math.sqrt(base * base + amplitude * amplitude);
36
- }
37
- const phase = cycles * 2 * Math.PI;
38
- return Math.sqrt(
39
- base * base + amplitude * amplitude - 2 * base * amplitude * Math.cos(phase)
40
- );
41
- }
42
-
43
- /**
44
- * Browser-convention evaluator: J2000-FIXED anchor + cycle length, divisor
45
- * N = H_J2000/cycleLength, integrated phase via the injected engine
46
- * cyclesBetween (toggle semantics ride along), null → mean.
47
- * @param {number} currentYear @param {number} anchorYearJ2000
48
- * @param {number} cycleLengthYearsJ2000 @param {number} base
49
- * @param {number} amplitude
50
- * @param {{ holisticYearJ2000: number,
51
- * cyclesBetween: (yearA: number, yearB: number, divisorN: number) => (number | null) }} env
52
- * @returns {number} */
53
- function computeEccentricityIntegrated(currentYear, anchorYearJ2000, cycleLengthYearsJ2000, base, amplitude, env) {
54
- const divisorN = env.holisticYearJ2000 / cycleLengthYearsJ2000;
55
- const cycles = env.cyclesBetween(anchorYearJ2000, currentYear, divisorN);
56
- return eccentricityFromCycles(cycles, base, amplitude);
57
- }
58
-
59
- module.exports = { eccentricityFromCycles, computeEccentricityIntegrated };
@@ -1,68 +0,0 @@
1
- /**
2
- * Sun longitude correction — the fitted H-lattice harmonic stack
3
- * (Phase 9, S-P8). THE shared evaluator behind what were THREE verbatim
4
- * copies: the browser's sunLongitudeCorrection and two inline blocks in
5
- * tools/lib/scene-graph (moveModel and the fast animator).
6
- *
7
- * The ~200″→~7″ RMS Sun-only correction (Phase Z-B): a fitted harmonic
8
- * table on H-lattice divisors, with the H-LATTICE FILTER applied at
9
- * evaluation — a divisor is structurally on-lattice iff EITHER
10
- * (a) it is a year-multiple of H (integer year period), OR
11
- * (b) it is a small precession divisor (1..20 — Earth's Fibonacci
12
- * named cycles H/3, H/5, H/8, H/13, H/16, …), OR
13
- * (c) it is one of the two lunar precession divisors (auto-tracked
14
- * from the Meeus anchors).
15
- * Divisors failing all three are design-rule violating and silently
16
- * skipped. (Clause (d) "sharesFactorWithH" was removed 2026-07-15 — it
17
- * admitted mid-range fit artifacts, divisors 84/92/115/122, that are
18
- * not physically motivated. See tools/fit/sun-longitude-harmonics.js.)
19
- *
20
- * MATCHED PAIR: every dep is the J2000-FIXED value — the table was
21
- * fitted against J2000 H and mSY (the Node engines' documented
22
- * convention). The browser copy historically read the MUTABLE
23
- * holisticyearLength/balancedYear globals; measured divergence under
24
- * epoch shift was 8.2e-10 deg (~3 µas) — aligned onto the fitted
25
- * convention at extraction (9-1), zero fixture drift.
26
- *
27
- * The engines own the application (θ −= corr·d2r on the Sun node only)
28
- * and their enable flags.
29
- */
30
-
31
- 'use strict';
32
-
33
- /**
34
- * @typedef {Object} SunLongitudeCorrectionDeps
35
- * @property {number} hYears - H, J2000-fixed (the fitted axis)
36
- * @property {number} balancedYear - J2000-fixed
37
- * @property {number} j2000JD
38
- * @property {number} meanDeg - the fitted mean offset
39
- * @property {Array<[number, number, number]>} harmonics - [divisor, sinC, cosC]
40
- * @property {number} nNodalJ2000 - lunar nodal divisor (per 8H convention)
41
- * @property {number} nApsidalJ2000 - lunar apsidal divisor
42
- */
43
-
44
- /** @param {SunLongitudeCorrectionDeps} deps */
45
- function createSunLongitudeCorrection(deps) {
46
- /** Correction in DEGREES at JD (subtract from the raw Sun longitude).
47
- * @param {number} jd @returns {number} */
48
- function correctionDegAt(jd) {
49
- const year = 2000 + (jd - deps.j2000JD) / 365.25;
50
- const t = year - deps.balancedYear;
51
- let corr = deps.meanDeg;
52
- const H_round = Math.round(deps.hYears);
53
- for (const h of deps.harmonics) {
54
- const divisor = h[0];
55
- const isYearMultiple = divisor >= H_round && divisor % H_round === 0;
56
- const isPrecessionDivisor = divisor > 0 && divisor <= 20;
57
- const isLunarPrecession = divisor === deps.nNodalJ2000 || divisor === deps.nApsidalJ2000;
58
- if (!isYearMultiple && !isPrecessionDivisor && !isLunarPrecession) continue;
59
- const phase = 2 * Math.PI * t / (deps.hYears / divisor);
60
- corr += h[1] * Math.sin(phase) + h[2] * Math.cos(phase);
61
- }
62
- return corr;
63
- }
64
-
65
- return { correctionDegAt };
66
- }
67
-
68
- module.exports = { createSunLongitudeCorrection };
@@ -1,80 +0,0 @@
1
- export type DerivedCoefs = {
2
- lincoef: number;
3
- h0: number;
4
- h1: number;
5
- };
6
- export type EccTerm = {
7
- order: number;
8
- sin: number;
9
- cos: number;
10
- };
11
- export type JointTerm = {
12
- order: number;
13
- div: number;
14
- sin: number;
15
- cos: number;
16
- };
17
- /** @typedef {{ lincoef: number, h0: number, h1: number }} DerivedCoefs */
18
- /** @typedef {{ order: number, sin: number, cos: number }} EccTerm */
19
- /** @typedef {{ order: number, div: number, sin: number, cos: number }} JointTerm */
20
- /**
21
- * @param {{
22
- * isDeepTime: () => boolean,
23
- * constants: {
24
- * anchors: Record<string, number>,
25
- * harmonics: Record<string, Array<[number, number, number]>>,
26
- * eccTerms: (Record<string, EccTerm[]> | null),
27
- * jointTerms: ({ terms: JointTerm[] } | null),
28
- * derived: (DerivedCoefs | null),
29
- * tropicalHarmonics: Array<[number, number, number]>,
30
- * balancedYear: number,
31
- * meanSolarYearDays: number,
32
- * hJ2000: number,
33
- * tiltMeanDeg: number,
34
- * raAngleDeg: number,
35
- * inclAmplitudeDeg: number,
36
- * },
37
- * fns: {
38
- * cyclesBetween: (yearA: number, yearB: number, divisorN: number) => (number | null),
39
- * analyticTropicalDays: (year: number) => (number | null),
40
- * meanHAtAgeMa: (tMa: number) => (number | null),
41
- * meanYearRealLodDays: (tMa: number) => (number | null),
42
- * eccentricityAt: (year: number) => number,
43
- * eccentricityRateAt: (year: number) => number,
44
- * },
45
- * }} deps
46
- */
47
- export function createCardinalModel({ isDeepTime, constants, fns }: {
48
- isDeepTime: () => boolean;
49
- constants: {
50
- anchors: Record<string, number>;
51
- harmonics: Record<string, Array<[number, number, number]>>;
52
- eccTerms: (Record<string, EccTerm[]> | null);
53
- jointTerms: ({
54
- terms: JointTerm[];
55
- } | null);
56
- derived: (DerivedCoefs | null);
57
- tropicalHarmonics: Array<[number, number, number]>;
58
- balancedYear: number;
59
- meanSolarYearDays: number;
60
- hJ2000: number;
61
- tiltMeanDeg: number;
62
- raAngleDeg: number;
63
- inclAmplitudeDeg: number;
64
- };
65
- fns: {
66
- cyclesBetween: (yearA: number, yearB: number, divisorN: number) => (number | null);
67
- analyticTropicalDays: (year: number) => (number | null);
68
- meanHAtAgeMa: (tMa: number) => (number | null);
69
- meanYearRealLodDays: (tMa: number) => (number | null);
70
- eccentricityAt: (year: number) => number;
71
- eccentricityRateAt: (year: number) => number;
72
- };
73
- }): {
74
- computeSolsticeJD: (year: number, type?: string) => number;
75
- computeSolsticeYearLength: (year: number, type?: string) => number;
76
- computeSolsticeRA: (year: number, type?: string) => number;
77
- computeTropicalYearLength: (year: number) => number;
78
- };
79
- /** @type {Record<string, number>} */
80
- export const JOINT_LAMBDA: Record<string, number>;
@@ -1,30 +0,0 @@
1
- /**
2
- * @param {{
3
- * cyclesBetween: (yearA: number, yearB: number, divisorN: number) => (number | null),
4
- * eccentricityBase: number,
5
- * eccentricityJ2000?: number,
6
- * perihelionLongitudeJ2000Deg: number,
7
- * inclinationCycleAnchorDeg: number,
8
- * }} deps — cyclesBetween MUST be the engine's own H-lattice phase counter
9
- * (integrated under deep time); perihelionLongitudeJ2000Deg is ϖ_ICRF at
10
- * J2000 (102.94719°, the FULL value — a truncated copy once cost 0.684″);
11
- * inclinationCycleAnchorDeg is the H/3 inclination anchor (21.77°).
12
- */
13
- export function createMoonEccChannel({ cyclesBetween, eccentricityBase, perihelionLongitudeJ2000Deg, inclinationCycleAnchorDeg, eccentricityJ2000, }: {
14
- cyclesBetween: (yearA: number, yearB: number, divisorN: number) => (number | null);
15
- eccentricityBase: number;
16
- eccentricityJ2000?: number;
17
- perihelionLongitudeJ2000Deg: number;
18
- inclinationCycleAnchorDeg: number;
19
- }): {
20
- eccAt: (tYr: number) => number;
21
- eccRateAt: (tYr: number) => number;
22
- modulation: (tMa: number, s: number) => number;
23
- channelIntegral: (T: number, s: number) => number;
24
- eFactorAt: (tYr: number) => number;
25
- th0: number;
26
- amplitude: number;
27
- mean: number;
28
- e0: number;
29
- g0: number;
30
- };
@@ -1,38 +0,0 @@
1
- /**
2
- * @param {{
3
- * holisticHAtAgeMa: (tMa: number) => (number | null),
4
- * tableAnchorYear: number,
5
- * driftRefYear: number,
6
- * hJ2000: number,
7
- * yearMin?: number,
8
- * yearMax?: number,
9
- * stepYears?: number,
10
- * }} cfg — holisticHAtAgeMa MUST be the lattice-α form; tableAnchorYear is
11
- * startmodelYear (2000.5, table zero + t_Ma convention); driftRefYear is
12
- * startModelYearWithCorrection (the R3 drift anchor); hJ2000 the snapshot
13
- * rate the drift compares against; 10-kyr cells match both engines'
14
- * historic tables.
15
- */
16
- export function createPhaseMachinery({ holisticHAtAgeMa, tableAnchorYear, driftRefYear, hJ2000, yearMin, yearMax, stepYears, }: {
17
- holisticHAtAgeMa: (tMa: number) => (number | null);
18
- tableAnchorYear: number;
19
- driftRefYear: number;
20
- hJ2000: number;
21
- yearMin?: number;
22
- yearMax?: number;
23
- stepYears?: number;
24
- }): {
25
- ensureTable: () => void;
26
- cumulAtYear: (year: number) => number | null;
27
- integralBetween: (yearA: number, yearB: number) => number | null;
28
- j2000Drift: (yearA: number) => number;
29
- cyclesBetween: (yearA: number, yearB: number, divisorN: number) => number | null;
30
- yearAtCumul: (targetCumul: number) => number | null;
31
- grid: () => {
32
- yearMin: number;
33
- yearMax: number;
34
- stepYears: number;
35
- j2000Idx: number;
36
- length: number;
37
- };
38
- };
@@ -1,20 +0,0 @@
1
- /**
2
- * The law of cosines over resolved cycles. null cycles → the MEAN
3
- * eccentricity √(base² + amp²) (past the tidal-lock asymptote).
4
- * @param {number | null} cycles @param {number} base @param {number} amplitude
5
- * @returns {number} */
6
- export function eccentricityFromCycles(cycles: number | null, base: number, amplitude: number): number;
7
- /**
8
- * Browser-convention evaluator: J2000-FIXED anchor + cycle length, divisor
9
- * N = H_J2000/cycleLength, integrated phase via the injected engine
10
- * cyclesBetween (toggle semantics ride along), null → mean.
11
- * @param {number} currentYear @param {number} anchorYearJ2000
12
- * @param {number} cycleLengthYearsJ2000 @param {number} base
13
- * @param {number} amplitude
14
- * @param {{ holisticYearJ2000: number,
15
- * cyclesBetween: (yearA: number, yearB: number, divisorN: number) => (number | null) }} env
16
- * @returns {number} */
17
- export function computeEccentricityIntegrated(currentYear: number, anchorYearJ2000: number, cycleLengthYearsJ2000: number, base: number, amplitude: number, env: {
18
- holisticYearJ2000: number;
19
- cyclesBetween: (yearA: number, yearB: number, divisorN: number) => (number | null);
20
- }): number;
@@ -1,41 +0,0 @@
1
- export type SunLongitudeCorrectionDeps = {
2
- /**
3
- * - H, J2000-fixed (the fitted axis)
4
- */
5
- hYears: number;
6
- /**
7
- * - J2000-fixed
8
- */
9
- balancedYear: number;
10
- j2000JD: number;
11
- /**
12
- * - the fitted mean offset
13
- */
14
- meanDeg: number;
15
- /**
16
- * - [divisor, sinC, cosC]
17
- */
18
- harmonics: Array<[number, number, number]>;
19
- /**
20
- * - lunar nodal divisor (per 8H convention)
21
- */
22
- nNodalJ2000: number;
23
- /**
24
- * - lunar apsidal divisor
25
- */
26
- nApsidalJ2000: number;
27
- };
28
- /**
29
- * @typedef {Object} SunLongitudeCorrectionDeps
30
- * @property {number} hYears - H, J2000-fixed (the fitted axis)
31
- * @property {number} balancedYear - J2000-fixed
32
- * @property {number} j2000JD
33
- * @property {number} meanDeg - the fitted mean offset
34
- * @property {Array<[number, number, number]>} harmonics - [divisor, sinC, cosC]
35
- * @property {number} nNodalJ2000 - lunar nodal divisor (per 8H convention)
36
- * @property {number} nApsidalJ2000 - lunar apsidal divisor
37
- */
38
- /** @param {SunLongitudeCorrectionDeps} deps */
39
- export function createSunLongitudeCorrection(deps: SunLongitudeCorrectionDeps): {
40
- correctionDegAt: (jd: number) => number;
41
- };