Last modified: 2025-05-04 13:29:30
< 2025-05-03 2025-05-05 >How much trouble would it be to make a JavaScript orrery? I'd want to get data on the orbits of the planets and then render them to a canvas, with some way to scroll forwards and backwards in time, set the rate of change of time, jump back to present day. Maybe set your longitude so it can show an arrow coming out of Earth showing which way is "up" for you.
It would be cool to include the moon, not sure if the moon is too close to Earth to be able to show up though.
Prior art includes:
http://planetaryjs.com/ looks cool but not obviously useful for a 2d orrery. Would be fun to use it for something one day though.
You can get orbit data from:
Apparently Horizons is something you query rather than something you export data from. So I think VSOP87 is what I want.
There is https://github.com/gmarty/vsop87 as a JavaScript solver. Not obvious whether it can be loaded from <script>
tags.
I downloaded vsop87c-wasm.js
from dist/
and it loads perfectly well with <script>
tags, good.
vsop87cLoader.then((vsop87c) => {
console.log(vsop87c(2451545));
});
It gives (x,y,z)
coordinates for all the planets excluding Pluto. I think I want to ignore the z
coordinate and plot
circles at x
and y
scaled by some constant. What format is the 2451545 "time" value?
From https://www.mathworks.com/matlabcentral/fileexchange/77248-sun-position-vsop87
The calculations are based on the time in Julian centuries after the J2000 epoch 2000-01-01 12:00:00.
T = (JDE - 2451545)/365250
What is JDE? "Julian Ephemeris Date". Apparently it is different from UTC according to the table in https://eclipse.gsfc.nasa.gov/SEcat5/deltat.html
I've made a start on this, it looks like this:
But I think the date calculation is still broken, because it doesn't agree very well with the planetaryorbits.com one.
< 2025-05-03 2025-05-05 >