Projecting Angular Coordinates on a Plane
Home - Sun hat
Conditions of Use

Projecting Angular Coordinates on a Plane
Terrestrial versus Celestial

Terrestrial telescopes are usually set up with an axis plumb to the earth, i.e. aligned with the zenith and nadir. Theodolites are also set up this way and they measure Azimuth angles on that axis and Altitude angles on an axis perpendicular to that one. This mount is very convenient for scanning the horizon for objects which are close to it.

Celestial telescopes are usually mounted on what's called an equatorial mount which has an axis parallel to the polar axis of the Earth which measures Right Ascension angles and an axis perpendicular to that which measures Declination. These mounts usually also have an zenith axis to help with alignment of the polar axis if they are not fixed mounts. An advantage of this mount for celestial observations is the relative ease of tracking celestial objects as the Earth rotates.

I wanted to measure the skyline around my house for the purpose of calculating the sunrise and sunset times for every day of the year. Since the sun is a celestial object it seemed to me the best setup for the job would be a theodolite on an equatorial mount since it would measure the time almost directly with a simple linear conversion of one hour equal to 15 degrees of Right Ascension. But I have a normal theodolite (one that's called a mountain transit). Do I make an adapter to convert it to an equatorial mount or do I find the way to convert the Azimuth and Altitude measurements I can make with it to the Right Ascension and Declination values I need for my calculation?

While cogitating on various ways I could make an adapter for my transit it finally occurred to me how the conversion between the angular coordinates could be done so I gave up on the adopter and went out with my transit to measure the skyline. I won't go into the details of setting up to do that but. I spent two days taking about 380 measurements, 360 plus a few extra, with the sun on the tripod legs messing up my level.

The way I converted my measurements to celestial coordinates was to convert them to a direction vector in 3D, use a quaternion to rotate them along the meridian to the polar axis (i.e. an angle of the compliment of my latitude on the East-West axis) and then convert the resulting direction vector to Right Ascension and Declination. Converting to a direction vector is:

i = cos(Azimuth)*cos(altitude)
j = sin(Azimuth)*cos(altitude)
k = sin(altitude)

Multiply that by the matrix version of the quaternion and the conversion back to angular coordinates is:

Right Ascention = arctangent(j, i)
Declination =  arcsin(k);

I did all the calculations in a PostScript program since I wanted a graphic version and the results kind of surprised me so I started playing with it and the animation posted here is the result.

You need the analemma to get the sunrise and sunset times so I looked up that calculation and generated the points for it for each day of the year and that's plotted on the animation along with the sun tracks every 10 days or so each in a different color. The plot at the bottom is an alternate representation of the distortion caused by plotting the angular coordinates on a plane. The colors correspond to the tracks. The tracks are plotted every degree in the polar system and that is the horizontal axis of the plot and the vertical axis is the distance between the points as plotted on the plane multiplied by 10 to make it more obvious. Zero length is the bottom margin of the image.

Well, I also wanted to see the polar version:

And why not any ol' version on the meridian between the zenith and the pole?

And then that would probably look pretty cool animated along the meridian:

skylineAnim30.mp4, 33 MB The best one
skylineAnim30.gif, 107 MB
skylineAnim30.png, 283 MB

The 360° panorama in the graphic was made using a pano-pole I made out of a 3/4" PVC pipe with a notch cut in the end to mount my Samsung Galaxy S10e to with the lens at the same height as the horizontal axis of my transit. I mounted the pole through the hole in the tripod the transit mounts to set up in the same location so that the pole was plumb. The hole in the tripod top is about twice the diameter of the pipe so I made a cardboard adapter I clamped to the tripod head which helped with plumbing it.

I was pleasantly surprised at how well it turned out and how well it matched my measurements. To make it fit I had to scale it vertically to 93%. I arranged for my PostScript program to print out the transformed grid corrdinates, and I used the bi-linear distortion function of ImageMagick in Perl grid square by grid square to warp the photo to fit the non-terrestrial views.

In the animation you can see how it rotates on the East-West axis because East and West are marked with black dots on the heavy black horizon line and those dots do not move. Also notice that the distortion is least in the vicinity of those dots.

The story is not done yet! I didn't do this to get a cool animation, I did it to calculate the sunrise and sunset times for every day of the year. In order to do that from my skyline measurements I have to intersect the sun tracks with the skyline. I can do that in either the terrestrial coordinates or the celestial ones or any of the others in the animation. Which is easier? Well, in celestial coordinates the intersection is between a straight line and the corresponding segment of the skyline. That should be easier than getting an approximation in the terrestrial coordinates by stepping along the curved track until you get to the appropriate segment of the skyline and then find the intersection of those two segments. I did it both ways, all in PostScript (something to do with my nature) and it's one of the hardest programming problems I've ever solved. The skyline just kept leaking tracks. I'm sure it can be done better but when I got all the leaks plugged in all the animation frames I let it be. (I did not special case any of the leaks! The algorithm is probably not perfect, but I think it might be pretty general though complicated.) The celestial version was only slightly less complicated but I did it last so I'm not really sure it was easier, However, thinking about how to do the celestial version helped with the other version.

Please don't neglect to notice that the tracks are interrupted by the fence post!

You (if you're knowledgeable enough) might ask me why I didn't just clip the tracks at the skyline using the clipping facility of PostScript. It's because I don't know how to get the coordinates of the track where it's clipped by PostScript that I need for my calculation.

BONUS! for reading the whole thing! Rolling globe!

globe.mp4, 47 MB The best one
globe.gif, 54 MB
globe.png, 44 MB

Home - Sun hat
Conditions of Use