BASIC2\SUNDIAL.BAS ·
BAS ·
12.5 KB ·
1988-05-17 ·
from PCPlus_Issue-22_Jul-1988
'************************
'*** Horizontal Dial ***
'*** Drawer ***
'*** Peter K Scott ***
'*** 1988 ***
'************************
'************************
'* QUAELIBET EST INDEX **
'* FUNERIS HORA TUI **
'************************
CLOSE #1
OPEN #1 WINDOW 1
CLOSE #5
LABEL re_set
OPEN #5 DEVICE 21
LABEL menu
p=3.142/180:ss=180/3.142
SCREEN #1 GRAPHICS 1600 FIXED,9400 FIXED
WINDOW OPEN:WINDOW FULL
WINDOW TITLE "HORIZONTAL SUNDIAL PROGRAM P.K.Scott 1988"
BOX 0;0,16000,9385 FILL WITH 8 COLOUR 5
SET MODE 2
LOCATE 8;5
PRINT POINTS (20) COLOUR (4)" Horizontal Dial Drawing Program"
LOCATE 29;17
PRINT POINTS(20) COLOUR(4) " Main Menu"
alert_value=ALERT 0 TEXT " PLEASE CHOOSE AN OPTION " BUTTON "MAKE A SUNDIAL","INSTRUCTIONS","QUIT PROGRAM"
IF alert_value=1 THEN GOTO start_here
IF alert_value=2 THEN GOTO instructions
IF alert_value=3 THEN END
LABEL start_here
SET FONT 1
SET MODE 2
SET COLOR 1
USER #1 SPACE 14050,9210
USER #5 SPACE 8500
no=1:z=0:qq=7:no1=1
BOX 0;0,16000,9385 FILL WITH 8 COLOUR 5
PRINT CHR$(7);
LOCATE 45;2:INPUT " Enter the Latitude ";lat
IF lat>90 OR lat<0 THEN GOTO start_here
IF lat<15 THEN GOSUB lat_too_small:GOTO start_here
s=14:t=10
GOSUB draw_dial
LOCATE 45;4
PRINT TAB(45) " Calculated hour angles:"
PRINT TAB(45)" ----------------------------"
FOR a=1 TO 5
h=a*15
h=TAN(h*p)
tt=SIN(lat*p)
r=h*tt
r=ATN(r):r=r*ss
PRINT TAB(45);a;" and ";12-a;TAB(57);" o clock";
PRINT TAB(67);USING "###.##";r:NEXT a
PRINT TAB(45)" 6 o'clock 90.00"
PRINT TAB(45)" ----------------------------"
PRINT TAB(45)" Set the style at "; lat;"degrees"
PRINT TAB(45)" ----------------------------"
PRINT
PRINT TAB(45)" Print out the dial .Press P"
PRINT TAB(45)" Make another dial...Press M"
PRINT TAB(45)" Return to menu......Press R"
PRINT CHR$(7);
SET COLOR 4
PRINT
PRINT " The Sundial is a Horizontal dial and it is calculated for Latitude";lat;"North"
PRINT" It is NOT a toy. When corrected it tells the time as accurately as any watch"
PRINT" Print one for YOUR latitude and then read the instructions from the menu";
1 p$=INKEY$:IF p$="" THEN 1
IF p$="P" OR p$="p" THEN GOTO print_out
IF p$="M" OR p$="m" THEN GOTO start_here
IF p$="R" OR p$="r" THEN GOTO menu
GOTO 1
LABEL print_out
no=5:s=15:t=20:no1=2
PRINT #5," COMPUTER DRAWN HORIZONTAL SUNDIAL FOR LATITUDE ";lat;"NORTH";
PRINT #5," PC PLUS MAGAZINE"
PRINT #5," SET THE STYLE AT ";lat"DEGREES"
PRINT #5
PRINT #5," Devised by Peter K Scott 1988"
GOSUB draw_dial
MOVE #5,(-150*s);(20*s)
PRINT #5 POINTS (t) " * WASTE NOT THE HOURS * ";
PRINT #5 POINTS(7) " Lat ";lat;" N"
GRAPHICS #5 UPDATE NEW
PRINT CHR$(7);
CLOSE #5
GOTO re_set
LABEL draw_dial
USER #no,ORIGIN (260*s);(390*s)
SET MODE 1
IF no1=2 THEN GOTO 2
BOX (-220*s);(-270*s),(490*s),(490*s) FILL WITH 8
2 BOX #no,(-245*s);(-245*s),(490*s),(490*s) FILL WITH 0
BOX #no,(-242*s);(-242*s),(484*s),(484*s)
BOX #no,(-232*s);(-232*s),(464*s),(464*s)
SET MODE 2
BOX #no,(-235*s);(-235*s),(470*s),(470*s)
BOX #no,(-180*s);(-180*s),(360*s),(360*s)
LINE #no,0;(180*s),0;(-180*s)
MOVE #no,(-15*s);-215*s:PRINT #no,POINTS (t) COLOR(4) "12"
USER #no,ORIGIN (260*s)-p;(570*s)
l=(lat*p)
FOR a=.25 TO 5.75 STEP .25
h=a*RAD(15):h=TAN(h):tt=SIN(l):r=h*tt:x=r*(360*s)
IF x<(180*s) THEN y=(-360*s):q=(35*s):z=0
IF x>=(180*s) THEN GOSUB up_the_side
LINE #no,0;0, x;y:GOSUB rh_numerals
LINE #no,0;0,-x;y:GOSUB lh_numerals
NEXT
SET MODE 1
SHAPE #no,(-173*s);(-352*s),(-173*s);(-.5*s),(173*s);(-.5*s),(173*s);(-352*s) FILL WITH 1
SET MODE 2
LINE #no,0;0,0;(-360*s)
FOR a=1 TO 5
h=a*RAD(15):h=TAN(h):tt=SIN(l):r=h*tt:x=r*(360*s)
IF x<(180*s) THEN y=(-360*s):q=(35*s):z=0
IF x>=(180*s) THEN GOSUB up_the_side
LINE #no,0;0, x;y:GOSUB rh_numerals
LINE #no,0;0,-x;y:GOSUB lh_numerals
NEXT
SET MODE 1
CIRCLE #no,0;0,(70*s) PART 3.142,0 FILL WITH 0
CIRCLE #no,0;0,(65*s) PART 3.142,0 FILL WITH 0
CIRCLE #no,0;0,(60*s) PART 3.142,0 FILL WITH 0
SET MODE 2
MOVE #no,(-210*s);(-10*s):PRINT #no,POINTS (t) COLOR(4)"6"
MOVE #no, (200*s);(-10*s):PRINT #no,POINTS (t) COLOR(4)"6"
RETURN
LABEL up_the_side
x=x-(180*s)
y=x/r
y=(-360*s)+y
x=(180*s)
z=(20*s)
q=(20*s)
RETURN
LABEL rh_numerals
MOVE #no, x+z;y-q
IF a=1 THEN PRINT #no,POINTS (t) COLOR(4)"11"
IF a=2 THEN PRINT #no,POINTS (t) COLOR(4)"10"
IF a=3 THEN PRINT #no,POINTS (t) COLOR(4)"9"
IF a=4 THEN PRINT #no,POINTS (t) COLOR(4)"8"
IF a=5 THEN PRINT #no,POINTS (t) COLOR(4)"7"
RETURN
LABEL lh_numerals
MOVE #no, -x-z-10*s;y-q
IF a=1 THEN PRINT #no,POINTS (t) COLOR(4)"1"
IF a=2 THEN PRINT #no,POINTS (t) COLOR(4)"2"
IF a=3 THEN PRINT #no,POINTS (t) COLOR(4)"3"
IF a=4 THEN PRINT #no,POINTS (t) COLOR(4)"4"
IF a=5 THEN PRINT #no,POINTS (t) COLOR(4)"5"
RETURN
LABEL lat_too_small
PRINT CHR$(7);:FOR delay=1 TO 1000:NEXT:PRINT CHR$(7);
PRINT TAB(45);" NOT PRACTICAL TO MAKE"
FOR delay=1 TO 5000:NEXT
RETURN
LABEL instructions
SET COLOR 4
CLS
PRINT
PRINT " The dial drawing program that you are using will print a Horizontal sundial"
PRINT" for any Latitude in the Northern hemisphere.(Greater than 14 degrees North)
PRINT " The sundial will tell accurate time i.e. Greenwich Mean Time"
PRINT" (or BRITISH SUMMER TIME), IF the following directions and corrections are "
PRINT " carried out.":PRINT
PRINT" First find the Latitude and the Longtitude of the place where the sundial"
PRINT" is to be used. This can be found in a good atlas. Enter the Latitude value in "
PRINT" decimal degrees (i.e. 53.5) into the program and press return. The computer"
PRINT" will draw a dial on the screen. You will notice that the program also "
PRINT" calculates the hour angle values for the dial. These are the angles for each"
PRINT" hour line to be drawn on either side of the meridian. I have included these"
PRINT " so that you can draw a bigger dial for yourself if you want to.":PRINT
PRINT" When you have printed out the dial make a style out of a piece of thin card"
PRINT" and set the angle at the style height. Stick this on the 12 o'clock line with "
PRINT" some sellotape as shown in PC PLUS July issue."
PRINT:PRINT COLOR (2) " Press any key"
WHILE INKEY$="":WEND
CLS
PRINT
PRINT" Next you have to set the dial up on the meridian. This means it must face"
PRINT " directly South. Please note that by South I mean direct South not Magnetic"
PRINT" South. If a compass is used the appropriate magnetic variation must be"
PRINT " allowed for.
PRINT
PRINT" When the dial is set up correctly on the meridian, and if the sun is shining!"
PRINT " you may now read the time from the dial. You may notice however that the"
PRINT" time on the dial does not coincide with the time on your watch. (If it does "
PRINT" get a new watch!). This is because the time that we use in this country "
PRINT " is G.M.T. and the sundial is telling L.A.T or Local apparent time."
PRINT " Up until about a century ago L.A.T was the normal time used by every body"
PRINT" however as we all now use G.M.T a correction is required."
PRINT" A sundial can tell G.M.T by making two corrections"
PRINT
PRINT" 1. Longtitude correction"
PRINT" 2. Equation of time correction"
PRINT"
PRINT" LONGTITUDE CORRECTION Can be found by referring to a table of "
PRINT" Arc/Time Conversions. Simply look up the arc value for the Longtitude"
PRINT" of the dial site (in degrees) and read of the value of time (in minutes)"
PRINT COLOR (2) " Press any key";
WHILE INKEY$="":WEND
CLS
PRINT
PRINT" If the dial is situated West of Greenwich then the sundial time will be slow"
PRINT " by this amount. So it must be ADDED to the time shown on the dial. If the"
PRINT" dial is situated East of greenwich then the sundial time will be fast by this"
PRINT" amount. So it must be SUBTRACTED from the sundial time shown."
PRINT
PRINT " EQUATION OF TIME CORRECTION "
PRINT" To make things even more complicated the sun does not travel at a regular"
PRINT " speed. At certain times of the year it speeds up or slows down. The correction"
PRINT" for this irregularity is called the Equation of Time, and can again be"
PRINT" looked up in the appropriate tables."
PRINT
PRINT " Confused? well here is an example to explain all"
PRINT
PRINT" EXAMPLE....Dial reads 12.20 P.M at....Bolton....LAT 53.5N LONG 2.5 W"
PRINT" Date January 1st"
PRINT" Longtitude difference (from Time/Arc chart) WEST approx 8 mins ADD"
PRINT" Equation of time for January 1st from chart SLOW approx 3 mins ADD"
PRINT" TOTAL CORRECTION.................................approx..11mins ADD
PRINT
PRINT" So G.M.T = 12.20 + 11 mins or 12.31 P.M.
PRINT COLOR (2) " Press any key";
WHILE INKEY$="":WEND
CLS
PRINT
PRINT" If British Summer Time is in operation simply add a further Hour to whatever"
PRINT" time has been calculated for the dial."
PRINT
PRINT" If you dont want to bother with any of the complicated corrections that "
PRINT " I have just outlined then thats OK by me. Just sit back in the sunshine "
PRINT" and enjoy wasting away the hours."
PRINT" Thats providing we have any sun this summer!"
PRINT
PRINT" Peter Scott"
PRINT" April 31st 1988"
PRINT:PRINT COLOR(2)" Press any key "
WHILE INKEY$="":WEND
CLS
PRINT
PRINT" The Art of Dialling, or 'gnomonics', as it is sometimes called,is a very "
PRINT " complicated subject. It involves complex mathematics, trigonometry and "
PRINT " geometry. A good text book from the library will explain the basic "
PRINT" principles better than I could ever hope to. I have included a bibliography"
PRINT" of some of the better books on Dialling on the next page."
PRINT "
PRINT" If anybody is REALLY interested in gnomonics, and the application of computers"
PRINT" to dialling. Send me a stamped addressed envelope at the address below"
PRINT" I have a collection of computer programs that can construct ALL TYPES OF "
PRINT" SUNDIALS. The simple horizontal dial that you have seen is only a taster."
PRINT" I can also supply Arc/Time and Equation of Time tables."
PRINT
PRINT" Peter K Scott"
PRINT" 41 Hastings Road"
PRINT" Bolton"
PRINT" LANCASHIRE"
PRINT" BL2 4NG"
WHILE INKEY$="":WEND
PRINT
CLS
PRINT
PRINT" BIBLIOGRAPHY"
PRINT
PRINT" 'SUNDIALS'........R Newton Mayall and Margeret Mayall"
PRINT" Sky Publishing Corp"
PRINT
PRINT" 'SUNDIALS'........Their theory and construction"
PRINT" Albert E Waugh Dover Publications"
PRINT
PRINT" 'SUNDIALS'........Christopher St J H Daniel"
PRINT" Shire Publications"
PRINT
PRINT" 'THE ART OF SUNDIAL CONSTRUCTION'........"
PRINT" Peter I Drinkwater"
PRINT
PRINT" SPECIALIST HOROLOGICAL BOOKSELLERS"
PRINT" Rita Shenton Rogers Turners Books ltd"
PRINT" 148 Percy Road 22 Nelson Road"
PRINT" Twickenham Greenwich"
PRINT" TW2 6JG LONDON"
PRINT" SE 10"
WHILE INKEY$="":WEND
GOTO menu