格子曲線

 投稿者:しばっち  投稿日:2019年 1月21日(月)19時30分33秒
  格子曲線(Grate curve)


PUBLIC NUMERIC X,Y,ALPHA
LET XSIZE=640
LET YSIZE=640
CALL GINIT(XSIZE,YSIZE)
CALL GRATE(4,90,XSIZE,YSIZE)
END

EXTERNAL  SUB TWO(A,C,W)
IF C<=1 THEN EXIT SUB
CALL RT(A)
CALL FD(1)
CALL RT(A)
CALL FD(W)
CALL LT(A)
IF C>1 THEN CALL FD(1)
CALL LT(A)
CALL FD(W)
CALL TWO(A,C-2,W)
END SUB

EXTERNAL  SUB SQUARE(A,H,W)
CALL FD(W)
CALL TWO(A,H-1,W)
END SUB

EXTERNAL  SUB GRATE(N,A,W,H)
IF N<=0 THEN
   CALL SQUARE(A,H,W)
   EXIT SUB
END IF
CALL RT(A)
CALL GRATE(N-1,-A,H/4,W)
CALL FD(H/8)
CALL GRATE(N-1,A,H/4,W)
CALL FD(H/8)
CALL GRATE(N-1,-A,H/4,W)
CALL LT(A)
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"
FOR I=0 TO 7
   SET COLOR MIX(I) BITAND(I,2)/2,BITAND(I,4)/4,BITAND(I,1)
NEXT I
CLEAR
SET COLOR 7
END SUB

EXTERNAL SUB FD(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 LT(R)
LET ALPHA=MOD(ALPHA+R+360,360)
END SUB

EXTERNAL SUB RT(R)
LET ALPHA=MOD(ALPHA-R+360,360)
END SUB
 

戻る