Chapter 8. Perl-fect Sundials
This article describes a Perl 4 program for making sundials that can depict the current time to about a minute’s accuracy. Typical sundials are only accurate to about half an hour, but the Perl sundials I’ll describe correct for the latitude and longitude, and even for the eccentricity of the earth’s orbit.
To refresh your memory, sundials point to the current time with a shadow. In Figure 8-1 you can see the tip of the shadow of the gnomon—the upright part of a sundial—falling on a marking that indicates the time.
Figure 8-1. A sundial with a gnomon
For our sundials, the gnomon’s shadow will fall on a plate marked with lines of “constant time.” The plate markings are generated in Adobe PostScript by the Perl program, and can then be plotted and transferred to a brass sheet or some other weatherproof surface.
Figure 8-2 shows such a sundial. Because the sun occupies any particular position in the sky exactly twice per year, two dials are needed: one for the days between the winter solstice and the summer solstice (December 21 to June 21), and one for the other half of the year. The first dial is used in the winter and spring, when the sun is descending to its lowest angle at the winter solstice. The second dial is used in the summer and fall, when the sun is rising toward its highest angle at the summer solstice.
Figure 8-2. A Perl sundial, with ...
Get Games, Diversions & Perl Culture now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.