# J2 Orbit Explorer — Cloudflare Pages edition

## Upload in a few clicks
1. Open Cloudflare dashboard → Workers & Pages → Create application.
2. Select Pages → Drag and drop your files.
3. Choose a project name, upload `J2_cloudflare_ready.zip`, then Deploy site.
4. Open the assigned https://YOUR-PROJECT.pages.dev URL.

For an existing Direct Upload Pages project, use Create a new deployment →
Production, then upload this ZIP. Its address stays the same. No build command,
Python server, API key or paid backend is needed. All dependencies are bundled.
The ZIP has index.html at its root; upload it directly, not the original .7z.

For Git deployment, commit the extracted files; select no framework, leave the
build command empty and use `.` as the build output directory.

Local preview: extract the ZIP and run `python -m http.server 8000` in that
folder, then visit http://localhost:8000. Opening index.html via file:// does
not work reliably because this app uses browser JavaScript modules.

## What was carried over
The uploaded J2_live.py supplies the defaults: 600 km semimajor-axis altitude,
e=0.01, i=55°, RAAN=20°, AoP=30°, true anomaly=0°, duration=365 days,
rtol=1e-10, atol=1e-12. The same central-gravity plus Cartesian J2 acceleration
and Earth constants are used. RAAN is internally unwrapped and optionally
wrapped to 0–360° for display, with gaps at wrap crossings and automatic y scaling.
The secular estimate uses the initial osculating elements and is approximate.

The uploaded Python speed control had a minimum of 0.05 minutes/frame, so the
requested 0.032 value was clamped. The web app uses a frame-rate-independent
playback multiplier, starting at 60× (one simulated minute per real second).
Adjust Playback × live. At high speeds, the spacecraft skips orbital phases.
Background tabs pause advancement; frame gaps above 0.1 s are capped to avoid
large jumps. The duration control supports 1–3650 days and resets the run.

Blue is the current osculating ellipse, gray the initial ellipse, gold the recent
numerical path, red the spacecraft, purple the ascending-node direction. The
current ellipse is not a future J2 trajectory. ECI axes remain inertial while
the spherical Earth mesh rotates at the sidereal rate. Initial Greenwich angle
is illustrative. This model contains no drag, thrust, third bodies or lifetime
prediction. Perigee must be above Earth; equatorial RAAN is undefined.

## Implementation and verification
- Three.js/WebGL renders the 3D scene; the browser chooses the graphics device.
  Its reported renderer is shown below the app. Enable browser hardware
  acceleration for GPU use. SVG renders the small RAAN chart and its labels.
- JavaScript adaptive Dormand–Prince 5(4) replaces desktop SciPy DOP853; this is
  a numerical propagation, not animation driven by secular RAAN equations.
- Integration runs on the CPU. Tolerances and initial elements can be changed
  under Initial orbit and integration settings → Apply & restart.
- Numerical steps are capped at 30 seconds. RAAN history is initially sampled
  every 30 seconds, then thinned as needed to bound memory (about 12,000 points).
  The graph renders up to about 2,000 points plus the current endpoint. Thus a
  long run shows secular drift but cannot preserve every short-period oscillation.
- Compared with SciPy DOP853 at tighter tolerances over one day: final position
  difference 0.000556 km, RAAN change -4.204017886°, J2-off RAAN change below
  1e-8°. Syntax and bundled dependencies checked. Multi-year accuracy is not
  established by this one-day check; perform convergence studies for research.
- No live browser/GPU visual test or actual Cloudflare deployment was performed
  in the development environment.

Files: physics.js is the independent numerical core; app.js contains graphics,
controls and graph; index.html and style.css define the interface. Edit defaults
in physics.js; the HTML contains default playback and duration control values.

## Credits
Bundled unchanged: NASA Earth Observatory Blue Marble: Next Generation,
January 2004 with Topography, 5400 × 2700 pixels.
https://science.nasa.gov/earth/earth-observatory/blue-marble-next-generation/base-topography/
Three.js 0.169.0 and OrbitControls: MIT license included in vendor/.

Cloudflare instructions:
https://developers.cloudflare.com/pages/get-started/direct-upload/

## Controls update
Pause/Resume, Reset, North-pole view and Reset view now sit in a sticky toolbar
above the plots. Slower and Faster halve/double the playback speed; Speed × also
accepts direct entry from 0.1 to 72000. At 1×, one simulated second passes per
real second when computation keeps up. Reset restarts time with the current
model settings. Camera changes do not restart the propagation.
