You are browsing as a guest. Sign up (or log in) to start making projects!

3h 15m 17s logged

Solar System Viewer

  • Thought it’d be cool to have something you could just leave open on the desktop, so I added a little live Solar System app. Every planet sits where it actually should be today rather than looping around on some fake animation.

  • Planet positions come from simplified J2000 Keplerian elements (semi-major axis, eccentricity, orbital period, etc.) and get advanced from the current date, so they’re calculated fresh instead of being hardcoded.

  • Conveniently I’d already written a Newton-Raphson solver for Kepler’s equation while making Umbra, so I shamelessly reused it here to solve the eccentric anomaly before converting that into the planet’s true anomaly and distance from the Sun. Nice when old suffering becomes reusable code lol.

  • Biggest headache honestly wasn’t the orbital maths, it was the scale. If you draw everything linearly then Neptune disappears off the edge of the canvas, but if you squash everything too much then the inner planets all merge together. Ended up scaling the orbital radius by √r instead, which keeps the angular positions correct while compressing the distances enough that the whole Solar System fits on one screen.

  • Made every planet clickable as well because a static diagram felt a bit dead. Clicking one gives its current distance from the Sun and orbital period, with Earth getting a little highlight ring so it’s easy to spot where we are.

  • It redraws once a minute since the planets barely move on human timescales anyway, and it’s definitely not accurate enough to navigate a spacecraft with, but it’s surprisingly close considering it’s just running a handful of orbital equations in the browser lol.

deffo gonna play around with the window sizing cause its kinda weird right now… also neptune is STILL SQUASHED (genuine annoyance btw) so will do this TOMORROW.

0
2

Comments 0

No comments yet. Be the first!