フラクタル画像

 投稿者:しばっち  投稿日:2020年12月22日(火)19時46分6秒
  フラクタル画像
http://souzousha.iinaa.net/www/hata/Index.html

OPTION ARITHMETIC COMPLEX
PUBLIC NUMERIC A,B,C,D,FL,XMIN,XMAX,YMIN,YMAX,X0,Y0
SET POINT STYLE 1
SET TEXT COLOR 4
DO
   LET I=I+1
   LET XMIN=1E+10
   LET YMIN=XMIN
   LET XMAX=-1E+10
   LET YMAX=XMAX
   LET X0=0
   LET Y0=0
   LET FL=0
   LET N=12
   READ IF MISSING THEN EXIT DO:AR,AI,BR,BI,CR,CI,DR,DI
   LET A=COMPLEX(AR,AI)
   LET B=COMPLEX(BR,BI)
   LET C=COMPLEX(CR,CI)
   LET D=COMPLEX(DR,DI)
   CALL DRAW(N,0)
   LET XM=(XMAX-XMIN)/2*1.5
   LET YM=(YMAX-YMIN)/2*1.5
   LET X0=X0/2^N
   LET Y0=Y0/2^N
   SET WINDOW -MAX(XM,YM),MAX(XM,YM),-MAX(XM,YM),MAX(XM,YM)
   LET FL=1
   CALL DRAW(17,0)
   ASK TEXT HEIGHT HEIGHT
   PLOT TEXT ,AT -MAX(XM,YM),MAX(XM,YM)-1.5*HEIGHT:"A="&FORMAT$(A)
   PLOT TEXT ,AT -MAX(XM,YM),MAX(XM,YM)-3*HEIGHT:"B="&FORMAT$(B)
   PLOT TEXT ,AT -MAX(XM,YM),MAX(XM,YM)-4.5*HEIGHT:"C="&FORMAT$(C)
   PLOT TEXT ,AT -MAX(XM,YM),MAX(XM,YM)-6*HEIGHT:"D="&FORMAT$(D)
   !'GSAVE "フラクタル"&USING$("%%%",I)&".png"
   WAIT DELAY 1
   CLEAR
