home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1987 July
/
1987-07.d64
/
cube.data
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
2KB
|
45 lines
10 poke55,255:poke56,99:rem cube data file maker
20 dim v(8,3),sv(8,2),s(6,5),n(6,3),e(12,3)
30 fori=1to8:forj=1to3:readv(i,j):nextj,i
40 fori=1to6:forj=1to5:reads(i,j):nextj,i
50 data 40,40,-40,40,40,40,40,-40,40,40,-40,-40
60 data -40,-40,-40,-40,-40,40,-40,40,40,-40,40,-40
70 data 1,2,3,4,1,1,8,7,2,1,8,5,6,7,8
80 data 5,4,3,6,5,2,7,6,3,2,4,5,8,1,4
90 cx=160:cy=100:th=.2:ph=.8:pd=2000:dt=20000
100 ns=95
400 printchr$(147);:input"filename";f$:pa=25600
410 print"computing screen number: ";
420 forsc=1tons:print sc;
430 gosub 1000
440 ifsc<>nsthenpokepa-1,254:nextsc
450 pokepa-1,255
460 sys57812 f$,8
470 poke193,0:poke194,100
480 poke174,int(pa)and255:poke175,int(pa/256):sys62954
490 print:print"animation data file ";chr$(34);f$;chr$(34);" is complete":end
500 pokepa,int(y1):pa=pa+1
510 pokepa,int(x1)and255:pa=pa+1:pokepa,int(x1/256):pa=pa+1
520 pokepa,int(y2):pa=pa+1
530 pokepa,int(x2)and255:pa=pa+1:pokepa,int(x2/256):pa=pa+1
540 pokepa,0:pa=pa+1:pokepa,0:pa=pa+1
550 return
1000 s1=sin(th):c1=cos(th):s2=sin(ph):c2=cos(ph)
1010 fori=1to8:x=v(i,1):y=v(i,2):z=v(i,3):sx=-x*s1+y*c1
1020 sy=-x*c1*c2-y*s1*c2+z*s2:sz=-x*s2*c1-y*s2*s1-z*c2+dt
1030 sv(i,1)=pd*(1.4*sx/sz)+cx:sv(i,2)=-pd*(sy/sz)+cy:next
1040 fori=1to6:f=s(i,1):g=s(i,2):h=s(i,3):u1=v(g,1)-v(f,1):u2=v(g,2)-v(f,2)
1050 u3=v(g,3)-v(f,3):v1=v(h,1)-v(f,1):v2=v(h,2)-v(f,2):v3=v(h,3)-v(f,3)
1060 n(i,1)=u2*v3-v2*u3:n(i,2)=u3*v1-v3*u1:n(i,3)=u1*v2-v1*u2:next
1070 xe=dt*s2*c1:ye=dt*s2*s1:ze=dt*c2:m=1
1080 fori=1to6:e2=s(i,1):wx=xe-v(e2,1):wy=ye-v(e2,2):wz=ze-v(e2,3)
1090 if(n(i,1)*wx+n(i,2)*wy+n(i,3)*wz)<=0then1140
1100 e1=s(i,1):forj=2to5:e2=s(i,j):fork=1tom
1110 ife(k,1)=e2ande(k,2)=e1thene(k,3)=2:goto 1130
1120 nextk:e(m,1)=e1:e(m,2)=e2:e(m,3)=1:m=m+1
1130 e1=e2:nextj
1140 nexti:fori=1to12:ife(i,3)=0then1160
1150 j=e(i,1):k=e(i,2):x1=sv(j,1):y1=sv(j,2):x2=sv(k,1):y2=sv(k,2):gosub500
1160 next:th=th+.06544985:ph=ph+.06544985:if sc<48 then pd=pd+583.3:return
1170 pd=pd-583.3:return