@essrt/physics 1.5.0 → 1.6.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@essrt/physics",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "ESSRT (Expanding Solar System Resonance Theory) physics core \u2014 pure, injectable-constants, no I/O, no globals, no DOM. The complete model incl. fitted coefficients; every published version immutably ships one recorded model identity.",
5
5
  "essrt": {
6
6
  "modelVersion": "v11.0",
package/src/model.js CHANGED
@@ -783,7 +783,20 @@ export function assembleModel(C, F) {
783
783
  argsAt: /** @param {number} jdTT */ (jdTT) => moonArgs.argsAt(jdTT),
784
784
  eFactorForD: fwEFactor,
785
785
  eFactorAtJdTT: /** @param {number} jdTT */ (jdTT) => fwEFactor(jdTT - j2000JD),
786
- getMoonDistanceKm: () => moonDistanceKm,
786
+ // 20.3d(i): the Driver-1 ratio at the EVALUATED epoch (per-jd pure
787
+ // evaluator). MATCHED TRIPLE with the tools-lib and browser getters:
788
+ // identical age arithmetic — the SI-linear year (yearFromJD, never
789
+ // the calendar year: the recorded linear-vs-calendar mirror trap)
790
+ // against the MODEL-START anchor (startModelYearWithCorrection, the
791
+ // browser's J2000_CALENDAR_YEAR — NOT this model's 2000.0 yearToTMa
792
+ // convention: the 0.4977-yr difference is 4.95e-11 of distance and
793
+ // failed the bit-exact parity gate). Falls back to the J2000
794
+ // constant without a jd (legacy call shape) or past the domain.
795
+ getMoonDistanceKm: /** @param {number} [jdTT] */ (jdTT) => {
796
+ if (jdTT === undefined) return moonDistanceKm;
797
+ const d = moonDistanceMetresAtAge((startModelYearWithCorrection - yearFromJD(jdTT)) / 1e6);
798
+ return d === null ? moonDistanceKm : d / 1000;
799
+ },
787
800
  getEccentricityBase: () => C.moonReference.moonOrbitalEccentricityBase,
788
801
  deltaTSeconds: /** @param {number} jd */ (jd) => (jdTTFromUT(jd) - jd) * 86400,
789
802
  jdToSIyear: yearFromJD,
@@ -48,7 +48,7 @@
48
48
  * argsAt: (jdTT: number) => {Lp: number, D: number, M: number, Mp: number, F: number},
49
49
  * eFactorForD: (dDaysTT: number, T: number, T2: number) => number,
50
50
  * eFactorAtJdTT: (jdTT: number, T: number, T2: number) => number,
51
- * getMoonDistanceKm: () => number,
51
+ * getMoonDistanceKm: (jdTT?: number) => number,
52
52
  * getEccentricityBase: () => number,
53
53
  * deltaTSeconds: (jdUT: number) => number,
54
54
  * jdToSIyear: (jd: number) => number,
@@ -147,9 +147,17 @@ function createMoonSeries({ constants, fns }) {
147
147
  * @param {number} Dr @param {number} Mr @param {number} Mpr
148
148
  * @param {number} Fr @param {number} E @param {number} E2
149
149
  * @returns {number} km */
150
- function fullDistanceKm(Dr, Mr, Mpr, Fr, E, E2) {
150
+ // 20.3d(i): the Driver-1 ratio is evaluated AT THE EVALUATED EPOCH — the
151
+ // getter receives the evaluation jdTT so each engine can answer with its
152
+ // pure a_M(t) evaluator (per-jd deterministic; previously the browser
153
+ // answered with whatever epoch the render loop last set — a scene-state
154
+ // timing accident — while the Node engines pinned the J2000 constant).
155
+ // Engines whose getter ignores the argument keep their old behavior.
156
+ /** @param {number} Dr @param {number} Mr @param {number} Mpr @param {number} Fr
157
+ * @param {number} E @param {number} E2 @param {number} [jdTT] @returns {number} */
158
+ function fullDistanceKm(Dr, Mr, Mpr, Fr, E, E2, jdTT) {
151
159
  const Sr = sumTableCos(moonR, Dr, Mr, Mpr, Fr, E, E2);
152
- return (moonRMeanKm + Sr * 1e-3) * (getMoonDistanceKm() / moonDistanceJ2000Km);
160
+ return (moonRMeanKm + Sr * 1e-3) * (getMoonDistanceKm(jdTT) / moonDistanceJ2000Km);
153
161
  }
154
162
 
155
163
  /** The PRODUCTION scene evaluation at d days TT from J2000 (the caller
@@ -192,7 +200,7 @@ function createMoonSeries({ constants, fns }) {
192
200
  const fullSl = Sl + (2 * eocHalf / D2R * 1e6) * Math.sin(Mpr)
193
201
  + (1.25 * eocHalf * eocHalf / D2R * 1e6) * Math.sin(2 * Mpr);
194
202
  const lonDeg = Lp / D2R + fullSl * 1e-6 + moonMeeusLpCorrectionDeg;
195
- const distKm = fullDistanceKm(Dr, Mr, Mpr, Fr, E, E2);
203
+ const distKm = fullDistanceKm(Dr, Mr, Mpr, Fr, E, E2, j2000JD + d);
196
204
  return { thetaAddRad, lonDeg, latRad, latDeg, distKm, T };
197
205
  }
198
206
 
@@ -242,7 +250,7 @@ function createMoonSeries({ constants, fns }) {
242
250
  const args = argsAt(jdTT);
243
251
  const Dr = args.D * D2R, Mr = args.M * D2R, Mpr = args.Mp * D2R, Fr = args.F * D2R;
244
252
  const E = eFactorAtJdTT(jdTT, T, T * T);
245
- return fullDistanceKm(Dr, Mr, Mpr, Fr, E, E * E);
253
+ return fullDistanceKm(Dr, Mr, Mpr, Fr, E, E * E, jdTT);
246
254
  }
247
255
 
248
256
  return { sceneEvalAt, truncatedLonDeg, truncatedBetaDeg, truncatedDistanceKm, additionalArgs };