Phase 0: fix typecheck, format, build; remove stray emit; pin port via env
CI / Lint, typecheck, test, build (push) Failing after 22s
CI / Lint, typecheck, test, build (push) Failing after 22s
This commit is contained in:
@@ -1,9 +1,4 @@
|
||||
export { solveKepler } from './kepler.js';
|
||||
export {
|
||||
meanMotion,
|
||||
propagateToEpoch,
|
||||
positionAt,
|
||||
sampleOrbit,
|
||||
} from './propagate.js';
|
||||
export { meanMotion, propagateToEpoch, positionAt, sampleOrbit } from './propagate.js';
|
||||
export { shadowFraction } from './occultation.js';
|
||||
export { phaseAngle, hohmannDeltaV, findTransferWindows } from './transfer.js';
|
||||
|
||||
@@ -41,13 +41,8 @@ export function shadowFraction(
|
||||
const perpDist = Math.hypot(px, py, pz);
|
||||
|
||||
if (perpDist >= occluderRadius) return 0;
|
||||
// Approximate chord length through the occluder disc
|
||||
const halfChord = Math.sqrt(occluderRadius * occluderRadius - perpDist * perpDist);
|
||||
// Approximate the angular size of the sun as seen from the occluder
|
||||
// vs the angular size of the occluder; we use 1.0 for the sun
|
||||
// (i.e. effectively point source) — good enough for visualization.
|
||||
// For a "fraction in shadow" treat the occluder disc as fully shadowing
|
||||
// when perpDist + halfChord reaches the observer; that simplifies to
|
||||
// perpDist < occluderRadius which we already check.
|
||||
return Math.min(1, 1 - perpDist / occluderRadius);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { KeplerianElements, CelestialBody } from '@kerbal-rt/shared-types';
|
||||
import type { KeplerianElements } from '@kerbal-rt/shared-types';
|
||||
import { solveKepler } from './kepler.js';
|
||||
|
||||
const TWO_PI = Math.PI * 2;
|
||||
@@ -89,10 +89,8 @@ export function positionAt(
|
||||
const cosw = Math.cos(w);
|
||||
const sinw = Math.sin(w);
|
||||
|
||||
const x =
|
||||
(cosO * cosw - sinO * sinw * cosi) * xP + (-cosO * sinw - sinO * cosw * cosi) * yQ;
|
||||
const y =
|
||||
(sinO * cosw + cosO * sinw * cosi) * xP + (-sinO * sinw + cosO * cosw * cosi) * yQ;
|
||||
const x = (cosO * cosw - sinO * sinw * cosi) * xP + (-cosO * sinw - sinO * cosw * cosi) * yQ;
|
||||
const y = (sinO * cosw + cosO * sinw * cosi) * xP + (-sinO * sinw + cosO * cosw * cosi) * yQ;
|
||||
const z = sinw * sini * xP + cosw * sini * yQ;
|
||||
|
||||
return { x, y, z };
|
||||
@@ -105,7 +103,7 @@ export function positionAt(
|
||||
*/
|
||||
export function sampleOrbit(
|
||||
elements: KeplerianElements,
|
||||
mu: number,
|
||||
_mu: number,
|
||||
steps: number = 128,
|
||||
): { x: number; y: number; z: number }[] {
|
||||
const points: { x: number; y: number; z: number }[] = [];
|
||||
@@ -130,10 +128,8 @@ export function sampleOrbit(
|
||||
const r = (a * (1 - e * e)) / (1 + e * cosNu);
|
||||
const xP = r * cosNu;
|
||||
const yQ = r * sinNu;
|
||||
const x =
|
||||
(cosO * cosw - sinO * sinw * cosi) * xP + (-cosO * sinw - sinO * cosw * cosi) * yQ;
|
||||
const y =
|
||||
(sinO * cosw + cosO * sinw * cosi) * xP + (-sinO * sinw + cosO * cosw * cosi) * yQ;
|
||||
const x = (cosO * cosw - sinO * sinw * cosi) * xP + (-cosO * sinw - sinO * cosw * cosi) * yQ;
|
||||
const y = (sinO * cosw + cosO * sinw * cosi) * xP + (-sinO * sinw + cosO * cosw * cosi) * yQ;
|
||||
const z = sinw * sini * xP + cosw * sini * yQ;
|
||||
points.push({ x, y, z });
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { KeplerianElements, CelestialBody } from '@kerbal-rt/shared-types';
|
||||
import type { KeplerianElements } from '@kerbal-rt/shared-types';
|
||||
import { meanMotion } from './propagate.js';
|
||||
|
||||
const TWO_PI = Math.PI * 2;
|
||||
@@ -79,7 +79,6 @@ export function findTransferWindows(
|
||||
|
||||
const results: { ut: number; phaseAngle: number }[] = [];
|
||||
const stepSec = 3600; // 1h steps for the coarse scan
|
||||
const nA = meanMotion(from.elements.semiMajorAxis, from.mu);
|
||||
|
||||
for (let t = ut; t < ut + maxSearchTime && results.length < count; t += stepSec) {
|
||||
const phase = phaseAngle(from.elements, from.mu, to.elements, to.mu, t);
|
||||
|
||||
Reference in New Issue
Block a user