10 REM *** SWINGHOUSE FILE M ***
20 REM 31.8.82 Memsize Enter 8193
30 REM AB .......Betrachtungsabstand
40 REM X0,Y0,Z0..Blickrichtung
50 REM X1,Y1,Z1..Augenpunkt
60 AB=250:PI=4*ATN(1)
70 NP=35:K=25:DIMP(NP),X4(K),Y4(K),Z4(K)
80 GOSUB700:FORI=0TO23:P(I)=8192+1024*I:NEXT
90 FORI=0TO11:P(I+24)=-32768+1024*I:NEXT
100 DEFFNI(X)=SGN(X)*(ABS(INT(X)+.5))
110 DEFFNX(X)=95/(2*AB)*(X+AB)
120 DEFFNY(Y)=(44/(2*AB)*(AB-Y))
130 DEFFNA(B1)=(B1*X1-A1*Y1)/SQR((A1*A1+B1*B1+C
1*C1)*(X1*X1+Y1*Y1))
140 DEFFNB(M1)=(1+M1*M2+N1*N2)/SQR((1+M1*M1+N1*
N1)*(1+M2*M2+N2*N2))
150 DEFFNAC(X)=-ATN(X/SQR(-X*X+1))+PI*.5
160 DEFFNAS(X)=ATN(X/SQR(-X*X+1))
170 DEFFNC(D)=ABS(AB*TAN(FNAC(D)))
180 DEFFND(R)=R*COS(P):DEFFNE(R)=R*SIN(P)
190 FORJ=0TONP:CLS:SCREEN23,1:PRINTJ
200 X0=5.95:Y0=4.35:Z0=2.51
210 :
220 X1=7*SIN(J*PI/18)+.1+X0
230 Y1=7*COS(J*PI/18)+.1+Y0
240 Z1=5+10*SIN(J*PI/18)+.1
250 :X1=X1-X0:Y1=Y1-Y0:Z1=Z1-Z0
260 M1=Y1/X1:N1=Z1/X1
270 RESTORE580:FORI=1TOK:READX2,Y2,Z2
280 X2=X2-X0:Y2=Y2-Y0:Z2=Z2-Z0
290 A1=Y2*Z1-Y1*Z2:B1=X1*Z2-X2*Z1
300 C1=X2*Y1-X1*Y2:D=FNA(B1)
310 IFABS(D)>=1THEND=.999999*SGN(D):GOTO330
320 IFD=0THEND=.00001
330 :P=FNAS(D):IFC1<=0THENP=PI-P
340 M2=(Y2-Y1)/(X2-X1):N2=(Z2-Z1)/(X2-X1)
350 D=FNB(M1):R=FNC(D)
360 X4(I)=FND(R):Y4(I)=FNE(R):NEXT
370 X1=1E38:Y1=X1:X2=-X1:Y2=X2:FORI=1TOK
380 IFX4(I)<X1THENX1=X4(I)
390 IFX4(I)>X2THENX2=X4(I)
400 IFY4(I)<Y1THENY1=Y4(I)
410 IFY4(I)>Y2THENY2=Y4(I):NEXT
420 FORI=7TO10:GOSUB490:NEXT
430 FORI=11TO12:GOSUB490:NEXT
440 FORI=14TO18STEP2:GOSUB490:NEXT
450 FORI=20TO25:GOSUB490:NEXT
460 X4(0)=X4(21):X4(1)=X4(24)
470 Y4(0)=Y4(21):Y4(1)=Y4(24):I=1:GOSUB490
480 DOKE3631,P(J):U=USR(0):NEXTJ:GOTO660
490 :X8=FNX(X4(I-1)):X9=FNX(X4(I))
500 Y8=FNY(Y4(I-1)):Y9=FNY(Y4(I))
510 IFX9=X8THENKS=1E5:SF=1:GOTO530
520 KS=(Y9-Y8)/(X9-X8):SF=SGN(X9-X8)
530 :FORXS=X8TOX9STEP.99*SF/SQR(1+KS*KS)
540 XD=FNI(XS):YD=FNI(Y8+(XS-X8)*KS)
550 IFXD<0ORXD>94ORYD<0ORYD>44THEN570
560 SET(XD,YD)
570 :NEXT:RETURN
580 DATA0,0,0,12.8,0,0,12.8,19.5,0,0,19.5,0
590 DATA0,0,0,2.5,2.3,0,9.4,2.3,0,9.4,6.4,0