-
Notifications
You must be signed in to change notification settings - Fork 11
/
B12_Veelvlakken.bc3
241 lines (240 loc) · 8.38 KB
/
B12_Veelvlakken.bc3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
1000 A=200:GOTO20:REM veelvlakken bc3
1010 DIMX(20),Y(20),Z(20),A(20),R(20)
1020 DIMP(60),Q(60),V(20),S(60)
1030 WX=1:WY=1:WZ=1:REM rotatiehoeken
1040 GOSUB100
1050 PRINT"VEELVLAKKEN IN ROTATIE":PRINT
1060 PRINT" 1 = viervlak"
1070 PRINT" 2 = kubus"
1080 PRINT" 3 = achtvlak"
1090 PRINT" 4 = twaalfvlak (rombisch)"
1100 PRINT" 5 = twaalfvlak (pentagon)"
1110 PRINT" 6 = twintigvlak":PRINT
1120 PRINT" 0 = Stoppen":PRINT
1130 PRINT" kies een nummer (0 t/m 6) ";
1140 GOSUB210:QQ=VAL(IN$):IF(QQ<0)OR(QQ>6) THEN1140
1150 PRINTQQ:PRINT:IFQQ=0 THEN950
1160 PRINT" onzichtbare lijnen stippelen (J/N) ";
1170 GOSUB210:AG=IN
1180 PRINTIN$:PRINT:PRINT" even geduld ";
1190 BB=.15:REM beeldbreedte, evt.aanpassen <====
1200 ONQQ+1 GOTO950,1500,1510,1520,1530,1540,1550
1500 E=4:F=4:G=12:H=3:CX=1.4*BB:CY=.28:ZK=11:GOTO1610
1510 E=8:F=6:G=24:H=4:CX=1.3*BB:CY=.26:ZK=22:GOTO1610
1520 E=6:F=8:G=24:H=3:CX=2.5*BB:CY=.5:ZK=33:GOTO1610
1530 E=14:F=12:G=48:H=4:CX=1.2*BB:CY=.24:ZK=44:GOTO1610
1540 E=20:F=12:G=60:H=5:CX=1.4*BB:CY=.28:ZK=55:GOTO1610
1550 E=12:F=20:G=60:H=3:CX=2*BB:CY=.4:ZK=66
1600 REM --- arrays vullen ---
1610 RESTORE
1620 READN:IFN<>ZK THEN1620
1630 FORN=1 TOE:READX(N):NEXTN
1640 FORN=1 TOE:READY(N):NEXTN
1650 FORN=1 TOE:READZ(N):NEXTN
1660 FORN=1 TOE:READA(N):NEXTN
1670 FORN=1 TOE:READR(N):NEXTN
1680 FORN=1 TOG:READP(N):NEXTN
1690 FORN=1 TOG:READQ(N):NEXTN
1700 REM --- rotatie om x-as ---
1710 FORN=1 TOE
1720 A(N)=A(N)+WX:IFA(N)>6.283 THENA(N)=A(N)-6.283
1730 Y(N)=R(N)*SIN(A(N))
1740 Z(N)=R(N)*COS(A(N))
1750 R(N)=SQR(X(N)*X(N)+Z(N)*Z(N)):REM r in x,z vlak
1760 IFZ(N)=0 THENZ(N)=1/1000
1770 A(N)=ATN(X(N)/Z(N))
1780 IFZ(N)<0 THENA(N)=A(N)+3.142
1790 NEXTN
1800 REM --- rotatie om y-as ---
1810 FORN=1 TOE
1820 A(N)=A(N)+WY:IFA(N)>6.283 THENA(N)=A(N)-6.283
1830 X(N)=R(N)*SIN(A(N))
1840 Z(N)=R(N)*COS(A(N))
1850 R(N)=SQR(X(N)*X(N)+Y(N)*Y(N)):REM r in x,y vlak
1860 IFY(N)=0 THENY(N)=1/1000
1870 A(N)=ATN(X(N)/Y(N))
1880 IFY(N)<0 THENA(N)=A(N)+3.142
1890 NEXTN
1900 REM --- rotatie om z-as ---
1910 FORN=1 TOE
1920 A(N)=A(N)+WZ:IFA(N)>6.283 THENA(N)=A(N)-6.283
1930 X(N)=R(N)*SIN(A(N))
1940 Y(N)=R(N)*COS(A(N))
1950 NEXTN
2000 REM --- orientatie van de vlakken ---
2010 U=1:FORN=1 TOF:V(N)=1:T=0
2020 FORM=1 TOH:L=P(U):T=T+Z(L):U=U+1:NEXTM
2030 IFT<0 THENV(N)=0
2040 NEXTN
2500 REM --- tekenen ---
2510 GOSUB600
2520 U=1:CN=0:FORN=1 TOG:S(N)=0:NEXTN
2530 FORN=1 TOF
2540 IFV(N)=0 THENU=U+H:GOTO2640
2550 FORM=1 TOH-1:K=Q(U):U=U+1:IFS(K)=1 THEN2590
2560 Q=P(U-1):R=P(U):X1=X(Q):Y1=Y(Q):X2=X(R):Y2=Y(R):S(K)=1
2570 HO=.5+CX*X1:VE=.5+CY*Y1:GOSUB620
2580 HO=.5+CX*X2:VE=.5+CY*Y2:GOSUB630
2590 NEXTM
2600 K=Q(U):U=U+1:IFS(K)=1 THEN2640
2610 Q=P(U-1):R=P(U-H):X1=X(Q):Y1=Y(Q):X2=X(R):Y2=Y(R)
2620 S(K)=1:HO=.5+CX*X1:VE=.5+CY*Y1:GOSUB620
2630 HO=.5+CX*X2:VE=.5+CY*Y2:GOSUB630
2640 NEXTN:IFAG<>74 THEN2910
2700 REM --- stippellijnen ---
2710 U=1
2720 FORN=1 TOF
2730 IFV(N)=1 THENU=U+H:GOTO2810
2740 FORM=1 TOH-1:K=Q(U):U=U+1:IFS(K)=1 THEN2770
2750 Q=P(U-1):R=P(U)
2760 X1=X(Q):Y1=Y(Q):X2=X(R):Y2=Y(R):S(K)=1:GOSUB3010
2770 NEXTM
2780 K=Q(U):U=U+1:IFS(K)=1 THEN2810
2790 Q=P(U-1):R=P(U-H)
2800 X1=X(Q):Y1=Y(Q):X2=X(R):Y2=Y(R):S(K)=1:GOSUB3010
2810 NEXTN
2900 REM --- rotatiehoeken veranderen ---
2910 WX=WX+.31:IFWX>6.283 THENWX=WX-6.283
2920 WY=WY+.29:IFWY>6.283 THENWY=WY-6.283
2930 WZ=WZ+.27:IFWZ>6.283 THENWZ=WZ-6.283
2940 GOSUB200:IFIN=0 THEN1200
2950 GOTO1000
3000 REM --- subr.stippellijn ---
3010 IFABS(X1-X2)<ABS(Y1-Y2) THEN3070
3020 IFX1>X2 THENX0=X1:X1=X2:X2=X0:Y0=Y1:Y1=Y2:Y2=Y0
3030 A=X2-X1:B=Y2-Y1:D=A/20
3040 FORXP=0 TOA STEPD
3050 HO=.5+CX*(X1+XP):VE=.5+CY*(Y1+XP*B/A):GOSUB620
3060 NEXTXP:RETURN
3070 IFY1>Y2 THENY0=Y1:Y1=Y2:Y2=Y0:X0=X1:X1=X2:X2=X0
3080 A=X2-X1:B=Y2-Y1:D=B/20
3090 FORYP=0 TOB STEPD
3100 HO=.5+CX*(X1+YP*A/B):VE=.5+CY*(Y1+YP):GOSUB620
3110 NEXTYP:RETURN
25000 REM --- viervlak ---
25010 DATA11
25020 DATA-1,1,-1,1
25030 DATA1,1,-1,-1
25040 DATA-1,1,1,-1
25050 DATA2.3561945,.7853981,5.4977871,3.9269908
25060 DATA1.4142,1.4142,1.4142,1.4142
25070 DATA1,2,3,1,2,4,1,3,4,2,3,4
25080 DATA1,2,3,1,4,5,3,6,5,2,6,4
25090 REM --- kubus ---
25100 DATA22
25110 DATA-1,1,1,-1,-1,1,1,-1
25120 DATA1,1,1,1,-1,-1,-1,-1
25130 DATA-1,-1,1,1,-1,-1,1,1
25140 DATA2.3562,2.3562,.7854,.7854
25150 DATA3.927,3.927,5.4978,5.4978
25160 DATA1.4142,1.4142,1.4142,1.4142
25170 DATA1.4142,1.4142,1.4142,1.4142
25180 DATA1,2,3,4,5,6,7,8,1,4,8,5,2,3,7,6,1,2,6,5,4,3,7,8
25190 DATA1,2,3,4,5,6,7,8,4,12,8,9,2,11,6,10
25200 DATA1,10,5,9,3,11,7,12
25210 REM --- achtvlak ---
25220 DATA33
25230 DATA0,-1,0,1,0,0
25240 DATA1,0,0,0,0,-1
25250 DATA0,0,1,0,-1,0
25260 DATA1.5708,0,0,0,3.1416,4.712
25270 DATA1,0,1,0,1,1
25280 DATA1,2,3,1,3,4,1,4,5,1,5,2,6,2,3,6,3,4,6,4,5,6,5,2
25290 DATA1,5,2,2,6,3,3,7,4,4,8,1
25300 DATA9,5,10,10,6,11,11,7,12,12,8,9
25310 REM --- rhombendodekaeder ---
25320 DATA44
25330 DATA-1,1,1,-1,-1,1,1,-1,0,0,2,0,-2,0
25340 DATA1,1,1,1,-1,-1,-1,-1,2,0,0,0,0,-2
25350 DATA-1,-1,1,1,-1,-1,1,1,0,2,0,-2,0,0
25360 DATA2.3562,2.3562,.7854,.7854
25370 DATA3.927,3.927,5.4978,5.4978
25380 DATA1.5708,0,0,3.1416,0,4.7124
25390 DATA1.4142,1.4142,1.4142,1.4142
25400 DATA1.4142,1.4142,1.4142,1.4142
25410 DATA2,2,0,2,0,2
25420 DATA1,9,4,13,2,9,1,12,3,9,2,11,4,9,3,10
25430 DATA5,14,8,13,6,14,5,12,7,14,6,11,8,14,7,10
25440 DATA10,3,11,7,11,2,12,6,12,1,13,5,13,4,10,8
25450 DATA1,2,6,5,4,1,12,11,3,4,10,9,2,3,8,7
25460 DATA21,22,13,20,24,21,19,18,23,24,17,16,22,23,15,14
25470 DATA8,9,16,15,10,11,18,17,12,5,20,19,6,7,14,13
25480 REM --- pentagondodekaeder ---
25490 DATA55
25500 DATA-1,1,1,-1,-1,1,1,-1,0,0,0,0,1.618,1.618
25510 DATA-1.618,-1.618,-.618,.618,-.618,.618
25520 DATA1,1,1,1,-1,-1,-1,-1,1.618,1.618,-1.618,-1.618
25530 DATA.618,-.618,.618,-.618,0,0,0,0
25540 DATA-1,-1,1,1,-1,-1,1,1,.618,-.618,.618,-.618
25550 DATA0,0,0,0,1.618,1.618,-1.618,-1.618
25560 DATA2.356,2.356,.7854,.7854
25570 DATA3.927,3.927,5.4978,5.4978
25580 DATA1.2059,1.9356,5.0772,4.3475
25590 DATA1.571,4.712,1.5708,4.712
25600 DATA0,0,3.1416,3.1416
25610 DATA1.4142,1.4142,1.4142,1.4142
25620 DATA1.4142,1.4142,1.4142,1.4142
25630 DATA1.732,1.732,1.732,1.732
25640 DATA.618,.618,.618,.618,1.618,1.618,1.618,1.618
25650 DATA9,10,2,13,3,11,12,5,16,8
25660 DATA9,10,1,15,4,11,12,6,14,7
25670 DATA17,18,3,9,4,19,20,6,12,5
25680 DATA17,18,7,11,8,19,20,2,10,1
25690 DATA13,14,7,18,3,15,16,5,19,1
25700 DATA13,14,6,20,2,15,16,8,17,4
25710 DATA2,7,15,16,8,27,22,11,20,21
25720 DATA2,1,5,4,3,27,28,29,30,26
25730 DATA18,17,8,3,9,13,23,28,22,12
25740 DATA18,25,26,21,19,13,14,7,1,6
25750 DATA24,30,25,17,16,10,11,12,6,5
25760 DATA24,29,23,14,15,10,20,19,9,4
25770 REM --- ikosaeder ---
25780 DATA66
25790 DATA0,0,-.618,.618,-.618,.618,1,1,-1,-1,0,0
25800 DATA1,1,0,0,0,0,.618,-.618,.618,-.618,-1,-1
25810 DATA.618,-.618,1,1,-1,-1,0,0,0,0,.618,-.618
25820 DATA1.0172,2.1244,0,0,3.1415,3.1415
25830 DATA1.5708,4.7124,1.5708,4.7124,5.2659,4.1588
25840 DATA1.1758,1.1758,1,1,1,1
25850 DATA.618,.618,.618,.618,1.1758,1.1758
25860 DATA1,2,7,11,12,10,1,2,9,11,12,8,3,4,1,5,6,12
25870 DATA3,4,11,5,6,2,7,8,4,9,10,5,7,8,6,9,10,3
25880 DATA1,4,7,5,10,12,1,3,9,6,8,12,3,10,11,2,6,7
25890 DATA4,8,11,2,5,9
25900 DATA1,2,3,30,25,24,1,5,4,30,28,29,16,8,9,19,27,26
25910 DATA16,22,23,19,7,6,14,21,15,11,18,12,14,20,13,11,17
25920 DATA10,8,15,3,18,25,26,9,10,4,20,28,27,17,24,23,7,13,2
25930 DATA21,29,22,6,12,5
30000 REM -----------------------
30010 REM De variabelen:
30020 REM X() Y() Z() de coordinaten
30030 REM van de hoekpunten.
30040 REM A() hoek in rad. tussen de
30050 REM loodlijn op de rotatie-as
30060 REM en het y,z resp. x,z resp.
30070 REM x,y vlak.
30080 REM R() de lengte van deze
30090 REM loodlijn.
30100 REM P() de hoekpunten per vlak
30110 REM Q() de ribben per vlak.
30120 REM V() de vlak-orientatie,
30125 REM voor- en achterkant
30130 REM S() de lijst van getekende
30140 REM ribben, ter voorkoming van
30150 REM 2 x dezelfde lijn tekenen.
30160 REM E aantal hoekpunten
30170 REM F aantal vlakken
30180 REM G = E maal F
30190 REM H aantal hoekpunten p.vlak
30200 REM CX schaalfactor horizontaal
30210 REM cy schaalfactor vertikaal
30220 REM ZK DATA-zoekgetal
30230 REM U telvariabele bij tekenen
30240 REM---------------------------
30250 REM --- MSX COMPUTER ---
30260 REM---------------------------
32000 REM Ch.W.Brederode
32010 REM Von Bonninghausenlaan 33
32020 REM 2161 ES LISSE
32030 REM
32040 REM TROS-RADIO dd 891101