r=10000 ;円形の半径(精度) dim px,r*2+1 ;座標格納用配列(なぜかこれでジャスト) fy=r repeat r+1 x=cnt y2=r*r-(x*x) ;三平方の定理 i=y2 : s=i repeat ;平方根計算ループ if i=0 : y=0 : break e=s : s=i/s+s>>1 if s>=e : y=s : break loop repeat fy-y+1 px.count=x count++ ;格納座標の個数のカウント loop fy=y loop dim sin,360 dim cos,360 repeat 90,1 ;cos.0は0でいいのでとばす c=count*cnt/90-1 cos.cnt=px.c*10000/r ;第一象限コサイン loop repeat 90 c=90-cnt sin.cnt=-cos.c ;第一象限サイン loop repeat 90,90 c=cnt-90 sin.cnt=cos.c ;第四象限サイン cos.cnt=-sin.c ;第四象限コサイン loop repeat 180,180 c=cnt-180 sin.cnt=-sin.c ;第二、第三象限サイン cos.cnt=-cos.c ;第二、第三象限コサイン loop #module #deffunc gspin int,int,int,int,int,int mref wid,0 ;ウィンドウID mref centx,1 ;回転の中心座標x mref centy,2 ;回転の中心座標y mref sizex,3 ;回転する画像の幅 mref sizey,4 ;回転する画像の高さ mref ang,5 ;回転する角度 angle=360-ang\360 ;移動元なので逆 begx=csrx : begy=csry repeat sizey cnt2=cnt repeat sizex cx=-(-sizex/2+cnt*sin@.angle)-(-sizey/2+cnt2*cos@.angle)/10000+centx cy=-sizex/2+cnt*cos@.angle-(-sizey/2+cnt2*sin@.angle)/10000+centy pos begx+cnt,begy+cnt2 : gcopy wid,cx,cy,1,1 loop loop return #global dialog "bmp;*.jpg",16,"画像ファイル" if stat=0 : end buffer 2 picload refstr picx=winx : picy=winy screen 0,picx,picy pos 0,0 : gspin 2,picx/2,picy/2,picx,picy,30 ;30度回転 stop |