Monday, January 13, 2014

On a Sense of Scale in the Solar System

Cary Huang has an awesome Flash application that you might have seen before, called The Scale of the Universe. Although that app is awesome for getting a sense of the sizes of various objects, it is not very good at conveying a sense of distance. To convey a sense of size and distance, you need to portray both sizes and distances to scale, like the Earth and Moon in the image below. I've always wondered if I could make something that can convey that sense of distance.

Figure: The Earth and Moon with both sizes and distances to scale. [Source: Wikipedia]

I've been wanting to learn how to use HTML5 canvases and improve my JavaScript knowledge for a while, so I realised that this was a perfect opportunity to do that. On Christmas Eve 2013, I sat down and began to program it.

Here is what I came up with.

It's probably not complete, but an app like this could be added to forever, and it possibly will be. I'd like to go further than our Solar System, and add some neighbouring stars, the Milky Way Galaxy and it's neighbours, and so on, until I get to the observable universe.

The rest of this post will talk about the challenges I faced during development, so if that sort of thing doesn't interest you, you can move on. If it does, or you're bored enough not to care, then please read on.

Firstly, the distances between objects in our Solar System are just enormous relative to the sizes of those objects. For example, to display the Earth and Sun together in an image, with the sizes and distances to scale, the image would have to be well over eleven thousand pixels across for the Earth to even show up as a single pixel. That's six times the resolution of a widescreen monitor at 1080p.
The second problem is the range of orders of magnitude that need to be dealt with. Many moons in the solar system have diameters of just a few hundred kilometres and orbit tens or hundreds of thousands of kilometres from their planets, yet the gas giants orbit at distances of a few billion kilometres from the sun.

Thirdly, there is the shear number of bodies in our solar system. The four gas giants have a couple hundred moons between them, and there are more than half a million bodies in our Solar System actively being tracked by the Minor Planet Center.

Finally, the orbit of each body in our solar system traces a unique path in three dimensional space, each with a different inclination, eccentricity, and other orbital parameters. Each body is at a different position in it's orbit, and many of these orbits (especially bodies in the outer solar system) intersect. For example, although Pluto is currently further from the sun than Neptune, it was actually closer than Neptune between 1979 and 1999.

The solutions described below were applied to solve the above problems, in reverse order. Each of these solutions has implications, which are also described below.

The program was restricted to a single dimension. Inclinations were ignored, and distance of each body is averaged across its entire orbit. The implication of this is that all bodies are incorrectly shown on the same plane, and distances between each body are completely inaccurate. Only the average distance from the body to the planet or star about which it orbits is accurate. A future incarnation of the program may remove this restriction.

All eight major planets were included, but only the five dwarf planets recognised by the IAU at the time of writing were included. This means that some bodies such as Sedna, Quaoar, Orcus and Salacia were not included, even though they are widely considered by many astronomers to be dwarf planets. Moons are only included if they are either massive enough to be rounded under it's own gravity, or larger than 10% of their parent planet's diameter. There are only two exceptions: Mars's moons Phobos and Deimos. These were included because they are widely known, and are the best studied moons in our solar system other than our own.

The ability to zoom was essential in order to get a sense of scale over a wider range of distances, with orders of magnitude varying from as little as tens of kilometres up to trillions and beyond. A constantly scaling grid in the background is essential for maintaining the sense of distance as the scale changes.

A minimum size (currently 3 pixels) had to be enforced so that a bodies position could still be seen, even when zoomed too far out for it to be visible. Bodies gradually fade from view as they get too close to their parent bodies on the screen.

I think the final approach comes close to what I originally imagined when I originally came up with the idea, and I hope someone at least finds it interesting and educational.

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .