Cactus Fractal

 投稿者:しばっち  投稿日:2015年10月28日(水)22時16分15秒
 
!'Cactus Fractal
OPTION ARITHMETIC COMPLEX
LET SIZE=800
CALL GINIT(SIZE,SIZE)
LET KL=50
LET S=COMPLEX(-1,-1)
LET E=COMPLEX(1,1)
SET WINDOW RE(S),RE(E),IM(E),IM(S)
LET D=(E-S)/SIZE
FOR CR=RE(S) TO RE(E) STEP RE(D)
   FOR CI=IM(S) TO IM(E) STEP IM(D)
      LET C=COMPLEX(CR,CI)
      LET Z=C
      LET FL=0
      WHEN EXCEPTION IN
         FOR K=0 TO KL
            LET Z=CSIN(Z/C)
            IF ABS(Z)>2 THEN
               LET FL=1
               EXIT FOR
            END IF
         NEXT K
      USE
      END WHEN
      IF FL=1 THEN
         LET CC=MOD(K,7)
         CALL PSET(CR,CI,CC+1)
      END IF
   NEXT CI
NEXT CR
END

EXTERNAL FUNCTION CSIN(Z)
OPTION ARITHMETIC COMPLEX
LET I=SQR(-1)
LET CSIN=(EXP(I*Z)-EXP(-I*Z))/(2*I)
END FUNCTION

EXTERNAL SUB PSET(X,Y,C)
OPTION ARITHMETIC COMPLEX
SET POINT COLOR C
PLOT POINTS:X,Y
END SUB

EXTERNAL SUB GINIT(XSIZE,YSIZE)
OPTION ARITHMETIC COMPLEX
SET BITMAP SIZE XSIZE,YSIZE
!'SET WINDOW  0 , XSIZE-1 , YSIZE-1, 0
SET POINT STYLE 1
SET COLOR MIX(0) 0,0,0
SET COLOR MIX(1) 0,0,1
SET COLOR MIX(2) 1,0,0
SET COLOR MIX(3) 1,0,1
SET COLOR MIX(4) 0,1,0
SET COLOR MIX(5) 0,1,1
SET COLOR MIX(6) 1,1,0
SET COLOR MIX(7) 1,1,1
CLEAR
END SUB

EXTERNAL SUB LINE(XS,YS,XE,YE,C)
OPTION ARITHMETIC COMPLEX
SET COLOR C
PLOT LINES:XS,YS;XE,YE
END SUB
 

戻る