|
!'Cesaro Fractal
PUBLIC NUMERIC X,Y,ALPHA,R1,L1,L2,CC,XX,YY
CALL GINIT(800,800)
INPUT PROMPT "LEVEL=":N
RESTORE 2
READ XX,YY,R1
1 DATA .5,.288675134,60 !'SQR(3)/6=0.2886...
2 DATA .5,.45,85
3 DATA .3,.4,85
LET CC=YY/TAN(RAD(R1))
LET L1=XX-CC
LET L2=CC/COS(RAD(R1))
LET X=100
LET Y=700
LET L=600
FOR I=1 TO 4
CALL RECURSIVE(N,L)
CALL TURN(90)
NEXT I
END
EXTERNAL SUB RECURSIVE(LEV,L)
IF LEV=0 THEN
CALL MOVE(L)
ELSE
CALL RECURSIVE(LEV-1,L*L1)
CALL TURN(R1)
CALL RECURSIVE(LEV-1,L*L2)
CALL TURN(-2*R1)
CALL RECURSIVE(LEV-1,L*L2)
CALL TURN(R1)
CALL RECURSIVE(LEV-1,L*(1-(XX+CC)))
END IF
END SUB
EXTERNAL SUB GINIT(XSIZE,YSIZE)
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0,XSIZE-1,YSIZE-1,0
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
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
SET COLOR 7
END SUB
EXTERNAL SUB MOVE(L)
PLOT LINES:X,Y;
LET X=X+L*COS(ALPHA*PI/180)
LET Y=Y-L*SIN(ALPHA*PI/180)
PLOT LINES:X,Y;
END SUB
EXTERNAL SUB TURN(R)
LET ALPHA=MOD(ALPHA+R+360,360)
END SUB
|
|