10 CLS:KEY OFF:SCREEN 0:WIDTH 80:COLOR 7,1:CLS
15 SV=32:SW1=15:SW3=10:SW4=7:SE=30
20 LOCATE 2
30 PRINT "     The algorism that calculates the flight path of the 'rang
40 PRINT "     was written by GERHARD BERTLING of Berlin, West Germany.
50 PRINT
60 PRINT "     JONH MAURO of Richland Virginia, contributed some user
70 PRINT "     friendly ideas.
80 PRINT "
90 PRINT "     The rest of the program was written BY JIM MARTELLOTTI
100 PRINT "     of Tustin, California. (714-544-2005)"
110 PRINT "
130 PRINT "     With the MENU you can change the five parameters that
140 PRINT "     control the flight path of the boomerang, and the view
150 PRINT "     angle of the 3D view.
160 PRINT "     Choice #6 from the MENU will plot a 3D view of the flight
170 PRINT "     path.  Choice #7 will plot 4 views on the screen.  A top view,
180 PRINT "     a front view, a side view, and a 3D view.  If you have a
190 PRINT "     graphics printer you can print the plot with Print Screen.
195 PRINT "     Pressing any other key will return you to the menu.
200 PRINT :PRINT :PRINT:PRINT
210 PRINT "                      (press any key to continue)"
220 A$=INKEY$:IF A$="" THEN 220 ELSE 230
230 CLS:LOCATE 2
240 PRINT "     The velocity is in meters per second.  The range for input
250 PRINT "     is between 0 and 50. Velocities of about 30 - 35 work best.
260 PRINT
270 PRINT "     Aim is the angle in degrees above the horizon that the"
280 PRINT "     boomerang is thrown.  The range is 0 - 45.  15 works good. "
290 PRINT
300 PRINT "     Tilt is in degrees. This angle represents the tilt of the"
310 PRINT "     boomerang from the thrower's head. Launching the 'rang
320 PRINT "     vertically would be 0 degrees.  The range is 0 - 45"
340 PRINT
350 PRINT "     The lay down value has something to do with the how quickly
360 PRINT "     the boomerang will laydown in flight.  A large value seems to
370 PRINT "     cause the 'rang to laydown prematurley.  The range is between"
380 PRINT "     1 and 50.  Values of about 5 ot 10 work good.
390 PRINT
400 PRINT "     The viewing angle is in degrees.  Thes is the angle you are
410 PRINT "     viewing the from in the 3D views.  0 degrees is viewing from"
420 PRINT "     ground level and 90 degrees is fron straight overhead.  Values
430 PRINT "     from 5 to 30 seem to be best.  The range is 0 to 90.
440 PRINT
450 PRINT "                     (press any key to continue)"
460 A$=INKEY$:IF A$="" THEN 460 ELSE 2000
2000 'THIS IS THE MAIN MENU
2010 '
2020 '
2030 SCREEN 0:WIDTH 80:COLOR 7,1:CLS
2040 LOCATE 6,25:PRINT "BOOMERANG FLIGHT PERAMETERS":PRINT :PRINT :
2050 PRINT "              1.  VELOCITY       ("SV")":PRINT
2060 PRINT "              2.  AIM            ("SW1")":PRINT
2070 PRINT "              3.  TILT           ("SW3")":PRINT
2080 PRINT "              4.  LAY DOWN       ("SW4")":PRINT
2090 PRINT "              5.  VIEW ANGLE     ("SE")":PRINT
2100 PRINT "              6.  PLOT 3D FLIGHT PATH":PRINT
2105 PRINT "              7.  PLOT 4 VIEW FLIGHT PATH":PRINT
2106 PRINT "              9.  EXIT";
2110 A$=INKEY$:IF A$=""THEN 2110
2120 IF A$="1"THEN 2200
2130 IF A$="2"THEN 2300
2140 IF A$="3"THEN 2400
2150 IF A$="4"THEN 2500
2160 IF A$="5"THEN 2600
2165 IF A$="6"THEN P=9000:GOTO 5000
2166 IF A$="7"THEN P=10000:GOTO 5000
2167 IF A$="9"THEN SYSTEM
2168 GOTO 2110
2170 GOSUB 5000
2180 RETURN
2200 LOCATE 9,45:INPUT "NEW VELOCITY";SV
2210 LOCATE 9,45:PRINT "                    "
2220 IF SV > 50 THEN GOTO 2200
2230 IF SV < 0 THEN GOTO 2200
2240 GOTO 2000
2300 LOCATE 11,45:INPUT "NEW AIM     ";SW1
2310 LOCATE 11,45:PRINT "                    "
2320 IF SW1 > 45 THEN GOTO 2300
2330 IF SW1 < 0 THEN GOTO 2300
2340 GOTO 2000
2400 LOCATE 13,45:INPUT "NEW TILT    ";SW3
2410 LOCATE 13,45:PRINT "                    "
2420 IF SW3 > 45 THEN GOTO 2400
2430 IF SW3 < 0 THEN GOTO 2400
2440 GOTO 2000
2500 LOCATE 15,45:INPUT "NEW LAY DOWN";SW4
2510 LOCATE 15,45:PRINT "                    "
2520 IF SW4 > 50 THEN GOTO 2500
2530 IF SW4 < 0 THEN GOTO 2500
2540 GOTO 2000
2600 LOCATE 17,45:INPUT "NEW VIEW ANGLE";SE:GOTO 2000
2610 LOCATE 17,45:PRINT "                    "
2620 IF SE > 90 THEN GOTO 2600
2630 IF SE < 0 THEN GOTO 2600
2640 GOTO 2000
5000 'THIS CALCULATES THE FLIGHT PATH OF THE 'RANG.
5001 '
5002 '
5003 V=SV:W1=SW1:W4=SW4:W3=SW3:E=SE
5004 CLS:SCREEN 1,,0,0:COLOR 1,3
5005 IF P=9000 GOTO 5009
5006 LINE (0,100)-(319,100):LINE (160,0)-(160,199)
5007 LINE (10,185)-(150,185):LINE (295,10)-(295,90)
5008 PRINT "V="V:PRINT "A="W1:PRINT "T="W3:PRINT "L="W4:PRINT "E="E
5009 W1=W1/180*3.14
5010 E=E/180*3.14
5020 W2=0:W3=W3/180*3.14:K1=.06
5030 W4=W4/180*3.14:K3=.975
5040 W5=0:W6=W3*SIN(W1)
5050 X=0:Y=2:Z=2
5055 IF P = 9000 GOTO 5060
5056 X=40:XRL=240:YRL=180
5060 BX=0:BY=0:L=1:B1=0
5070 DEF FNASN(Q)=ATN(Q/SQR(-Q*Q+1))
5075 IF P=10000 GOTO 5100
5080 M=6-2*SIN(E)
5090 XRL=160:YRL=175-SIN(E)*M*Z
5100 T=1/10:G=9.810001
5110 IF P = 9000 THEN GOSUB 9000
5115 IF P = 10000 THEN GOSUB 10000
5120 S=V*T
5130 DX=S*COS(W2):DY=S*SIN(W2)
5140 X=X+DX*COS(W1)*COS(W5)-DY*COS(W3)*SIN(W6)
5150 Y=Y+DY*COS(W3)*COS(W6)-DX*COS(W1)*SIN(W5)
5160 DZ=DY*SIN(W3)+DX*SIN(W1)
5170 D=K1*S
5180 D1=D*COS(W4)
5190 D2=D*SIN(W4)
5200 W7=FNASN(DZ/S)
5210 D3=(W7-ATN(TAN(W7)-G*T/V/COS(W7)))*COS(B1)
5220 DZ=DZ-G*T^2/2:Z=Z+DZ
5230 V=SQR(V^2-2*G*DZ)*K3
5240 DA=-L*D2*SIN(W2)-D3*COS(W2)
5250 DG=L*D2*COS(W2)-D3*SIN(W2)
5260 W8=FNASN(SIN(W1)/COS(W3))
5270 W9=FNASN(SIN(W3)/COS(W1))
5280 W1=W1+DA*COS(W9)
5290 W3=W3+DG*COS(W8)
5300 BO=ATN(SIN(W3)/SIN(W1))
5310 Q=SIN(W1)^2+SIN(W3)^2
5320 IF Q<=1 THEN 5410
5330 W8=FNASN(SIN(W8+D4)):W9=FNASN(SIN(W9+D5))
5340 W1=FNASN(SIN(W8)*COS(W3)):W3=FNASN(SIN(W9)*COS(W1))
5350 BK=BO-ATN(TAN(BO)*COS(B1)):BO=ATN(SIN(W3)/SIN(W1)):Q=SIN(W1)^2+SIN(W3)^2
5360 IF L=1 THEN 5390
5370 L=1:BX=BX-2*BK+3.14:BY=BY-2*BK
5380 GOTO 5410
5390 L=-1:BX=BX+2*BK-3.14
5400 BY=BY+2*BK
5410 B1=FNASN(SQR(Q))
5420 W6=BO-ATN(TAN(BO)*COS(B1))
5430 W5=FNASN(TAN(W1)*TAN(W3))-W6
5440 W6=BY+L*W6
5450 W5=-BX+L*W5
5460 W2=W2+D1
5470 IF P = 9000 THEN GOSUB 9000
5475 IF P = 10000 THEN GOSUB 10000
5480 IF Z>0 THEN 5110
5490 A$ = INKEY$:IF A$="" THEN 5490
5550 GOTO 2000
9000 'PLOTING FOR 3D VIEW
9001 '
9002 '
9009 XG=160+M*X:YG=175-SIN(E)*M*Y
9010 XR=XG:YR=YG-COS(E)*M*Z
9020 LINE (XG,YG)-(XR,YR),2
9030 LINE (XRL,YRL)-(XR,YR),3
9040 XRL=XR:YRL=YR
9045 A$=INKEY$:IF A$="" GOTO 9050
9046 GOTO 2000
9050 RETURN
9060 END
10000 'THIS PLOTS THE FOUR VIEW SCREEN
10010 '
10020 '
10030 M=2.5
10040 PSET (+M*X-20,95-M*Y),3
10050 PSET (-20+M*X,185-M*Z),3
10060 PSET (295-M*Z,95-M*Y),3
10070 XG=140+M*X:YG=185-SIN(E)*M*Y
10080 XR=XG:YR=YG-COS(E)*M*Z
10090 LINE (XG,YG)-(XR,YR),2
10100 LINE (XRL,YRL)-(XR,YR),3
10110 XRL=XR:YRL=YR
10120 A$=INKEY$:IF A$="" GOTO 10140
10130 GOTO 2000
10140 RETURN
10150 END
