|
https://hp.vector.co.jp/authors/VA008683/QA9.htm
下記のようにすれば直接 PS(EPS)ファイルを書き出せる。
http://denki.nara-edu.ac.jp/~yabu/soft/ps.html
http://ruby.kyoto-wu.ac.jp/~konami/Documents/ps/psmemo.html
https://oku.edu.mie-u.ac.jp/~okumura/ps/
PUBLIC NUMERIC L1,L2,LTH,RTH,XSIZE,YSIZE
LET XSIZE=600
LET YSIZE=600
FILE GETSAVENAME F$,"PSファイル|*.ps"
IF F$="" THEN STOP
IF POS(UCASE$(F$),".PS")=0 THEN LET F$=F$ & ".ps"
CALL GINIT(F$,XSIZE,YSIZE)
INPUT PROMPT "LEVEL=":N
LET L1=1/SQR(3)
LET L2=2/3
LET LTH=22.5
LET RTH=0
CALL RECURSIVE(N,0,300,600,300,1,#1)
CALL GCLOSE
SUB GINIT(F$,XSIZE,YSIZE)
OPEN #1:NAME F$
ERASE #1
PRINT #1:"%!"
PRINT #1:"%%BoundingBox: 0 0";XSIZE;YSIZE
PRINT #1:"newpath"
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0,XSIZE-1,0,YSIZE-1
CLEAR
END SUB
SUB GCLOSE
PRINT #1:"showpage"
CLOSE #1
END SUB
END
EXTERNAL SUB RECURSIVE(N,X1,Y1,X2,Y2,SIGN,#1) !'葉脈
IF N=0 THEN
CALL LINE(X1,Y1,X2,Y2,#1)
ELSE
LET AX=L1*(X2-X1)*COS(SIGN*LTH*PI/180)-L1*(Y2-Y1)*SIN(SIGN*LTH*PI/180)+X1
LET AY=L1*(X2-X1)*SIN(SIGN*LTH*PI/180)+L1*(Y2-Y1)*COS(SIGN*LTH*PI/180)+Y1
CALL RECURSIVE(N-1,X1,Y1,AX,AY,-SIGN,#1)
LET AX=L2*(X1-X2)*COS(-SIGN*RTH*PI/180)-L2*(Y1-Y2)*SIN(-SIGN*RTH*PI/180)+X2
LET AY=L2*(X1-X2)*SIN(-SIGN*RTH*PI/180)+L2*(Y1-Y2)*COS(-SIGN*RTH*PI/180)+Y2
CALL RECURSIVE(N-1,AX,AY,X2,Y2,-SIGN,#1)
END IF
END SUB
EXTERNAL SUB LINE(XS,YS,XE,YE,#1)
PLOT LINES:XS,YS;XE,YE
PRINT #1:PIXELX(XS);PIXELY(YS);"moveto"
PRINT #1:PIXELX(XE);PIXELY(YE);"lineto"
PRINT #1:"stroke"
END SUB
|
|