/* 画像ファイルの読込 */ extern _Px, _Py, _Q, _Pred; _Px=1;_Py=1;_Q=1;_Pred=1; skel=jpeg_read("Kodairi.jpeg"); /* 函数の定義 */ func animVolterra(A, B, K1, K2, X0, Y0, h, color=) { local i; X=X0; Y=Y0; for(i=1;i<301;i++){ X=h*(A-K1*Y)*X+X; Y=h*(K2*X-B)*Y+Y; pause,50; pldj,X0,Y0,X,Y,color=color; X0=X; Y0=Y;}; }; /* 述語で指定した領域を取出す函数を定義 */ func getDOMAIN(image, p0, pred, option=) { extern _Px, _Py, _Q, _Pred; local dnm,i,n,X,Y,Z; dnm=dimsof(image); Z=image; n=dnm(1); _Px=indgen(1:dnm(3))(,,-:1:dnm(4)); _Py=transpose(indgen(1:dnm(4))(,,-:1:dnm(3))); _Q =p0; predx=pred+" _Px _Py _Q "+option; funcdef(predx); for(i=1;i<=n;i++) Z(i,,)=Z(i,,)*_Pred; return Z;}; /* 最初に円状の領域を取出す為の述語 */ func Pred1(Px,Py,Qxy,r) { extern _Pred; _Pred=((Px-Qxy(1))^2+(Py-Qxy(2))^2<=r^2);}; /* 星型の領域を取出す為の述語 */ func Pred2(Px,Py,Qxy,r) { extern _Pred; Px=Px-Qxy(1); Py=Py-Qxy(2); th=pi*2/5; L1=(1-cos(2*th))/sin(2*th)*Px+r-Py; L2=(cos(4*th)-cos(2*th))/(sin(2*th)-sin(4*th))* (Px+r*sin(2*th))+r*cos(2*th)-Py; L3=r*cos(th)-Py; L4=(cos(3*th)-cos(th))/(sin(th)-sin(3*th))* (Px+r*sin(th))+r*cos(th)-Py; L5=(1-cos(3*th))/sin(3*th)*(Px+r*sin(3*th))+r*cos(3*th)-Py; pL1=(L1>=0); mL1=(L1<=0); pL2=(L2>=0); mL2=(L2<=0); pL3=(L3>=0); mL3=(L3<=0); pL4=(L4>=0); mL4=(L4<=0); pL5=(L5>=0); mL5=(L5<=0); R1=pL1*pL5*mL3; R2=pL3*mL4*mL1; R3=pL1*mL2*pL4; R4=pL2*mL4*pL5; R5=pL3*mL2*mL5; R6=pL1*pL3*pL5*mL2*mL4; _Pred=((R1+R2+R3+R4+R5+R6)>0);}; /* 光圀 */ Hero=getDOMAIN(skel(,,::-1),[1500,777],"Pred2", option="200"); /* 滝夜叉姫 */ Hime=getDOMAIN(skel(,,::-1),[500,1300],"Pred1",option="300"); /* 手下 */ Maru=getDOMAIN(skel(,,::-1),[2000,500],"Pred2",option="200"); /* 髑髏 */ Gai=getDOMAIN(skel(,,::-1),[1750,1300],"Pred1",option="400"); AllStars=Hime+Hero+Maru+Gai;