The Silent Travelers of the Inner Solar System
Hollywood taught generations of moviegoers that asteroids travel with roaring jet engines and flaming tails through the vacuum of space, usually aiming directly for major metropolitan monuments.
The astronomical reality is both quieter and mathematically more fascinating. Millions of silent, untextured cosmic rocks have been drifting through the void for 4.6 billion years, bound to invisible orbital tracks dictated by Isaac Newton and Johannes Kepler at blistering speeds of 30 kilometers per second.
NASA's Jet Propulsion Laboratory (JPL) tracks thousands of these Near-Earth Objects (NEOs). The telemetry is publicly accessible through open APIs, but staring at a 5,000-line JSON array of floating-point orbital elements is not exactly the most thrilling way to appreciate planetary defense.
When the NASA Space Apps Challenge 2025 kicked off, I set out to solve that problem:
"What if anyone could open their browser, grab the controls of a 3D celestial cockpit, and watch real-time asteroid trajectories skimming past Earth at 60 frames per second?"
That exploration became the Near Earth Object Simulator, an interactive WebGL project that earned a Global Nominee award.
1. Bridging Raw NASA Telemetry to Real-Time 3D
NASA's Center for Near-Earth Object Studies (CNEOS) provides rich astrometric datasets. However, the API returns cold, tabular geometry parameters rather than ready-made 3D coordinates:
| Orbital Element | Symbol | Physical Meaning | WebGL Translation |
|---|---|---|---|
| Semi-Major Axis | Average distance from the Sun (AU) | Major radius of elliptical orbit curve | |
| Eccentricity | Orbit elongation () | Focal offset and minor axis flattening | |
| Inclination | Tilt relative to the ecliptic plane (deg) | X-axis 3D Euler rotation matrix | |
| Longitude of Node | Horizontal swivel point of orbit (deg) | Z-axis nodal rotation | |
| Argument of Perihelion | Angle from node to closest approach (deg) | In-plane orbital ellipse rotation | |
| Mean Anomaly | Fraction of orbit completed since perihelion | Time-dependent position resolver |
Turning these static parameters into an interactive simulation requires solving orbital mechanics in real time inside a browser render loop.
2. Keplerian Mechanics in WebGL
Because planetary orbits are ellipses rather than neat circles, placing an asteroid at its true physical location for any given timestamp requires solving Kepler's classic equation.
Step 1: Wrestling with Kepler's Transcendental Equation
First, we solve for the Eccentric Anomaly () from the Mean Anomaly () and eccentricity ():
MATHEMATICAL MODEL
LaTeXJohannes Kepler left us with an equation that cannot be solved algebraically. To get around this 400-year-old mathematical annoyance in JavaScript, we use Newton-Raphson numerical iteration until the error converges below :
⟨/⟩TYPESCRIPT
9 lines1
function solveKepler(M: number, e: number, tolerance: number = 1e-6): number {
2
let E = M;
3
let delta = 1;
4
while (Math.abs(delta) > tolerance) {
5
delta = (E - e * Math.sin(E) - M) / (1 - e * Math.cos(E));
6
E -= delta;
7
}
8
return E;
9
}Step 2: 2D Orbital Coordinates to 3D Heliocentric Space
Once is determined, we compute the coordinates in the 2D orbital plane :
MATHEMATICAL MODEL
LaTeXMATHEMATICAL MODEL
LaTeXFinally, we apply rotational Gaussian vectors ( and ) derived from Euler angles to transform the 2D plane into full 3D Cartesian space in Three.js:
⟨/⟩TYPESCRIPT
43 lines1
// Heliocentric 3D coordinates calculation using Keplerian orbital elements2
function calculateOrbitalPosition(
3
a: number, // Semi-major axis (AU)
4
e: number, // Eccentricity
5
i: number, // Inclination (degrees)
6
omega: number, // Argument of perihelion (degrees)
7
Omega: number, // Longitude of ascending node (degrees)
8
E: number // Eccentric Anomaly (radians)
9
): [number, number, number] {
10
// 1. Orbital plane coordinates (2D)
11
const xPrime = a * (Math.cos(E) - e);
12
const yPrime = a * Math.sqrt(1 - e * e) * Math.sin(E);
13
14
// 2. Convert Euler angles to radians
15
const radI = (i * Math.PI) / 180;
16
const radOmega = (omega * Math.PI) / 180;
17
const radNode = (Omega * Math.PI) / 180;
18
19
// Precompute trigonometric terms
20
const cosNode = Math.cos(radNode);
21
const sinNode = Math.sin(radNode);
22
const cosOmega = Math.cos(radOmega);
23
const sinOmega = Math.sin(radOmega);
24
const cosI = Math.cos(radI);
25
const sinI = Math.sin(radI);
26
27
// 3. Transformation matrix elements (Gaussian vectors P and Q)
28
const Px = cosNode * cosOmega - sinNode * sinOmega * cosI;
29
const Qx = -cosNode * sinOmega - sinNode * cosOmega * cosI;
30
31
const Py = sinNode * cosOmega + cosNode * sinOmega * cosI;
32
const Qy = -sinNode * sinOmega + cosNode * cosOmega * cosI;
33
34
const Pz = sinOmega * sinI;
35
const Qz = cosOmega * sinI;
36
37
// 4. Rotate into 3D Heliocentric Cartesian space (AU)
38
const x = xPrime * Px + yPrime * Qx;
39
const y = xPrime * Py + yPrime * Qy;
40
const z = xPrime * Pz + yPrime * Qz;
41
42
return [x, y, z];
43
}3. Designing the Celestial Station HUD
Scientific visualization shouldn't look like an Excel spreadsheet with a dark theme. The simulator interface is designed like a mission control cockpit:
- Instanced Mesh Buffers: Rendering hundreds of glowing orbital trajectories simultaneously without melting the user's GPU.
- Hazard Classification: Potentially Hazardous Asteroids (PHAs) are highlighted with distinct amber vectors, displaying relative miss distances and approach velocities.
- Temporal Scrubber: A timeline scrubber that lets users fast-forward orbital mechanics decades into the future or rewind to historical close encounters.
4. Reflections from Space Apps 2025
- The Solar System is Very Empty: The biggest UX challenge was scale. Space is vast, which is wonderful for biological survival, but means asteroids are microscopic specks relative to their orbits. Dynamic camera zooming and adaptive vector scaling were essential.
- Numbers Tell Stories When Visualized: Watching two orbital ellipses skim past each other by a cosmic whisker communicates planetary defense far more intuitively than raw tables of velocity numbers.
- Open Science Inspires: Demonstrating the project to students at SEDS Sri Lanka turned abstract physics concepts into interactive exploration.
Project Links
- Live Simulator: neo.thawshi.com↗
- GitHub Repository: github.com/Thawshi-Srikanth↗