LOOP
DATA 0,0,.5,.288675134594813,0,0,.5,-.288675134594813
DATA 0,0,.4614,.4614,.622,-.196,0,0
DATA .4614,.4614,0,0,0,0,.622,-.196
DATA 0,0,.5,.28867,0,0,.6667,0
DATA 0,0,0,.6667,0,0,.6667,0
DATA 0,.7071,0,0,.5,0,0,0
DATA 0,0,.4,.5,0,0,.4,-.5
DATA .4614,.4614,0,0,0,0,.2896,-.585
DATA .4614,.4614,0,0,.622,-.196,0,0
DATA .1,.1,.5,.3,-.1,-.1,.5,-.3
DATA 0,.2887,.5,.2887,0,-.2887,.5,-.2887
DATA .5,.2887,0,0,.5,-.2887,0,0
DATA .5,.4,0,.4,.5,-.4,0,-.4
DATA .5,-.05,0,0,.5,.05,0,0
DATA 0,0,-.5,-.5,0,0,-.5,.5
DATA .5,-.5,0,0,-.5,-.5,0,0
DATA .3,.6,0,0,-.3,.6,0,0
DATA -.3,.7,0,0,.3,-.6,0,0
DATA -.3,.6,0,0,.3,-.6,0,0
DATA .3,.7,0,0,0,0,.2,.5
DATA .2,.7,0,0,0,0,.2,.6
DATA 0,0,-.5,-.5,0,0,0,.7
DATA .6,.2,0,0,0,0,.67,0
DATA .7,.2,0,0,0,0,.67,0
DATA .67,-.5,0,0,-.25,.5,0,0
DATA .55,-.45,0,0,.8,.2,0,0
DATA .71,-.44,.05,0,.73,.5,.02,0
DATA .71,-.37,0,0,.71,.37,0,0
DATA .8,-.5,0,0,.8,.5,0,0
DATA .1,0,.5,.3,.1,0,.67,0
DATA -.25,.5,0,0,0,0,.75,0
DATA 0,0,.8,0,0,0,-.2,-.4
DATA 0,0,.8,.1,0,0,-.2,-.4
DATA 0,0,.3,.6,0,0,-.3,-.6
DATA .7,.1,0,.3,0,.2,.7,0
DATA -.25,.5,0,0,0,0,0,.7
DATA .1,0,.3,.6,.1,0,.3,-.6
DATA .3,.6,-.1,-.1,.1,.1,-.3,-.6
DATA .3,.6,0,0,0,0,-.3,-.6
DATA .3,.8,0,0,0,0,-.3,-.3
DATA .5,-.5,0,0,-.25,.5,0,0
DATA .5,-.6,0,0,-.1,.5,0,0
DATA 0,0,.5,.7,0,0,.7,0
DATA 0,0,.5,.3,0,0,.5,.65
DATA 0,0,.5,.3,0,0,.5,.85
DATA .8,-.2,.1,.1,.1,.2,.6,-.2
DATA .8,.2,.1,.1,.1,.2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A 0,0,.1,.4,.5,-.8,.4,0
DATA 0,.1,.1,.4,.5,-.8,.2,0
DATA 0,.1,.1,.4,.5,-.9,.2,0
DATA 0,.2,.1,.4,.5,-.9,.2,0
DATA .2,.2,.1,.4,.5,-.78,-.1,0
DATA 0,.2,.3,-.5,.5,-.8,0,-.2
DATA .5,.3,.1,0,.1,0,.7,0
DATA .5,-.5,.1,0,.1,0,.6,0
DATA .5,-.66,.1,0,.1,0,.6,0
DATA .5,-.6,0,0,0,0,.5,-.6
DATA .5,-.6,0,0,.1,0,.5,-.6
DATA .5,-.6,0,-.15,0,.1,.5,-.6
DATA .5,-.6,0,-.15,0,-.15,.5,-.6
DATA .5,.3,0,0,0,0,.5,-.3
DATA .5,.3,.2,0,0,0,.5,-.3
DATA .5,.3,.2,.2,0,0,.5,-.3
DATA .5,.3,.2,0,.1,.1,.5,-.3
DATA .5,.3,.1,.2,-.1,-.2,.5,-.3
DATA .3,-.7,0,-.15,0,-.15,.3,-.7
DATA .3,-.7,.1,-.2,.1,-.2,.3,-.7
DATA .2,-.7,.1,-.2,.1,-.2,.2,-.7
DATA .2,-.7,.1,.25,0,.25,.2,-.7
DATA .2,-.8,.1,.25,0,.25,.2,-.7
DATA .2,-.8,.1,.4,0,.4,.2,-.8
DATA .2,-.8,0,.45,0,.45,.2,-.8
DATA .3,-.8,.1,-.2,.1,.2,.3,-.2
DATA .6,-.8,.1,-.2,.1,.2,.3,-.3
DATA -.25,.5,0,0,0,0,.75,0
DATA 0,.5,0,0,0,0,.75,0
DATA -.5,.5,0,0,0,0,0,.5
DATA -.7,.5,0,0,0,0,0,.4
END

EXTERNAL  FUNCTION FORMAT$(Z)
OPTION ARITHMETIC COMPLEX
IF IM(Z)<0 THEN LET SIGN$=" - " ELSE LET SIGN$=" + "
LET FORMAT$=USING$("-%.####",RE(Z))&SIGN$&USING$("%.####",ABS(IM(Z)))&"i"
END FUNCTION

EXTERNAL  SUB DRAW(N,Z)
OPTION ARITHMETIC COMPLEX
IF N>0 THEN
   CALL DRAW(N-1,A*Z+B*CONJ(Z))
   CALL DRAW(N-1,C*(Z-1)+D*(CONJ(Z)-1)+1)
   IF FL=0 THEN
      LET XMIN=MIN(XMIN,RE(Z))
      LET XMAX=MAX(XMAX,RE(Z))
      LET YMIN=MIN(YMIN,IM(Z))
      LET YMAX=MAX(YMAX,IM(Z))
      LET X0=X0+RE(Z)
      LET Y0=Y0+IM(Z)
   ELSE
      PLOT POINTS:Z-COMPLEX(X0,Y0)
   END IF
END IF
END SUB
 

フラクタル画像

 投稿者:しばっち  投稿日:2020年12月22日(火)19時51分7秒
  スライドバーでパラメータを操作できるようにしてみました。


