Barnsley's Tree

 投稿者:しばっち  投稿日:2015年10月28日(水)22時15分44秒
 
!'Barnsley's Tree
OPTION ARITHMETIC COMPLEX
LET SIZE=800
CALL GINIT(SIZE,SIZE)
LET KL=50
LET S=COMPLEX(-3,-3)
LET E=COMPLEX(3,3)
LET C=COMPLEX(.6,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 Z=COMPLEX(CR,CI)
      LET FL=0
      FOR K=0 TO KL
         LET Z=C*(Z-SGN(RE(Z)))
         IF ABS(Z)>2 THEN
            LET FL=1
            EXIT FOR
         END IF
      NEXT K
      IF FL=1 THEN
         LET CC=MOD(K,7)
         CALL PSET(CR,CI,CC+1)
      END IF
   NEXT CI
NEXT CR
END

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
 

戻る