Back to News
Advertisement
qqunabu about 11 hours ago 34 commentsRead Article on qunabu.github.io

DE version is available. Content is displayed in original English for accuracy.

Just for fun and self education, I've built this over a weekend to teach myself why orbits exist, not just show planets going around. Something that was never clearly explain to me in school. It opens with a guided tour that builds the idea up step by step: two bodies and the equal/opposite force, inertia (the Sun is removed and Earth just drifts straight), then "an orbit is falling and continuously missing," cosmic velocities with a little rocket, Voyager 1 & 2's real gravity assists (the clock runs the actual 1977–1989 dates so the planets orbit into their grand-tour alignment and the slingshots line up), and it ends on Einstein — gravity as curved spacetime, the classic rubber-sheet well. What's real: every body uses its real radius/mass and J2000 orbital elements; positions come from solving Kepler's equation each frame. You can toggle to an N-body mode (symplectic leapfrog) that shows live energy drift (~1e-6%) so you can see the integrator is honest. The only thing faked is scale — at true scale you can't see anything — so there's a toggle between true scale and a log-remapped "visual" scale, with physics always running in real AU. Tech: TypeScript + Three.js + Vite, fully client-side, no backend, works offline (surface textures are generated procedurally from value-noise; only Earth uses a real image). Source: https://github.com/qunabu/Gravity

Happy to answer questions — and feedback on the physics or the explanations is very welcome. This project might be totally inaccurate in terms of real physics, this is how i do understand this on my own - i'm happy to confront this with reality

Advertisement

⚡ Community Insights

Discussion Sentiment

92% Positive

Analyzed from 1284 words in the discussion.

Trending Topics

#earth#sun#gravity#https#axis#space#orbit#com#step#should

Discussion (34 Comments)Read Original on HackerNews

nerdsniper25 minutes ago
Step 5 shows the earth going as slow as 21.5 km/sec at aphelion and as fast as 39km/sec at the perihelion. I believe that should be closer to 29.3 and 30.3 km/sec, respectively.
rfgplkabout 8 hours ago
Very nice, fairly efficient too.

