C曲線

 投稿者:しばっち  投稿日:2014年10月23日(木)23時10分57秒
  CALL GINIT(640,400)
OPTION BASE 0
LET L=300
INPUT PROMPT "LEVEL=":NO
LET Y0=100
LET X0=400
LET R=45*NO
LET N=NO+1
DIM NN(N+1),LL(N+1)
DO
   LET R=R+45
   DO WHILE N>0
      LET NN(SP)=N
      LET LL(SP)=L
      LET SP=SP+1
      LET N=N-1
      LET L=L/SQR(2)
      LET R=R-90
   LOOP
   LET SP=SP-1
   LET N=NN(SP)
   LET L=LL(SP)
   IF N=1 THEN
      IF R>=360 THEN LET R=MOD(R+360,360)
      LET X=X0+COS(R*PI/180)*L
      LET Y=Y0-SIN(R*PI/180)*L
      CALL LINE(X0,Y0,X,Y,7)
      LET X0=X
      LET Y0=Y
   END IF
   LET N=N-1
   LET R=R+45
   LET L=L/SQR(2)
LOOP WHILE SP>0
END

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
END SUB

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

戻る