Skip to content

Repository files navigation

Asteroid Tracker

3D visualization of every Near-Earth Object in NASA's JPL Small-Body Database. Renders the Sun, the eight major planets, and ~38,000 NEOs in their actual orbits — computed from Keplerian orbital elements at any point in time.

preview

Stack

  • React + Vite + TypeScript for the frontend
  • React Three Fiber (Three.js) for the WebGL solar system
  • Vercel Edge Function (api/asteroids.ts) for the NASA data proxy + CDN caching
  • JPL SBDB Query API for the raw orbital elements

How it works

api/asteroids.ts calls the JPL Small-Body Database Query API with the sb-group=neo filter, requesting the fields full_name, a, e, i, om, w, ma, epoch, H, pha. The response is cached at the edge for 24 hours.

The client reads those elements and, for any Julian Date, computes the heliocentric position of each body by solving Kepler's equation (M = E - e·sin E) with Newton–Raphson, then rotating the perifocal position through the standard Ω, i, ω Euler triple into the J2000 ecliptic frame. Major planets are positioned the same way using J2000 reference elements from NASA's Keplerian Elements for Approximate Positions of the Major Planets.

All ~38k asteroids are drawn with a single InstancedMesh. Position updates are throttled when the time slider is animated.

Run locally

npm install
npm run dev

The Vite dev server runs at http://localhost:5173. To exercise the /api/asteroids route locally, use vercel dev instead.

Deploy

vercel deploy --prod

Caveats

  • Orbital elements are at each object's reference epoch; propagation uses pure two-body Keplerian motion. Real ephemerides include planetary perturbations, non-gravitational forces, etc. — close enough for visualization, not for navigation.
  • Diameter is estimated from absolute magnitude H assuming a 0.14 albedo, which is only a rough guess.
  • Hyperbolic and parabolic orbits (e ≥ 1) are filtered out.

About

3D visualization of every Near-Earth Object in NASA's JPL Small-Body Database

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages