#include "d3m.hsp" randomize screen 0,720,540,0 p=0.0 q=300.0 r=700.0 h=100.0 v=0.0 u=0.0 d3setcam r,0,h,0,0,0;Z=100を基準面とする半径rの円 d3mkparticle 1,192,0,255 d3mkparticle 2,0,255,192 d3mkparticle 3,255,192,0 num=0 repeat gosub *maintain gosub *discribe gosub *advance await 10 if flag=0:num+=1 if flag=1:num-=1 numb=num if num=255:flag=1 if num=0:flag=0 loop *maintain x=p,q*cos(u),q*cos(u+M_PI/2),q*cos(u+M_PI),q*cos(u+M_PI*3/2),p y=p,q*sin(u),q*sin(u+M_PI/2),q*sin(u+M_PI),q*sin(u+M_PI*3/2),p z=q,p,p,p,p,-q /*点x1,y1,z1 x2,y2,z2 x3,y3,z3 x4,y4,z4 x5,y5,z5 x6,y6,z6 が六頂点 1,2,3が頂点だから、1,2,3,3を頂点とする三角形 因って、三角形を塗りつぶす配列は、 dx=x1,x2,x3,x3--- x1,x3,x4,x4--- x1,x4,x5,x5--- x1,x5,x2,x2 dy=y1,y2,y3,y3--- y1,y3,y4,y4--- y1,y4,y5,y5--- y1,y5,y2,y2 dz=z1,z2,z3,z3--- z1,z3,z4,z4--- z1,z4,z5,z5--- z1,z5,z2,z2 */ return *discribe d3setcam r*cos(v),r*sin(v),h,0,0,0 redraw 0 color 0,0,0:boxf dx=q,-q,-q,q:dy=q,q,-q,-q:dz=p,p,p,p color 64,64,64:d3square dx,dy,dz repeat 4,0 s=cnt\4+1 t=(cnt+1)\4+1 dx=x(0),x(s),x(t),x(t) dy=y(0),y(s),y(t),y(t) dz=z(0),z(s),z(t),z(t) color s*20,t*20,s*t gmode 5,,,numb d3square dx,dy,dz loop repeat 4,0 s=cnt\4+1 t=(cnt+1)\4+1 dx=x(5),x(s),x(t),x(t) dy=y(5),y(s),y(t),y(t) dz=z(5),z(s),z(t),z(t) color s*40,s*50,t*30 gmode 5,,,numb d3square dx,dy,dz loop color 128,128,128 d3line -300,0,0,300,0,0 d3line 0,-300,0,0,300,0 redraw 1 return *advance getkey hidari,37 getkey migi,39 getkey ue,38 getkey sita,40 getkey alter,13 getkey big,1 getkey small,2 if big=1:q+=1.0 if small=1:q-=1.0 if alter=1:{ val=rnd(256),rnd(256),rnd(256) } if hidari=1:v-=0.005 if migi=1:v+=0.005 if ue=1:h+=3 if sita=1:h-=3 u+=0.01 return