10 REM "STELLATION" 20 REM BY RICHARD L. RYLANDER 12/5/84 30 : 40 GR=49378 :REM GRAPHIK MODUS 50 TX=49411 :REM TEXT MODUS 60 BO=53280 :REM RAHMENFARBE 70 : 80 REM STYLE PARAMETERS 90 POKE 839,1 :REM SKALIERUNG (3:4) 100 POKE 871,0 :REM FACETTENRAENDER (0=NACHZEICHNEN, 1=LOESCHEN) 110 SH=838 :REM SCHATTIERUNG (0=RANDOM, 1=HALBTON) 120 EG=868 :REM RANDFLAG (0=NORMAL, 1=LINIEN AM RAND HINZUFUEGEN) 130 : 140 REM FUNKTIONS ADRESSEN 150 CL=51979 :REM BITMAP LOESCHEN 160 CO=52001 :REM COLOR MAP FUELLEN 170 FC=52052 :REM SCHATTIERTE FACETTEN ZEICHNEN 180 KS=53081 :REM SORTIERROUTINE 190 : 200 XC=160:YC=120 :REM ZENTRIERUNGSKOORDINATEN 210 : 220 PRINT"[147]***************************************" 230 PRINT"* KLEINER STERNFOERMIGER DODEKAHEDRON *" 240 PRINT"***************************************" 250 PRINT" SCHATTIERUNG:" 260 PRINT" R=RANDOM, H=HALBTON" 270 INPUT" IHRE WAHL H[157][157][157]";A$ 280 POKE SH,0:IF A$="H" THEN POKE SH,1 290 PRINT" RAND-STIL :" 300 PRINT" N - NORMAL":PRINT" E - ECKENBETONUNG" 310 PRINT" W - DRAHTGITTER" 320 INPUT" IHRE WAHL N[157][157][157]";A$ 330 POKE EG,0:WI=0:IF A$="N" THEN 360 340 POKE EG,1:IF A$="W" THEN WI=-1 350 : 360 PRINT" LESE SCHEITEL DATEN" 370 VN=32:DIM P%(VN-1,2) 380 FOR N=0 TO VN-1:READ P%(N,0),P%(N,1),P%(N,2):NEXT 390 : 400 PRINT" GEBEN SIE X, Y, UND Z WINKEL EIN" 410 PRINT" (WINKEL IN GRAD)" 420 INPUT X,Y,Z 430 J=3.14159265/180:X=X*J:Y=Y*J:Z=Z*J 440 X0=COS(Y)*COS(Z)-SIN(X)*SIN(Y)*SIN(Z):X1=COS(Y)*SIN(Z)+SIN(X)*SIN(Y)*COS(Z) 450 X2=-COS(X)*SIN(Y):Y0=-COS(X)*SIN(Z):Y1=COS(X)*COS(A):Y2=SIN(X) 460 Z0=SIN(Y)*COS(Z)+SIN(X)*COS(Y)*SIN(Z) 470 Z1=SIN(Y)*SIN(Z)-SIN(X)*COS(Y)*COS(Z):Z2=COS(X)*COS(Y) 480 PRINT" ROTATIONSBERECHNUNG" 490 FOR N=0 TO VN-1 500 X=P%(N,0):Y=P%(N,1):Z=P%(N,2) 510 P%(N,0)=X0*X+X1*Y+X2*Z:P%(N,1)=Y0*X+Y1*Y+Y2*Z:P%(N,2)=Z0*X+Z1*Y+Z2*Z:NEXT 520 : 530 FA=60: REM ANZAHL DER FACETTEN 540 DIM F%(FA/2,2),SH(FA/2),Z%(FA/2),K%(FA/2) 550 PRINT" LESE VERBINDUNGSDATEN " 560 VF=-1: REM VF = ANZAHL DER SICHTBAREN FACETTEN 570 FOR N=1 TO FA 580 VF=VF+1 590 FOR I=0 TO 2 :READ F%(VF,I):NEXT 600 REM BERECHNUNG DER NORMALENVEKTOREN 610 Z=(P%(F%(VF,2),0)-P%(F%(VF,1),0))*(P%(F%(VF,0),1)-P%(F%(VF,1),1)) 620 Z=Z-(P%(F%(VF,0),0)-P%(F%(VF,1),0))*(P%(F%(VF,2),1)-P%(F%(VF,1),1)) 630 IF Z=<0 THEN 720:REM FACETTE NICHT SICHTBAR 640 X=(P%(F%(VF,2),1)-P%(F%(VF,1),1))*(P%(F%(VF,0),2)-P%(F%(VF,1),2)) 650 X=X-(P%(F%(VF,0),1)-P%(F%(VF,1),1))*(P%(F%(VF,2),2)-P%(F%(VF,1),2)) 660 Y=(P%(F%(VF,2),2)-P%(F%(VF,1),2))*(P%(F%(VF,0),0)-P%(F%(VF,1),0)) 670 Y=Y-(P%(F%(VF,0),2)-P%(F%(VF,1),2))*(P%(F%(VF,2),0)-P%(F%(VF,1),0)) 680 NC=SQR(X*X+Y*Y+Z*Z):REM LAENGE DES NORMALENVEKTORS 690 SH(VF)=26*(2*Z+X+Y)/NC 700 SH(VF)=(SH(VF)+64)*(SH(VF)+64)/256:REM SCHATTIERUNG 710 GOTO 730 720 VF=VF-1 730 NEXT 740 : 750 PRINT" BERECHNUNG DER DARSTELLUNGSGROESSE" 760 Y=0:FOR N=0 TO VN-1:IF ABS(P%(N,1))>Y THEN Y=ABS(P%(N,1)) 770 NEXT:S=119/Y 780 FOR N=0 TO VN-1:P%(N,1)=S*P%(N,1)+YC:P%(N,0)=S*P%(N,0)+XC:NEXT 790 : 800 : 810 FOR N=0 TO VF 820 Z%(N)=(P%(F%(N,0),2)+P%(F%(N,1),2)+P%(F%(N,2),2))/3:NEXT 830 : 840 PRINT" SORTIERUNG DER FACETTEN" 850 POKE 140,VF 860 K%(0)=K%(0):POKE 251,PEEK(71):POKE 252,PEEK(72) 870 Z%(0)=Z%(0):POKE 253,PEEK(71):POKE 254,PEEK(72) 880 SYS(KS) 890 : 900 REM ZEICHNE FACETTEN 910 SYS(GR):SYS(CO):SYS(CL):POKE BO,1 920 FOR N=0 TO VF:FA=K%(N) 930 IF WI THEN SH(FA)=64 940 X0=P%(F%(FA,0),0):Y0=P%(F%(FA,0),1):X1=P%(F%(FA,1),0):Y1=P%(F%(FA,1),1) 950 X2=P%(F%(FA,2),0):Y2=P%(F%(FA,2),1) 960 SYS(FC),X0,Y0,X1,Y1,X2,Y2,SH(FA) 970 NEXT 980 POKE198,0 990 GET A$:IF A$="" THEN 990 1000 SYS(TX):POKE BO,14:END 1010 : 1020 REM SCHEITELDATEN 1030 DATA 1000,618,0, 1000,-618,0, -1000,618,0, -1000,-618,0 1040 DATA 0,1000,618, 0,1000,-618, 0,-1000,618, 0,-1000,-618 1050 DATA 618,0,1000, -618,0,1000, 618,0,-1000, -618,0,-1000 1060 DATA 618,0,236, 618,0,-236, -618,0,236, -618,0,-236 1070 DATA 236,618,0, -236,618,0, 236,-618,0, -236,-618,0 1080 DATA 0,236,618, 0,-236,618, 0,236,-618, 0,-236,-618 1090 DATA 382,382,382, 382,382,-382, 382,-382,382, 382,-382,-382 1100 DATA -382,382,382, -382,382,-382, -382,-382,382, -382,-382,-382 1110 : 1120 REM VERBINDUNGSDATEN 1130 DATA 0,12,13, 0,13,25, 0,25,16, 0,16,24, 0,24,12 1140 DATA 1,12,26, 1,26,18, 1,18,27, 1,27,13, 1,13,12 1150 DATA 2,15,14, 2,14,28, 2,28,17, 2,17,29, 2,29,15 1160 DATA 3,14,15, 3,15,31, 3,31,19, 3,19,30, 3,30,14 1170 DATA 4,16,17, 4,17,28, 4,28,20, 4,20,24, 4,24,16 1180 DATA 5,17,16, 5,16,25, 5,25,22, 5,22,29, 5,29,17 1190 DATA 6,19,18, 6,18,26, 6,26,21, 6,21,30, 6,30,19 1200 DATA 7,18,19, 7,19,31, 7,31,23, 7,23,27, 7,27,18 1210 DATA 8,20,21, 8,21,26, 8,26,12, 8,12,24, 8,24,20 1220 DATA 9,21,20, 9,20,28, 9,28,14, 9,14,30, 9,30,21 1230 DATA 10,23,22, 10,22,25, 10,25,13, 10,13,27, 10,27,23 1240 DATA 11,22,23, 11,23,31, 11,31,15, 11,15,29, 11,29,22