I don't like the explicit split of Newtonian and relativistic gravity, this is often how it's presented in educational content, but it creates too much confusion; for instance it gives the illusion that they are somehow separate theories even though Newtonian gravity is a limiting case of Einsteinian gravity when v << c and gravitational fields are weak (see Poissons eq for Newtons gravitational potential.

Lastly, you should consider rendering spacetime similar to Alessandro Roussels spacetime visualization https://www.youtube.com/watch?v=wrwgIjBUYVc; probably the best and most innovative one I've seen.

jrfloabout 7 hours ago
I really liked your animations, but isn't step 14 incorrect? Earth's axis processes, but on a very long timescale. In the span of a day, the axis should be effectively stationary. That's why its the rotation 'axis' - it's the fixed line it rotates about. That's why Polaris is the north star: the axis of rotation points effectively directly at it at all times no matter the season. During summer in the northern hemisphere, the tilt is towards the sun, giving us more direct heating, and in the winter it's away from the sun. This isn't due to the axis moving, but due to the axis' relative position changing throughout earth's orbit around the sun.
SamBamabout 1 hour ago
Everything you're saying is right, but I'm not seeing what's wrong with step 14. Did they edit it?

> Earth turns once every 23 h 56 min (one sidereal day) about an axis tilted 23.4° (the blue line). That spin gives us day and night; the tilt gives us the seasons.

Nothing in step 14 to me implies s procession of the axis.

savoyardabout 3 hours ago
This is exactly right; the phenomenon is known as axial parallelism.
jrfloabout 3 hours ago
Oh neat, didn't realize there was a term for it!
nonethewiserabout 7 hours ago
>The Sun’s gravity (red arrow) pulls the Earth straight toward it the whole time — so why no collision? Because the Earth is also moving sideways (green arrow) at 29.8 km/s. Each moment it does fall toward the Sun, but its sideways speed carries it past — it keeps missing. The dashed line shows where inertia alone would send it; gravity bends that straight path into a closed loop. An orbit is simply falling, continuously, and always missing.

Reading stuff like this always makes me think "well that is fortunate." Of course there is survivorship bias so its not exactly surprising. But it also makes me wonder what could change the status quo.

I guess these are the things that could change it:

- suns becomes lighter (earth shoots into space)

- earth accelerates (earth shoots into space)

- sun becomes heavier (earth falls into sun)

- earth decelerates (earth falls into sun)

I guess in theory some large interstellar object could pass to close too earth and fling us off into space or into the sun.

SamBam41 minutes ago
The tutorial made it seem a little too much like there is only one speed that would keep us in orbit. Any slower and we'd crash, any faster and we'd leave.

In fact, though, if you've ever played any game with orbiting mechanics you'd see that it's extremely difficult to get out of orbit if you're in orbit. Going faster simply increases the size of your orbit, and going slower simply shrinks it.

Note that no space program has ever managed (or tried) to send an object into the sun. We're already starting off with such a high orbital velocity, 30km/s, that we'd need to send a rocket backwards at nearly that speed just to slow it down enough to make it crash into the sun. That would require massively more energy than anything we've ever done before.

matjaabout 6 hours ago
> well that is fortunate

I think that was one of the arguments of the Anthropic principle [1], that there doesn't appear to be any reason why there are 3 spatial dimensions and 1 time dimension, or why the fundamental constants are what they are - but if they weren't then there wouldn't be anyone to exist to say "well that is fortunate".

[1] https://en.wikipedia.org/wiki/Anthropic_principle#Dimensions...

nonethewiserabout 5 hours ago
yes, exactly. It didn't have to be this way, but it had to be this way to observe it. Survivorship bias.
jumploopsabout 3 hours ago
This is neat! I love that your Step 15 shows an accurate version of the 3d helix, rather than the highly-viral "vortex" animation from a few years back[0]

It'd be awesome to scale this up to the Milk Way, and beyond, watching everything move in relation to larger time scales.

[0]https://astrorhysy.blogspot.com/2015/03/and-yet-it-moves-qui...

Invictus1001about 2 hours ago
Really cool project. I'm curious what was the most surprising thing you learned while building this that changed your own understanding of how gravity or orbits work?
qunabuabout 7 hours ago
Thank you all for the comments and showing the weaknesses in the model and visualisation. I'll try to understand the issues and fix them soon.
qunabuabout 3 hours ago
I've just published the first batch of patches and new features. I've learnt a lot during the process and from the comments which was one of the main goals, so I'm really happy about this process. Thanks again!
VikingCoderabout 9 hours ago
This is nice.

I did laugh at how the Gravity built the Earth, with a tiny North America and all, and then as more mass was accumulated, North America got to get bigger and bigger and bigger!

JKCalhounabout 7 hours ago
Ha ha, you're looking at the man behind the curtain.

(I thought the same: suspecting it's a kind of crossfade between accreting bodies and finished Earth.)

xixixaoabout 4 hours ago
The "focus" on planets doesn't work quite correctly. I love that you included true size, but it would be great if the focus worked, and one could zoom between the planets (until the planet shows up).

I also think Saturn's rings don't wobble that fast.

kmaitreysabout 7 hours ago
For something more rigorous, I would like to take this opportunity to share rebound[1], something we use for n-body simulations in our field (planet formation). Perhaps few people here are already familiar with it. It has a Python interface but the C interface is very easy to use as well and has plethora of pre-set examples which can be visualized using GLFW. It's very very cool!

[1]https://github.com/hannorein/rebound

ziofillabout 8 hours ago
That doesn’t look right: in the 7th panel (too fast it escapes) the force and velocity of earth are constant? 0_o
Advertisement
BigTunaabout 9 hours ago
Great job! 14 is misleading though - while the context is one day, the animation depicts axial precession which takes place over ~26,000 years
Iolaumabout 9 hours ago
My physics bias would like to see earth forming while it's constituents were orbiting around the sun.

In any case, nice visualization.

em-beeabout 7 hours ago
i had the same thought. likewise the sun formed from particles circling around the galactic core. that matters later when it is explained how the sun is moving.
ck2about 9 hours ago
that probably happened a few times as well we "stolen" planets or mass from other star systems in the same baby nursery as our sun

there is also likely a planet that passed through and yanked away a lot of debris, most of the simulations for tilt etc. don't work without the mystery missing planet

I could watch PBS Space Time all day for that kind of stuff, often do letting it play in the background on repeat, so much better than the news

* https://www.youtube.com/@pbsspacetime/search?query=planets

Dr. Becky is also awesome

* https://www.youtube.com/@DrBecky/videos

stevenaloweabout 10 hours ago
Looks great but on mobile the popover covers a quarter of the screen, obscuring the sun
qunabuabout 10 hours ago
I should have mentioned that its not mobile friendly so far. I will try to fix this.
qunabuabout 10 hours ago
It should be better now
iainmerrickabout 9 hours ago
It works pretty well on iPhone, except the descriptive text fills most of the bottom half of the screen, overlapping the sim which is centered on the screen.

If the sim were instead centered on the free space (the top half of the screen) it’d be perfect.

Brendinoooabout 10 hours ago
Super fun! I might show it to my kids later today. Thanks for making it!
genpfaultabout 9 hours ago
> Einstein

How are you handling relativistic effects in the N-body simulation?

qunabuabout 9 hours ago
Not in the sim right now — it's purely Newtonian (symplectic leapfrog, classical gravity). I show the concept on the last slide ("Einstein: gravity is curved spacetime") — a curve in space wrapping around a star/planet that pulls nearby objects into the well. The quantitative case, Mercury's ~43″/century perihelion precession, I'd add next as a 1PN correction — haven't gotten to it yet. Will try to figure it out how to show this
ThrowawayTestrabout 3 hours ago
Oh wow I never knew Saturn was tilted so much
ck2about 9 hours ago
the way the original mathematicians figured all this out absolutely melts my brain

no computers, no calculators, barely working telescopes looking at the moons orbiting Jupiter

(don't be limited by episode title, lots of amazing astrophysics in there)

* https://www.youtube.com/watch?v=8yhk1EZq9tY

TheOtherHobbesabout 1 hour ago
The equations required to calculate perturbations, and the effort required to do it by hand with just paper, really are brain melting.

https://descanso.jpl.nasa.gov/monograph/series2/Descanso2_S0...

Basically pages and pages of differential equations, either modelled analytically or approximated (as accurately as possible) with Chebyshev polynomials.

Aside from the basic Kepler orbits, everything influences everything else. This doesn't make much of a different in the short term, but space is biiiiig and it doesn't take much for tiny influences to have a measurable effect.

There's a slightly simpler introduction to detailed perturbative planetary orbit calculations in Feynman's Lectures on Physics.

FWIW the solar system isn't unconditionally stable. Even without wandering visitors, there's a small chance Mercury might drift outwards and collide with one of the other Inners in the next few billion years.