OPTION ARITHMETIC COMPLEX
PUBLIC NUMERIC A,B,C,D,FL,XMIN,XMAX,YMIN,YMAX,X0,Y0
SET POINT STYLE 1
LOCATE VALUE NOWAIT(1),RANGE -1 TO 1,AT 0:AR
LOCATE VALUE NOWAIT(2),RANGE -1 TO 1,AT 0:AI
LOCATE VALUE NOWAIT(3),RANGE -1 TO 1,AT .5:BR
LOCATE VALUE NOWAIT(4),RANGE -1 TO 1,AT .288:BI
LOCATE VALUE NOWAIT(5),RANGE -1 TO 1,AT 0:CR
LOCATE VALUE NOWAIT(6),RANGE -1 TO 1,AT 0:CI
LOCATE VALUE NOWAIT(7),RANGE -1 TO 1,AT .5:DR
LOCATE VALUE NOWAIT(8),RANGE -1 TO 1,AT -.288:DI
LOCATE VALUE NOWAIT(9),RANGE -1 TO 1,AT 0:ZR
LOCATE VALUE NOWAIT(10),RANGE -1 TO 1,AT 0:ZI
LOCATE VALUE NOWAIT(11),RANGE .1 TO 2,AT 1:SCALE
DO
   LOCATE VALUE NOWAIT(1):AR
   LOCATE VALUE NOWAIT(2):AI
   LOCATE VALUE NOWAIT(3):BR
   LOCATE VALUE NOWAIT(4):BI
   LOCATE VALUE NOWAIT(5):CR
   LOCATE VALUE NOWAIT(6):CI
   LOCATE VALUE NOWAIT(7):DR
   LOCATE VALUE NOWAIT(8):DI
   LOCATE VALUE NOWAIT(9):ZR
   LOCATE VALUE NOWAIT(10):ZI
   LOCATE VALUE NOWAIT(11):SCALE
   LET XMIN=1E+10
   LET YMIN=XMIN
   LET XMAX=-1E+10
   LET YMAX=XMAX
   LET X0=0
   LET Y0=0
   LET FL=0
   LET N=10
   LET A=COMPLEX(AR,AI)
   LET B=COMPLEX(BR,BI)
   LET C=COMPLEX(CR,CI)
   LET D=COMPLEX(DR,DI)
   LET Z0=COMPLEX(ZR,ZI)
   CALL DRAW(N,Z0)
   LET XM=(XMAX-XMIN)/2*1.3
   LET YM=(YMAX-YMIN)/2*1.3
   LET X0=X0/2^N
   LET Y0=Y0/2^N
   SET WINDOW -MAX(XM,YM)*SCALE,MAX(XM,YM)*SCALE,-MAX(XM,YM)*SCALE,MAX(XM,YM)*SCALE
   DRAW GRID(MAX(XM,YM)*SCALE/5,MAX(XM,YM)*SCALE/5)
   LET FL=1
   CALL DRAW(16,Z0)
   ASK TEXT HEIGHT HEIGHT
   PLOT TEXT ,AT -MAX(XM,YM)*SCALE,MAX(XM,YM)*SCALE-1.5*HEIGHT:"A="&FORMAT$(A)
   PLOT TEXT ,AT -MAX(XM,YM)*SCALE,MAX(XM,YM)*SCALE-3*HEIGHT:"B="&FORMAT$(B)
   PLOT TEXT ,AT -MAX(XM,YM)*SCALE,MAX(XM,YM)*SCALE-4.5*HEIGHT:"C="&FORMAT$(C)
   PLOT TEXT ,AT -MAX(XM,YM)*SCALE,MAX(XM,YM)*SCALE-6*HEIGHT:"D="&FORMAT$(D)
   PLOT TEXT ,AT -MAX(XM,YM)*SCALE,MAX(XM,YM)*SCALE-7.5*HEIGHT:"Z0="&FORMAT$(Z0)
   SET DRAW MODE EXPLICIT
   WAIT DELAY .3
   SET DRAW MODE HIDDEN
   CLEAR
LOOP
END

EXTERNAL  FUNCTION FORMAT$(Z)
OPTION ARITHMETIC COMPLEX
IF IM(Z)<0 THEN LET SIGN$=" - " ELSE LET SIGN$=" + "
LET FORMAT$=USING$("-%.###",RE(Z))&SIGN$&USING$("%.###",ABS(IM(Z)))&"i"
END FUNCTION

EXTERNAL  SUB DRAW(N,Z)
OPTION ARITHMETIC COMPLEX
IF N>0 THEN
   CALL DRAW(N-1,A*Z+B*CONJ(Z))
   CALL DRAW(N-1,C*(Z-1)+D*(CONJ(Z)-1)+1)
   IF FL=0 THEN
      LET XMIN=MIN(XMIN,RE(Z))
      LET XMAX=MAX(XMAX,RE(Z))
      LET YMIN=MIN(YMIN,IM(Z))
      LET YMAX=MAX(YMAX,IM(Z))
      LET X0=X0+RE(Z)
      LET Y0=Y0+IM(Z)
   ELSE
      SET POINT COLOR 2
      PLOT POINTS:A*Z+B*CONJ(Z)-COMPLEX(X0,Y0)
      SET POINT COLOR 4
      PLOT POINTS:C*(Z-1)+D*(CONJ(Z)-1)+1-COMPLEX(X0,Y0)
   END IF
END IF
END SUB
 

戻る