投稿者:しばっち
投稿日:2012年10月21日(日)16時11分14秒
|
|
|
PUBLIC STRING F$
LET XSIZE=800
LET YSIZE=800
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0 , XSIZE-1 , YSIZE-1, 0
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
LET X=400
LET Y=400
LET L=3^5
LET N=4
!'INPUT PROMPT "LEVEL=": N
!'LET F$="シェルピンスキーのカーペット.svg"
IF F$<>"" THEN
OPEN #1:NAME F$
ERASE #1
PRINT #1:"<?xml version=";CHR$(34);"1.0";CHR$(34);" encoding=";CHR$(34);"utf-8";CHR$(34);"?>"
PRINT #1:"<!DOCTYPE svg PUBLIC ";CHR$(34);"-//W3C//DTD SVG 1.1//EN";CHR$(34);" ";CHR$(34);"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";CHR$(34);" ["
PRINT #1:" <!ENTITY ns_svg ";CHR$(34);"http://www.w3.org/2000/svg";CHR$(34);">"
PRINT #1:" <!ENTITY ns_xlink ";CHR$(34);"http://www.w3.org/1999/xlink";CHR$(34);">"
PRINT #1:"]>"
PRINT #1:"<svg version=";CHR$(34);"1.1";CHR$(34);" xmlns=";CHR$(34);"&ns_svg;";CHR$(34);" width=";CHR$(34);STR$(XSIZE);CHR$(34);" height=";CHR$(34);STR$(YSIZE);CHR$(34);" viewBox=";CHR$(34);"0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34)
PRINT #1:" overflow=";CHR$(34);"visible";CHR$(34);" enable-background=";CHR$(34);"new 0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34);" xml:space=";CHR$(34);"preserve";CHR$(34);">"
END IF
CALL RECURSIVE(N,X,Y,L,#1)
IF F$<>"" THEN
PRINT #1:"</svg>"
CLOSE #1
END IF
END
EXTERNAL SUB RECURSIVE(N,X,Y,L,#1)
IF N=0 THEN
PLOT AREA:X-2*L,Y-2*L;X-2*L,Y+2*L;X+2*L,Y+2*L;X+2*L,Y-2*L
IF F$<>"" THEN
PRINT #1:"<polygon points=";CHR$(34);STR$(INT(X-2*L));",";STR$(INT(Y-2*L));" ";
PRINT #1:STR$(INT(X-2*L));",";STR$(INT(Y+2*L));" ";
PRINT #1:STR$(INT(X+2*L));",";STR$(INT(Y+2*L));" ";
PRINT #1:STR$(INT(X+2*L));",";STR$(INT(Y-2*L));" ";
PRINT #1:STR$(INT(X-2*L));",";STR$(INT(Y-2*L));CHR$(34);" fill=";CHR$(34);"black";CHR$(34);" stork=";CHR$(34);"black";CHR$(34);" stroke-width=";CHR$(34);"1";CHR$(34);"/>"
END IF
ELSE
CALL RECURSIVE(N-1,X-L,Y-L,L/3,#1)
CALL RECURSIVE(N-1,X-L,Y,L/3,#1)
CALL RECURSIVE(N-1,X-L,Y+L,L/3,#1)
CALL RECURSIVE(N-1,X,Y-L,L/3,#1)
CALL RECURSIVE(N-1,X,Y+L,L/3,#1)
CALL RECURSIVE(N-1,X+L,Y-L,L/3,#1)
CALL RECURSIVE(N-1,X+L,Y,L/3,#1)
CALL RECURSIVE(N-1,X+L,Y+L,L/3,#1)
END IF
END SUB
|
|
|
投稿者:しばっち
投稿日:2012年10月21日(日)16時11分57秒
|
|
|
PUBLIC NUMERIC XSIZE,YSIZE
PUBLIC STRING F$
LET XSIZE=400
LET YSIZE=400
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0 , XSIZE-1 , YSIZE-1,0
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
LET D=.3
!'DO
!' INPUT PROMPT "比率(0<D<1)=": D
!'LOOP WHILE D <= 0 OR D >= 1
LET N=3
!'INPUT PROMPT "LEVEL": N
!'LET F$="カントル集合.svg"
IF F$<>"" THEN
OPEN #1:NAME F$
ERASE #1
PRINT #1:"<?xml version=";CHR$(34);"1.0";CHR$(34);" encoding=";CHR$(34);"utf-8";CHR$(34);"?>"
PRINT #1:"<!DOCTYPE svg PUBLIC ";CHR$(34);"-//W3C//DTD SVG 1.1//EN";CHR$(34);" ";CHR$(34);"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";CHR$(34);" ["
PRINT #1:" <!ENTITY ns_svg ";CHR$(34);"http://www.w3.org/2000/svg";CHR$(34);">"
PRINT #1:" <!ENTITY ns_xlink ";CHR$(34);"http://www.w3.org/1999/xlink";CHR$(34);">"
PRINT #1:"]>"
PRINT #1:"<svg version=";CHR$(34);"1.1";CHR$(34);" xmlns=";CHR$(34);"&ns_svg;";CHR$(34);" width=";CHR$(34);STR$(XSIZE);CHR$(34);" height=";CHR$(34);STR$(YSIZE);CHR$(34);" viewBox=";CHR$(34);"0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34)
PRINT #1:" overflow=";CHR$(34);"visible";CHR$(34);" enable-background=";CHR$(34);"new 0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34);" xml:space=";CHR$(34);"preserve";CHR$(34);">"
END IF
LET X = XSIZE/2
LET L = XSIZE
CALL RECURSIVE(N,X,L,D,#1)
IF F$<>"" THEN
PRINT #1:"</svg>"
CLOSE #1
END IF
END
EXTERNAL SUB RECURSIVE(N,X,L,D,#1)
IF N>0 THEN
LET XS = X - L * D / 2
LET XE = X + L * D / 2
CALL BOXFULL(XS, 0,XE, YSIZE-1, #1)
CALL BOXFULL(0, XS,XSIZE-1, XE, #1)
CALL RECURSIVE(N-1,X - L * ((D / 2 + (1 - D) / 4)),L * (1 - D) / 2,D,#1)
CALL RECURSIVE(N-1,X + L * ((D / 2 + (1 - D) / 4)),L * (1 - D) / 2,D,#1)
END IF
END SUB
EXTERNAL SUB BOXFULL(XS,YS,XE,YE,#1)
PLOT AREA:XS,YS;XS,YE;XE,YE;XE,YS
IF F$<>"" THEN
PRINT #1:"<polygon points=";CHR$(34);
PRINT #1:STR$(INT(XS));",";STR$(INT(YS));" ";
PRINT #1:STR$(INT(XS));",";STR$(INT(YE));" ";
PRINT #1:STR$(INT(XE));",";STR$(INT(YE));" ";
PRINT #1:STR$(INT(XE));",";STR$(INT(YS));" ";
PRINT #1:STR$(INT(XS));",";STR$(INT(YS));" ";
PRINT #1:CHR$(34);" fill=";CHR$(34);"black";CHR$(34);" stork=";CHR$(34);"black";CHR$(34);" stroke-width=";CHR$(34);"1";CHR$(34);"/>"
END IF
END SUB
|
|
|
投稿者:しばっち
投稿日:2012年10月21日(日)16時12分35秒
|
|
|
PUBLIC NUMERIC X,Y,THETA
PUBLIC STRING F$
LET XSIZE=600
LET YSIZE=600
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0 , XSIZE-1 , YSIZE-1, 0
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
LET N=4
!'INPUT PROMPT "LEVEL=": N
!'LET F$="コッホ星.svg"
IF F$<>"" THEN
OPEN #1:NAME F$
ERASE #1
PRINT #1:"<?xml version=";CHR$(34);"1.0";CHR$(34);" encoding=";CHR$(34);"utf-8";CHR$(34);"?>"
PRINT #1:"<!DOCTYPE svg PUBLIC ";CHR$(34);"-//W3C//DTD SVG 1.1//EN";CHR$(34);" ";CHR$(34);"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";CHR$(34);" ["
PRINT #1:" <!ENTITY ns_svg ";CHR$(34);"http://www.w3.org/2000/svg";CHR$(34);">"
PRINT #1:" <!ENTITY ns_xlink ";CHR$(34);"http://www.w3.org/1999/xlink";CHR$(34);">"
PRINT #1:"]>"
PRINT #1:"<svg version=";CHR$(34);"1.1";CHR$(34);" xmlns=";CHR$(34);"&ns_svg;";CHR$(34);" width=";CHR$(34);STR$(XSIZE);CHR$(34);" height=";CHR$(34);STR$(YSIZE);CHR$(34);" viewBox=";CHR$(34);"0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34)
PRINT #1:" overflow=";CHR$(34);"visible";CHR$(34);" enable-background=";CHR$(34);"new 0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34);" xml:space=";CHR$(34);"preserve";CHR$(34);">"
END IF
LET X=10
LET Y=380
LET L=550
FOR I=1 TO 5
CALL RECURSIVE(N,L,#1)
LET THETA=THETA+144
NEXT I
IF F$<>"" THEN
PRINT #1:"</svg>"
CLOSE #1
END IF
END
EXTERNAL SUB RECURSIVE(LEV,L,#1)
IF LEV=0 THEN
LET XX=X+L*COS(THETA*PI/180)
LET YY=Y-L*SIN(THETA*PI/180)
PLOT LINES: X,Y;XX,YY
IF F$<>"" THEN PRINT #1:"<line x1=";CHR$(34);STR$(INT(X));CHR$(34);" y1=";CHR$(34);STR$(INT(Y));CHR$(34);" x2=";CHR$(34);STR$(INT(XX));CHR$(34);" y2=";CHR$(34);STR$(INT(YY));CHR$(34);" stroke=";CHR$(34);"black";CHR$(34);" stroke-width=";CHR$(34);"1";CHR$(34);"/>"
LET X=XX
LET Y=YY
ELSE
CALL RECURSIVE(LEV-1,L/3,#1)
LET THETA=THETA+60
CALL RECURSIVE(LEV-1,L/3,#1)
LET THETA=THETA-120
CALL RECURSIVE(LEV-1,L/3,#1)
LET THETA=THETA+60
CALL RECURSIVE(LEV-1,L/3,#1)
END IF
END SUB
|
|
|
投稿者:しばっち
投稿日:2012年10月21日(日)16時13分43秒
|
|
|
PUBLIC NUMERIC X,Y,THETA,RR,L1,L2
PUBLIC STRING F$
LET XSIZE=600
LET YSIZE=600
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0 , XSIZE-1 , YSIZE-1, 0
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
LET N=3
!'INPUT PROMPT "LEVEL=": N
LET K=5
LET L=450
LET PX=.3
LET PY=0
LET THETA=90
LET GX=.5*COS(PI/K)
LET GY=.5*SIN(PI/K)
LET L1=PX
LET L2=SQR((PX-GX)^2+(PY-GY)^2)
LET RR=ATN((GY-PY)/(GX-PX))*180/PI
!'LET F$="再帰図形.svg"
IF F$<>"" THEN
OPEN #1:NAME F$
ERASE #1
PRINT #1:"<?xml version=";CHR$(34);"1.0";CHR$(34);" encoding=";CHR$(34);"utf-8";CHR$(34);"?>"
PRINT #1:"<!DOCTYPE svg PUBLIC ";CHR$(34);"-//W3C//DTD SVG 1.1//EN";CHR$(34);" ";CHR$(34);"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";CHR$(34);" ["
PRINT #1:" <!ENTITY ns_svg ";CHR$(34);"http://www.w3.org/2000/svg";CHR$(34);">"
PRINT #1:" <!ENTITY ns_xlink ";CHR$(34);"http://www.w3.org/1999/xlink";CHR$(34);">"
PRINT #1:"]>"
PRINT #1:"<svg version=";CHR$(34);"1.1";CHR$(34);" xmlns=";CHR$(34);"&ns_svg;";CHR$(34);" width=";CHR$(34);STR$(XSIZE);CHR$(34);" height=";CHR$(34);STR$(YSIZE);CHR$(34);" viewBox=";CHR$(34);"0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34)
PRINT #1:" overflow=";CHR$(34);"visible";CHR$(34);" enable-background=";CHR$(34);"new 0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34);" xml:space=";CHR$(34);"preserve";CHR$(34);">"
END IF
FOR I=1 TO K
LET X=300
LET Y=300
LET THETA=THETA+360/K
CALL RECURSIVE1(N,L,#1)
LET X=300
LET Y=300
CALL RECURSIVE2(N,L,#1)
NEXT I
IF F$<>"" THEN
PRINT #1:"</svg>"
CLOSE #1
END IF
END
EXTERNAL SUB RECURSIVE1(LEV,L,#1)
IF LEV=0 THEN
LET XX=X+L*COS(THETA*PI/180)
LET YY=Y-L*SIN(THETA*PI/180)
PLOT LINES: X,Y;XX,YY
IF F$<>"" THEN PRINT #1:"<line x1=";CHR$(34);STR$(INT(X));CHR$(34);" y1=";CHR$(34);STR$(INT(Y));CHR$(34);" x2=";CHR$(34);STR$(INT(XX));CHR$(34);" y2=";CHR$(34);STR$(INT(YY));CHR$(34);" stroke=";CHR$(34);"black";CHR$(34);" stroke-width=";CHR$(34);"1";CHR$(34);"/>"
LET X=XX
LET Y=YY
ELSE
CALL RECURSIVE1(LEV-1,L*L1,#1)
LET THETA=THETA+RR
CALL RECURSIVE1(LEV-1,L*L2,#1)
LET THETA=THETA-2*RR
CALL RECURSIVE1(LEV-1,L*L2,#1)
LET THETA=THETA+RR
CALL RECURSIVE1(LEV-1,L*L1,#1)
END IF
END SUB
EXTERNAL SUB RECURSIVE2(LEV,L,#1)
IF LEV=0 THEN
LET XX=X+L*COS(THETA*PI/180)
LET YY=Y-L*SIN(THETA*PI/180)
PLOT LINES: X,Y;XX,YY
IF F$<>"" THEN PRINT #1:"<line x1=";CHR$(34);STR$(INT(X));CHR$(34);" y1=";CHR$(34);STR$(INT(Y));CHR$(34);" x2=";CHR$(34);STR$(INT(XX));CHR$(34);" y2=";CHR$(34);STR$(INT(YY));CHR$(34);" stroke=";CHR$(34);"black";CHR$(34);" stroke-width=";CHR$(34);"1";CHR$(34);"/>"
LET X=XX
LET Y=YY
ELSE
CALL RECURSIVE2(LEV-1,L*L1,#1)
LET THETA=THETA-RR
CALL RECURSIVE2(LEV-1,L*L2,#1)
LET THETA=THETA+2*RR
CALL RECURSIVE2(LEV-1,L*L2,#1)
LET THETA=THETA-RR
CALL RECURSIVE2(LEV-1,L*L1,#1)
END IF
END SUB
|
|
|
投稿者:しばっち
投稿日:2012年10月21日(日)16時14分36秒
|
|
|
PUBLIC NUMERIC X,Y,THETA
PUBLIC STRING F$
LET XSIZE=640
LET YSIZE=400
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0 , XSIZE-1 , YSIZE-1,0
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
LET N=6
!'INPUT PROMPT "LEVEL=": N
LET X=0
LET Y=300
!'LET F$="森.svg"
IF F$<>"" THEN
OPEN #1:NAME F$
ERASE #1
PRINT #1:"<?xml version=";CHR$(34);"1.0";CHR$(34);" encoding=";CHR$(34);"utf-8";CHR$(34);"?>"
PRINT #1:"<!DOCTYPE svg PUBLIC ";CHR$(34);"-//W3C//DTD SVG 1.1//EN";CHR$(34);" ";CHR$(34);"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";CHR$(34);" ["
PRINT #1:" <!ENTITY ns_svg ";CHR$(34);"http://www.w3.org/2000/svg";CHR$(34);">"
PRINT #1:" <!ENTITY ns_xlink ";CHR$(34);"http://www.w3.org/1999/xlink";CHR$(34);">"
PRINT #1:"]>"
PRINT #1:"<svg version=";CHR$(34);"1.1";CHR$(34);" xmlns=";CHR$(34);"&ns_svg;";CHR$(34);" width=";CHR$(34);STR$(XSIZE);CHR$(34);" height=";CHR$(34);STR$(YSIZE);CHR$(34);" viewBox=";CHR$(34);"0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34)
PRINT #1:" overflow=";CHR$(34);"visible";CHR$(34);" enable-background=";CHR$(34);"new 0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34);" xml:space=";CHR$(34);"preserve";CHR$(34);">"
END IF
CALL RECURSIVE(N,640,#1)
IF F$<>"" THEN
PRINT #1:"</svg>"
CLOSE #1
END IF
END
EXTERNAL SUB RECURSIVE(LEV,L,#1)
IF LEV=0 THEN
LET XX=X+L*COS(THETA*PI/180)
LET YY=Y-L*SIN(THETA*PI/180)
IF F$<>"" THEN PRINT #1:"<line x1=";CHR$(34);STR$(INT(X));CHR$(34);" y1=";CHR$(34);STR$(INT(Y));CHR$(34);" x2=";CHR$(34);STR$(INT(XX));CHR$(34);" y2=";CHR$(34);STR$(INT(YY));CHR$(34);" stroke=";CHR$(34);"black";CHR$(34);" stroke-width=";CHR$(34);"1";CHR$(34);"/>"
PLOT LINES: X,Y;XX,YY
LET X=XX
LET Y=YY
ELSE
CALL RECURSIVE(LEV-1,L*.26500453458963,#1) !'.3-.4/TAN(85*PI/180)
LET THETA=THETA+85
CALL RECURSIVE(LEV-1,L*.401527935017339,#1) !'SQR((.3-.26500453458963)^2+.4^2)
LET THETA=THETA-170
CALL RECURSIVE(LEV-1,L*.401527935017339,#1)
LET THETA=THETA+85
CALL RECURSIVE(LEV-1,L*.66500453458963,#1) !'1-(.3+(.3-.26500453458963))
END IF
END SUB
|
|
|
投稿者:しばっち
投稿日:2012年10月21日(日)16時16分41秒
|
|
|
PUBLIC NUMERIC X,Y,THETA
PUBLIC STRING F$
LET XSIZE=600
LET YSIZE=600
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0 , XSIZE-1 , YSIZE-1, 0
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
LET N=4
!'INPUT PROMPT "LEVEL=": N
!'LET F$="海岸線.svg"
IF F$<>"" THEN
OPEN #1:NAME F$
ERASE #1
PRINT #1:"<?xml version=";CHR$(34);"1.0";CHR$(34);" encoding=";CHR$(34);"utf-8";CHR$(34);"?>"
PRINT #1:"<!DOCTYPE svg PUBLIC ";CHR$(34);"-//W3C//DTD SVG 1.1//EN";CHR$(34);" ";CHR$(34);"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";CHR$(34);" ["
PRINT #1:" <!ENTITY ns_svg ";CHR$(34);"http://www.w3.org/2000/svg";CHR$(34);">"
PRINT #1:" <!ENTITY ns_xlink ";CHR$(34);"http://www.w3.org/1999/xlink";CHR$(34);">"
PRINT #1:"]>"
PRINT #1:"<svg version=";CHR$(34);"1.1";CHR$(34);" xmlns=";CHR$(34);"&ns_svg;";CHR$(34);" width=";CHR$(34);STR$(XSIZE);CHR$(34);" height=";CHR$(34);STR$(YSIZE);CHR$(34);" viewBox=";CHR$(34);"0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34)
PRINT #1:" overflow=";CHR$(34);"visible";CHR$(34);" enable-background=";CHR$(34);"new 0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34);" xml:space=";CHR$(34);"preserve";CHR$(34);">"
END IF
LET L=600
LET X=0
LET Y=350
CALL RECURSIVE(N,L,L/40,#1)
IF F$<>"" THEN
PRINT #1:"</svg>"
CLOSE #1
END IF
END
EXTERNAL SUB RECURSIVE(LEV,L,L2,#1)
IF LEV=0 THEN
LET XX=X+L*COS(THETA)
LET YY=Y-L*SIN(THETA)
PLOT LINES: X,Y;XX,YY
IF F$<>"" THEN PRINT #1:"<line x1=";CHR$(34);STR$(INT(X));CHR$(34);" y1=";CHR$(34);STR$(INT(Y));CHR$(34);" x2=";CHR$(34);STR$(INT(XX));CHR$(34);" y2=";CHR$(34);STR$(INT(YY));CHR$(34);" stroke=";CHR$(34);"black";CHR$(34);" stroke-width=";CHR$(34);"1";CHR$(34);"/>"
LET X=XX
LET Y=YY
ELSE
LET ALPHA=ATN(L2/(L/4))
LET LL=SQR((L/4)^2+L2^2)
CALL RECURSIVE(LEV-1,L/4,L2*.6,#1)
LET THETA=THETA+ALPHA
CALL RECURSIVE(LEV-1,LL,L2*.6,#1)
LET THETA=THETA-2*ALPHA
CALL RECURSIVE(LEV-1,LL,L2*.6,#1)
LET THETA=THETA+ALPHA
CALL RECURSIVE(LEV-1,L/4,L2*.6,#1)
END IF
END SUB
|
|
|
投稿者:しばっち
投稿日:2012年10月21日(日)16時17分16秒
|
|
|
PUBLIC STRING F$
LET XSIZE=600
LET YSIZE=600
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0 , XSIZE-1 , YSIZE-1,0
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
LET N=1
!'LET F$="銀河.svg"
IF F$<>"" THEN
OPEN #1:NAME F$
ERASE #1
PRINT #1:"<?xml version=";CHR$(34);"1.0";CHR$(34);" encoding=";CHR$(34);"utf-8";CHR$(34);"?>"
PRINT #1:"<!DOCTYPE svg PUBLIC ";CHR$(34);"-//W3C//DTD SVG 1.1//EN";CHR$(34);" ";CHR$(34);"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";CHR$(34);" ["
PRINT #1:" <!ENTITY ns_svg ";CHR$(34);"http://www.w3.org/2000/svg";CHR$(34);">"
PRINT #1:" <!ENTITY ns_xlink ";CHR$(34);"http://www.w3.org/1999/xlink";CHR$(34);">"
PRINT #1:"]>"
PRINT #1:"<svg version=";CHR$(34);"1.1";CHR$(34);" xmlns=";CHR$(34);"&ns_svg;";CHR$(34);" width=";CHR$(34);STR$(XSIZE);CHR$(34);" height=";CHR$(34);STR$(YSIZE);CHR$(34);" viewBox=";CHR$(34);"0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34)
PRINT #1:" overflow=";CHR$(34);"visible";CHR$(34);" enable-background=";CHR$(34);"new 0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34);" xml:space=";CHR$(34);"preserve";CHR$(34);">"
END IF
CALL RECURSIVE(N,300,300,250,#1)
IF F$<>"" THEN
PRINT #1:"</svg>"
CLOSE #1
END IF
END
EXTERNAL SUB RECURSIVE(N,XX,YY,RR,#1)
IF N=0 THEN
FOR THETA=0 TO 360 STEP 60
LET TH=0
DO
LET R=EXP(TH*PI/180)
LET X=XX+R*COS((THETA+TH)*PI/180)
LET Y=YY-R*SIN((THETA+TH)*PI/180)
PLOT POINTS: X , Y
IF F$<>"" THEN PRINT #1:"<circle cx=";CHR$(34);STR$(INT(X));CHR$(34);" cy=";CHR$(34);STR$(INT(Y));CHR$(34);" r=";CHR$(34);"1";CHR$(34);" fill=";CHR$(34);"black";CHR$(34);" stroke=";CHR$(34);"black";CHR$(34);" stroke-width=";CHR$(34);"1";CHR$(34);" />"
LET TH=TH+10
LOOP WHILE R<RR
NEXT THETA
ELSE
FOR I=0 TO 5
LET THETA=I*60
LET TH=0
DO
LET R=EXP(TH*PI/180)
LET X=XX+R*COS((THETA+TH)*PI/180)
LET Y=YY-R*SIN((THETA+TH)*PI/180)
CALL RECURSIVE(N-1,X,Y,RR*.5,#1)
LET TH=TH+10
LOOP WHILE R<RR
NEXT I
END IF
END SUB
|
|
|
投稿者:しばっち
投稿日:2012年10月21日(日)16時18分0秒
|
|
|
PUBLIC NUMERIC L,X,Y,THETA,SP,XA(200),YA(200),TH(200),XMAX,XMIN,YMAX,YMIN,XSIZE,YSIZE
PUBLIC STRING F$
LET XMAX=-1E10
LET YMAX=-1E10
LET XMIN=1E10
LET YMIN=1E10
LET XSIZE=600
LET YSIZE=600
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0 , XSIZE-1 , YSIZE-1, 0
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
LET N=4
!'INPUT PROMPT "LEVEL=": N
LET PARA$="FX++FX++FX++FX++FX"
LET P$=PARA$
LET SP=1
LET L=10
LET X=140
LET Y=50
LET THETA=0
CALL RECURSIVE(N,P$,#1)
SET BITMAP SIZE XSIZE,YSIZE*(YMAX-YMIN)/(XMAX-XMIN)
SET WINDOW XMIN,XMAX,YMAX,YMIN
CLEAR
!'LET F$="再帰図形.svg"
IF F$<>"" THEN
OPEN #1:NAME F$
ERASE #1
PRINT #1:"<?xml version=";CHR$(34);"1.0";CHR$(34);" encoding=";CHR$(34);"utf-8";CHR$(34);"?>"
PRINT #1:"<!DOCTYPE svg PUBLIC ";CHR$(34);"-//W3C//DTD SVG 1.1//EN";CHR$(34);" ";CHR$(34);"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";CHR$(34);" ["
PRINT #1:" <!ENTITY ns_svg ";CHR$(34);"http://www.w3.org/2000/svg";CHR$(34);">"
PRINT #1:" <!ENTITY ns_xlink ";CHR$(34);"http://www.w3.org/1999/xlink";CHR$(34);">"
PRINT #1:"]>"
PRINT #1:"<svg version=";CHR$(34);"1.1";CHR$(34);" xmlns=";CHR$(34);"&ns_svg;";CHR$(34);" width=";CHR$(34);STR$(XSIZE);CHR$(34);" height=";CHR$(34);STR$(YSIZE);CHR$(34);" viewBox=";CHR$(34);"0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34)
PRINT #1:" overflow=";CHR$(34);"visible";CHR$(34);" enable-background=";CHR$(34);"new 0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34);" xml:space=";CHR$(34);"preserve";CHR$(34);">"
END IF
LET P$=PARA$
LET SP=1
LET L=10
LET X=140
LET Y=50
LET THETA=0
CALL RECURSIVE(N,P$,#1)
IF F$<>"" THEN
PRINT #1:"</svg>"
CLOSE #1
END IF
END
EXTERNAL SUB RECURSIVE(N,PARA$,#1)
IF N>0 THEN
FOR I=1 TO LEN(PARA$)
SELECT CASE UCASE$(PARA$(I:I))
CASE "+"
CALL RECURSIVE(N-1,"+",#1)
CASE "-"
CALL RECURSIVE(N-1,"-",#1)
CASE "["
CALL RECURSIVE(N-1,"[",#1)
CASE "]"
CALL RECURSIVE(N-1,"]",#1)
CASE "F"
CALL RECURSIVE(N-1,"",#1)
CASE "G"
CALL RECURSIVE(N-1,"",#1)
CASE "X"
CALL RECURSIVE(N-1,"FY++FY-FY+++++FY+[A]+FY++FY",#1)
CASE "Y"
CALL RECURSIVE(N-1,"+GZ--GZ+FX++FX[++FX++FX++FX]-FX++FX++FX++FX++FX-GZ++GZ",#1)
CASE "Z"
CALL RECURSIVE(N-1,"+GW-GW-GW+",#1)
CASE "W"
CALL RECURSIVE(N-1,"+GZGZ-GZ-GZGZ+",#1)
CASE "A"
CALL RECURSIVE(N-1,"+GZ--GZ+FX++FX++FX++FX++FX",#1)
END SELECT
NEXT I
ELSE
FOR I=1 TO LEN(PARA$)
SELECT CASE UCASE$(PARA$(I:I))
CASE "+"
LET THETA=THETA+36
CASE "-"
LET THETA=THETA-36
CASE "F"
LET XMAX=MAX(XMAX,X)
LET XMIN=MIN(XMIN,X)
LET YMAX=MAX(YMAX,Y)
LET YMIN=MIN(YMIN,Y)
LET XX=X+L*COS(THETA*PI/180)
LET YY=Y+L*SIN(THETA*PI/180)
PLOT LINES: X,Y;XX,YY
IF F$<>"" THEN PRINT #1:"<line x1=";CHR$(34);STR$(PIXELX(X));CHR$(34);" y1=";CHR$(34);STR$(YSIZE-PIXELY(Y));CHR$(34);" x2=";CHR$(34);STR$(PIXELX(XX));CHR$(34);" y2=";CHR$(34);STR$(YSIZE-PIXELY(YY));CHR$(34);" stroke=";CHR$(34);"black";CHR$(34);" stroke-width=";CHR$(34);"1";CHR$(34);"/>"
LET X=XX
LET Y=YY
LET XMAX=MAX(XMAX,X)
LET XMIN=MIN(XMIN,X)
LET YMAX=MAX(YMAX,Y)
LET YMIN=MIN(YMIN,Y)
CASE "G"
LET X=X+L*COS(THETA*PI/180)
LET Y=Y+L*SIN(THETA*PI/180)
CASE "["
LET XA(SP)=X
LET YA(SP)=Y
LET TH(SP)=THETA
LET SP=SP+1
CASE "]"
LET SP=SP-1
LET X=XA(SP)
LET Y=YA(SP)
LET THETA=TH(SP)
CASE ELSE
END SELECT
NEXT I
END IF
END SUB
|
|
|
投稿者:しばっち
投稿日:2012年10月21日(日)16時18分37秒
|
|
|
PUBLIC NUMERIC X,Y,THETA,XMAX,XMIN,YMAX,YMIN
PUBLIC STRING F$
LET XMAX=-1E10
LET YMAX=-1E10
LET XMIN=1E10
LET YMIN=1E10
LET XSIZE=600
LET YSIZE=600
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0 , XSIZE-1 , YSIZE-1, 0
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
LET N=3
!'INPUT PROMPT "LEVEL=": N
LET L=10
LET X=0
LET Y=200
CALL RECURSIVE(N,L,#1)
LET XSIZE=600*(XMAX-XMIN)/(YMAX-YMIN)
LET YSIZE=600
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW XMIN,XMAX,YMAX,YMIN
CLEAR
!'LET F$="再帰図形.svg"
IF F$<>"" THEN
OPEN #1:NAME F$
ERASE #1
PRINT #1:"<?xml version=";CHR$(34);"1.0";CHR$(34);" encoding=";CHR$(34);"utf-8";CHR$(34);"?>"
PRINT #1:"<!DOCTYPE svg PUBLIC ";CHR$(34);"-//W3C//DTD SVG 1.1//EN";CHR$(34);" ";CHR$(34);"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";CHR$(34);" ["
PRINT #1:" <!ENTITY ns_svg ";CHR$(34);"http://www.w3.org/2000/svg";CHR$(34);">"
PRINT #1:" <!ENTITY ns_xlink ";CHR$(34);"http://www.w3.org/1999/xlink";CHR$(34);">"
PRINT #1:"]>"
PRINT #1:"<svg version=";CHR$(34);"1.1";CHR$(34);" xmlns=";CHR$(34);"&ns_svg;";CHR$(34);" width=";CHR$(34);STR$(XSIZE);CHR$(34);" height=";CHR$(34);STR$(YSIZE);CHR$(34);" viewBox=";CHR$(34);"0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34)
PRINT #1:" overflow=";CHR$(34);"visible";CHR$(34);" enable-background=";CHR$(34);"new 0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34);" xml:space=";CHR$(34);"preserve";CHR$(34);">"
END IF
LET THETA=0
LET X=0
LET Y=200
LET L=10
CALL RECURSIVE(N,L,#1)
IF F$<>"" THEN
PRINT #1:"</svg>"
CLOSE #1
END IF
END
EXTERNAL SUB RECURSIVE(LEV,L,#1)
IF LEV=0 THEN
LET XX=X+L*COS(THETA*PI/180)
LET YY=Y-L*SIN(THETA*PI/180)
PLOT LINES: X,Y;XX,YY
IF F$<>"" THEN PRINT #1:"<line x1=";CHR$(34);STR$(PIXELX(X));CHR$(34);" y1=";CHR$(34);STR$(PIXELY(Y));CHR$(34);" x2=";CHR$(34);STR$(PIXELX(XX));CHR$(34);" y2=";CHR$(34);STR$(PIXELY(YY));CHR$(34);" stroke=";CHR$(34);"black";CHR$(34);" stroke-width=";CHR$(34);"1";CHR$(34);"/>"
LET X=XX
LET Y=YY
LET XMAX=MAX(XMAX,X)
LET YMAX=MAX(YMAX,Y)
LET XMIN=MIN(XMIN,X)
LET YMIN=MIN(YMIN,Y)
ELSE
CALL RECURSIVE(LEV-1,L/2,#1)
LET THETA=THETA-45
CALL RECURSIVE(LEV-1,L/2,#1)
LET THETA=THETA+30
CALL RECURSIVE(LEV-1,L/2,#1)
LET THETA=THETA+30
CALL RECURSIVE(LEV-1,L/2,#1)
LET THETA=THETA+30
CALL RECURSIVE(LEV-1,L/2,#1)
LET THETA=THETA+90
CALL RECURSIVE(LEV-1,L/2,#1)
LET THETA=THETA+30
CALL RECURSIVE(LEV-1,L/2,#1)
LET THETA=THETA+30
CALL RECURSIVE(LEV-1,L/2,#1)
LET THETA=THETA+120
CALL RECURSIVE(LEV-1,L/2,#1)
LET THETA=THETA+30
CALL RECURSIVE(LEV-1,L/2,#1)
LET THETA=THETA+30
CALL RECURSIVE(LEV-1,L/2,#1)
LET THETA=THETA-15
CALL RECURSIVE(LEV-1,L/2,#1)
END IF
END SUB
|
|
|
投稿者:しばっち
投稿日:2012年10月21日(日)16時19分42秒
|
|
|
PUBLIC NUMERIC X,Y,THETA,XMAX,XMIN,YMAX,YMIN,XSIZE,YSIZE
PUBLIC STRING F$
LET XMAX=-1E10
LET YMAX=-1E10
LET XMIN=1E10
LET YMIN=1E10
LET XSIZE=600
LET YSIZE=600
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0 , XSIZE-1 , YSIZE-1, 0
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
LET N=5
!'INPUT PROMPT "LEVEL=": N
LET L=30
LET THETA=0
LET X=0
LET Y=300
CALL RECURSIVE(N,L,#1)
LET XSIZE=600*(XMAX-XMIN)/(YMAX-YMIN)
LET YSIZE=600
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW XMIN,XMAX,YMAX,YMIN
CLEAR
LET L=30
LET THETA=0
LET X=0
LET Y=300
!'LET F$="サンゴ礁.svg"
IF F$<>"" THEN
OPEN #1:NAME F$
ERASE #1
PRINT #1:"<?xml version=";CHR$(34);"1.0";CHR$(34);" encoding=";CHR$(34);"utf-8";CHR$(34);"?>"
PRINT #1:"<!DOCTYPE svg PUBLIC ";CHR$(34);"-//W3C//DTD SVG 1.1//EN";CHR$(34);" ";CHR$(34);"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";CHR$(34);" ["
PRINT #1:" <!ENTITY ns_svg ";CHR$(34);"http://www.w3.org/2000/svg";CHR$(34);">"
PRINT #1:" <!ENTITY ns_xlink ";CHR$(34);"http://www.w3.org/1999/xlink";CHR$(34);">"
PRINT #1:"]>"
PRINT #1:"<svg version=";CHR$(34);"1.1";CHR$(34);" xmlns=";CHR$(34);"&ns_svg;";CHR$(34);" width=";CHR$(34);STR$(XSIZE);CHR$(34);" height=";CHR$(34);STR$(YSIZE);CHR$(34);" viewBox=";CHR$(34);"0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34)
PRINT #1:" overflow=";CHR$(34);"visible";CHR$(34);" enable-background=";CHR$(34);"new 0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34);" xml:space=";CHR$(34);"preserve";CHR$(34);">"
END IF
CALL RECURSIVE(N,L,#1)
IF F$<>"" THEN
PRINT #1:"</svg>"
CLOSE #1
END IF
END
EXTERNAL SUB RECURSIVE(LEV,L,#1)
IF LEV=0 THEN
LET XMAX=MAX(XMAX,X)
LET YMAX=MAX(YMAX,Y)
LET XMIN=MIN(XMIN,X)
LET YMIN=MIN(YMIN,Y)
LET XX=X+L*COS(THETA*PI/180)
LET YY=Y-L*SIN(THETA*PI/180)
PLOT LINES: X,Y;XX,YY
IF F$<>"" THEN PRINT #1:"<line x1=";CHR$(34);STR$(PIXELX(X));CHR$(34);" y1=";CHR$(34);STR$(YSIZE-PIXELY(Y));CHR$(34);" x2=";CHR$(34);STR$(PIXELX(XX));CHR$(34);" y2=";CHR$(34);STR$(YSIZE-PIXELY(YY));CHR$(34);" stroke=";CHR$(34);"black";CHR$(34);" stroke-width=";CHR$(34);"1";CHR$(34);"/>"
LET X=XX
LET Y=YY
ELSE
CALL RECURSIVE(LEV-1,L*.5,#1)
LET THETA=THETA+90
CALL RECURSIVE(LEV-1,L*.5,#1)
LET THETA=THETA-90
CALL RECURSIVE(LEV-1,L*.5,#1)
LET THETA=THETA-90
CALL RECURSIVE(LEV-1,L,#1)
LET THETA=THETA+90
CALL RECURSIVE(LEV-1,L,#1)
LET THETA=THETA+45
CALL RECURSIVE(LEV-1,L*SQR(.5),#1)
LET THETA=THETA-45
END IF
END SUB
|
|
|
投稿者:しばっち
投稿日:2012年10月21日(日)16時20分47秒
|
|
|
PUBLIC NUMERIC X,Y,THETA,XMAX,XMIN,YMAX,YMIN
PUBLIC STRING F$
LET XMAX=-1E10
LET YMAX=-1E10
LET XMIN=1E10
LET YMIN=1E10
LET XSIZE=600
LET YSIZE=600
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0 , XSIZE-1 , YSIZE-1, 0
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
LET N=3
!'INPUT PROMPT "LEVEL=": N
LET L=180
LET THETA=90
LET X=590
LET Y=450
FOR I=1 TO 6
CALL RECURSIVE(N,L,#1)
LET THETA=THETA+60
NEXT I
LET XSIZE=600*(XMAX-XMIN)/(YMAX-YMIN)
LET YSIZE=600
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW XMIN,XMAX,YMAX,YMIN
CLEAR
!'LET F$="雪の結晶.svg"
IF F$<>"" THEN
OPEN #1:NAME F$
ERASE #1
PRINT #1:"<?xml version=";CHR$(34);"1.0";CHR$(34);" encoding=";CHR$(34);"utf-8";CHR$(34);"?>"
PRINT #1:"<!DOCTYPE svg PUBLIC ";CHR$(34);"-//W3C//DTD SVG 1.1//EN";CHR$(34);" ";CHR$(34);"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";CHR$(34);" ["
PRINT #1:" <!ENTITY ns_svg ";CHR$(34);"http://www.w3.org/2000/svg";CHR$(34);">"
PRINT #1:" <!ENTITY ns_xlink ";CHR$(34);"http://www.w3.org/1999/xlink";CHR$(34);">"
PRINT #1:"]>"
PRINT #1:"<svg version=";CHR$(34);"1.1";CHR$(34);" xmlns=";CHR$(34);"&ns_svg;";CHR$(34);" width=";CHR$(34);STR$(XSIZE);CHR$(34);" height=";CHR$(34);STR$(YSIZE);CHR$(34);" viewBox=";CHR$(34);"0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34)
PRINT #1:" overflow=";CHR$(34);"visible";CHR$(34);" enable-background=";CHR$(34);"new 0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34);" xml:space=";CHR$(34);"preserve";CHR$(34);">"
END IF
LET L=180
LET THETA=90
LET X=590
LET Y=450
FOR I=1 TO 6
CALL RECURSIVE(N,L,#1)
LET THETA=THETA+60
NEXT I
IF F$<>"" THEN
PRINT #1:"</svg>"
CLOSE #1
END IF
END
EXTERNAL SUB RECURSIVE(N,L,#1)
IF N=0 THEN
LET XX=X+L*COS(THETA*PI/180)
LET YY=Y-L*SIN(THETA*PI/180)
PLOT LINES: X,Y;XX,YY;
IF F$<>"" THEN PRINT #1:"<line x1=";CHR$(34);STR$(PIXELX(X));CHR$(34);" y1=";CHR$(34);STR$(PIXELY(Y));CHR$(34);" x2=";CHR$(34);STR$(PIXELX(XX));CHR$(34);" y2=";CHR$(34);STR$(PIXELY(YY));CHR$(34);" stroke=";CHR$(34);"black";CHR$(34);" stroke-width=";CHR$(34);"1";CHR$(34);"/>"
LET X=XX
LET Y=YY
LET XMAX=MAX(XMAX,X)
LET YMAX=MAX(YMAX,Y)
LET XMIN=MIN(XMIN,X)
LET YMIN=MIN(YMIN,Y)
ELSE
CALL RECURSIVE(N-1,L*.5,#1)
LET THETA=THETA+90
CALL RECURSIVE(N-1,L*.23,#1)
LET THETA=THETA+90
CALL RECURSIVE(N-1,L*.15,#1)
LET THETA=THETA-90
CALL RECURSIVE(N-1,L*.4,#1)
LET THETA=THETA-90
CALL RECURSIVE(N-1,L*.5,#1)
LET THETA=THETA-90
CALL RECURSIVE(N-1,L*.4,#1)
LET THETA=THETA-90
CALL RECURSIVE(N-1,L*.15,#1)
LET THETA=THETA+90
CALL RECURSIVE(N-1,L*.23,#1)
LET THETA=THETA+90
CALL RECURSIVE(N-1,L*.5,#1)
END IF
END SUB
|
|
|
投稿者:しばっち
投稿日:2012年10月21日(日)16時21分25秒
|
|
|
PUBLIC NUMERIC THETA,X,Y
PUBLIC STRING F$
LET XSIZE=600
LET YSIZE=600
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0 , XSIZE-1 , YSIZE-1,0
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
LET N=8
!'INPUT PROMPT "LEVEL=": N
LET L=100
LET THETA=90
LET X=XSIZE/2+L/2
LET Y=YSIZE-L
!'LET F$="樹木.svg"
IF F$<>"" THEN
OPEN #1:NAME F$
ERASE #1
PRINT #1:"<?xml version=";CHR$(34);"1.0";CHR$(34);" encoding=";CHR$(34);"utf-8";CHR$(34);"?>"
PRINT #1:"<!DOCTYPE svg PUBLIC ";CHR$(34);"-//W3C//DTD SVG 1.1//EN";CHR$(34);" ";CHR$(34);"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";CHR$(34);" ["
PRINT #1:" <!ENTITY ns_svg ";CHR$(34);"http://www.w3.org/2000/svg";CHR$(34);">"
PRINT #1:" <!ENTITY ns_xlink ";CHR$(34);"http://www.w3.org/1999/xlink";CHR$(34);">"
PRINT #1:"]>"
PRINT #1:"<svg version=";CHR$(34);"1.1";CHR$(34);" xmlns=";CHR$(34);"&ns_svg;";CHR$(34);" width=";CHR$(34);STR$(XSIZE);CHR$(34);" height=";CHR$(34);STR$(YSIZE);CHR$(34);" viewBox=";CHR$(34);"0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34)
PRINT #1:" overflow=";CHR$(34);"visible";CHR$(34);" enable-background=";CHR$(34);"new 0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34);" xml:space=";CHR$(34);"preserve";CHR$(34);">"
END IF
CALL RECURSIVE(N,X,Y,L,#1)
IF F$<>"" THEN
PRINT #1:"</svg>"
CLOSE #1
END IF
END
EXTERNAL SUB RECURSIVE(LEV,X,Y,L,#1)
IF LEV>0 THEN
CALL BOX(X,Y,L,#1)
LET THETA=THETA-45
LET XX=X+L/SQR(2)*COS(THETA*PI/180)
LET YY=Y-L/SQR(2)*SIN(THETA*PI/180)
CALL RECURSIVE(LEV-1,XX,YY,L/SQR(2),#1)
LET THETA=THETA+90
LET XX=X+L*SQR(2)*COS(THETA*PI/180)
LET YY=Y-L*SQR(2)*SIN(THETA*PI/180)
CALL RECURSIVE(LEV-1,XX,YY,L/SQR(2),#1)
LET THETA=THETA-45
END IF
END SUB
EXTERNAL SUB BOX(X,Y,L,#1)
FOR I=1 TO 4
LET THETA=THETA+90
LET XX=X+L*COS(THETA*PI/180)
LET YY=Y-L*SIN(THETA*PI/180)
PLOT LINES: X,Y;XX,YY
IF F$<>"" THEN PRINT #1:"<line x1=";CHR$(34);STR$(INT(X));CHR$(34);" y1=";CHR$(34);STR$(INT(Y));CHR$(34);" x2=";CHR$(34);STR$(INT(XX));CHR$(34);" y2=";CHR$(34);STR$(INT(YY));CHR$(34);" stroke=";CHR$(34);"black";CHR$(34);" stroke-width=";CHR$(34);"1";CHR$(34);"/>"
LET X=XX
LET Y=YY
NEXT I
PLOT LINES
END SUB
|
|
|
投稿者:しばっち
投稿日:2012年10月21日(日)16時22分3秒
|
|
|
PUBLIC NUMERIC AR, AI, BR, BI, CR, CI, DR, DI,XMIN,XMAX,YMIN,YMAX,XSIZE,YSIZE
PUBLIC STRING F$
LET XMAX=-1E10
LET YMAX=-1E10
LET XMIN=1E10
LET YMIN=1E10
LET XSIZE=600
LET YSIZE=600
SET BITMAP SIZE XSIZE,YSIZE
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
LET N=15
!'INPUT PROMPT "LEVEL=": N
READ AR, AI, BR, BI, CR, CI, DR, DI
DATA 0,0,.5,.2887,0,0,.5,-.2887
!'DATA .5,.5,0,0,.5,-.5,0,0
!'DATA 0,0,.4,.5,0,0,.4,-.5
!'DATA 0,0,.5,.28867,0,0,.6667,0
!'DATA 0,.707,0,0,.5,0,0,0
!'DATA 0,0,.4614,.4614,.622,-.196,0,0
!'DATA .4614,.4614,0,0,0,0,.622,-.196
!'DATA .4614,.4614,0,0,0,0,.2896,-.585
!'DATA .4614,.4614,0,0,.622,-.196,0,0
!'DATA 0,0,0,.6667,0,0,.6667,0
CALL RECURSIVE(10,0,0,#1)
SET BITMAP SIZE XSIZE,YSIZE*(YMAX-YMIN)/(XMAX-XMIN)
SET WINDOW XMIN,XMAX,YMIN,YMAX
CLEAR
!'LET F$="再帰図形.svg"
IF F$<>"" THEN
OPEN #1:NAME F$
ERASE #1
PRINT #1:"<?xml version=";CHR$(34);"1.0";CHR$(34);" encoding=";CHR$(34);"utf-8";CHR$(34);"?>"
PRINT #1:"<!DOCTYPE svg PUBLIC ";CHR$(34);"-//W3C//DTD SVG 1.1//EN";CHR$(34);" ";CHR$(34);"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";CHR$(34);" ["
PRINT #1:" <!ENTITY ns_svg ";CHR$(34);"http://www.w3.org/2000/svg";CHR$(34);">"
PRINT #1:" <!ENTITY ns_xlink ";CHR$(34);"http://www.w3.org/1999/xlink";CHR$(34);">"
PRINT #1:"]>"
PRINT #1:"<svg version=";CHR$(34);"1.1";CHR$(34);" xmlns=";CHR$(34);"&ns_svg;";CHR$(34);" width=";CHR$(34);STR$(XSIZE);CHR$(34);" height=";CHR$(34);STR$(YSIZE);CHR$(34);" viewBox=";CHR$(34);"0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34)
PRINT #1:" overflow=";CHR$(34);"visible";CHR$(34);" enable-background=";CHR$(34);"new 0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34);" xml:space=";CHR$(34);"preserve";CHR$(34);">"
END IF
CALL RECURSIVE(N,0,0,#1)
IF F$<>"" THEN
PRINT #1:"</svg>"
CLOSE #1
END IF
END
EXTERNAL SUB RECURSIVE(N,X,Y,#1)
IF N>0 THEN
PLOT POINTS: X , Y
IF F$<>"" THEN PRINT #1:"<circle cx=";CHR$(34);STR$(PIXELX(X));CHR$(34);" cy=";CHR$(34);STR$(YSIZE-PIXELY(Y));CHR$(34);" r=";CHR$(34);"1";CHR$(34);" fill=";CHR$(34);"black";CHR$(34);" stroke=";CHR$(34);"black";CHR$(34);" stroke-width=";CHR$(34);"1";CHR$(34);" />"
LET XMIN=MIN(XMIN,X)
LET XMAX=MAX(XMAX,X)
LET YMIN=MIN(YMIN,Y)
LET YMAX=MAX(YMAX,Y)
CALL RECURSIVE(N-1,X * (AR + BR) - Y * (AI - BI), X * (AI + BI) + Y * (AR - BR),#1)
CALL RECURSIVE(N-1,X * (CR + DR) - Y * (CI - DI) - CR - DR + 1, X * (CI + DI) + Y * (CR - DR) - CI - DI,#1)
END IF
END SUB
|
|
|
投稿者:しばっち
投稿日:2012年10月21日(日)16時22分55秒
|
|
|
PUBLIC STRING F$
LET XSIZE=640
LET YSIZE=400
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0 , XSIZE-1 , YSIZE-1,0
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
CLEAR
LET N=8
!'INPUT PROMPT "LEVEL=": N
!'LET F$="再帰図形.svg"
IF F$<>"" THEN
OPEN #1:NAME F$
ERASE #1
PRINT #1:"<?xml version=";CHR$(34);"1.0";CHR$(34);" encoding=";CHR$(34);"utf-8";CHR$(34);"?>"
PRINT #1:"<!DOCTYPE svg PUBLIC ";CHR$(34);"-//W3C//DTD SVG 1.1//EN";CHR$(34);" ";CHR$(34);"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";CHR$(34);" ["
PRINT #1:" <!ENTITY ns_svg ";CHR$(34);"http://www.w3.org/2000/svg";CHR$(34);">"
PRINT #1:" <!ENTITY ns_xlink ";CHR$(34);"http://www.w3.org/1999/xlink";CHR$(34);">"
PRINT #1:"]>"
PRINT #1:"<svg version=";CHR$(34);"1.1";CHR$(34);" xmlns=";CHR$(34);"&ns_svg;";CHR$(34);" width=";CHR$(34);STR$(XSIZE);CHR$(34);" height=";CHR$(34);STR$(YSIZE);CHR$(34);" viewBox=";CHR$(34);"0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34)
PRINT #1:" overflow=";CHR$(34);"visible";CHR$(34);" enable-background=";CHR$(34);"new 0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34);" xml:space=";CHR$(34);"preserve";CHR$(34);">"
END IF
CALL RECURSIVE(N,0,350,640,350,#1)
IF F$<>"" THEN
PRINT #1:"</svg>"
CLOSE #1
END IF
END
EXTERNAL SUB RECURSIVE(N,X1,Y1,X2,Y2,#1)
LET XX=(X1+X2)/2
LET YY=(Y1+Y2)/2
LET TH=PI-ATN(5/4)*2
LET L=SQR((XX-X2)^2+(YY-Y2)^2)
LET THETA=-ANGLE((X2-XX),(Y2-YY))
LET X3=XX+L*COS(THETA+TH)
LET Y3=YY-L*SIN(THETA+TH)
LET X4=XX+L*COS(PI+THETA-TH)
LET Y4=YY-L*SIN(PI+THETA-TH)
IF N=0 THEN
PLOT AREA:XX,YY;X2,Y2;X3,Y3
IF F$<>"" THEN PRINT #1:"<polygon fill=";CHR$(34);"black";CHR$(34);" stroke=";CHR$(34);"black";CHR$(34);" stork-width=";CHR$(34);"1";CHR$(34);" points=";CHR$(34);STR$(INT(XX));",";STR$(INT(YY));" ";STR$(INT(X2));",";STR$(INT(Y2));" ";STR$(INT(X3));",";STR$(INT(Y3));" ";STR$(INT(XX));",";STR$(INT(YY));CHR$(34);"/>"
PLOT AREA:XX,YY;X1,Y1;X4,Y4
IF F$<>"" THEN PRINT #1:"<polygon fill=";CHR$(34);"black";CHR$(34);" stroke=";CHR$(34);"black";CHR$(34);" stork-width=";CHR$(34);"1";CHR$(34);" points=";CHR$(34);STR$(INT(XX));",";STR$(INT(YY));" ";STR$(INT(X1));",";STR$(INT(Y1));" ";STR$(INT(X4));",";STR$(INT(Y4));" ";STR$(INT(XX));",";STR$(INT(YY));CHR$(34);"/>"
ELSE
CALL RECURSIVE(N-1,X2,Y2,X3,Y3,#1)
CALL RECURSIVE(N-1,X4,Y4,X1,Y1,#1)
END IF
END SUB
|
|
|
投稿者:しばっち
投稿日:2012年10月21日(日)16時23分35秒
|
|
|
PUBLIC NUMERIC XSIZE,YSIZE
PUBLIC STRING F$
LET XSIZE=600
LET YSIZE=600
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0,1,-.5,.5
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
LET N=12
!'INPUT PROMPT "LEVEL=": N
!'LET F$="葉脈.svg"
IF F$<>"" THEN
OPEN #1:NAME F$
ERASE #1
PRINT #1:"<?xml version=";CHR$(34);"1.0";CHR$(34);" encoding=";CHR$(34);"utf-8";CHR$(34);"?>"
PRINT #1:"<!DOCTYPE svg PUBLIC ";CHR$(34);"-//W3C//DTD SVG 1.1//EN";CHR$(34);" ";CHR$(34);"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";CHR$(34);" ["
PRINT #1:" <!ENTITY ns_svg ";CHR$(34);"http://www.w3.org/2000/svg";CHR$(34);">"
PRINT #1:" <!ENTITY ns_xlink ";CHR$(34);"http://www.w3.org/1999/xlink";CHR$(34);">"
PRINT #1:"]>"
PRINT #1:"<svg version=";CHR$(34);"1.1";CHR$(34);" xmlns=";CHR$(34);"&ns_svg;";CHR$(34);" width=";CHR$(34);STR$(XSIZE);CHR$(34);" height=";CHR$(34);STR$(YSIZE);CHR$(34);" viewBox=";CHR$(34);"0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34)
PRINT #1:" overflow=";CHR$(34);"visible";CHR$(34);" enable-background=";CHR$(34);"new 0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34);" xml:space=";CHR$(34);"preserve";CHR$(34);">"
END IF
LET X1=0
LET Y1=0
LET X2=1
LET Y2=0
LET X3=.5
LET Y3=SQR(3)/6
CALL RECURSIVE(N,X1,Y1,X2,Y2,X3,Y3,#1)
IF F$<>"" THEN
PRINT #1:"</svg>"
CLOSE #1
END IF
END
EXTERNAL SUB RECURSIVE(N,X1, Y1, X2, Y2, X3, Y3,#1)
LET X4 = (2*X1 + X2) / 3
LET Y4 = (2*Y1 + Y2) / 3
LET X5 = (4*X1 - 3*X3 + 5*X2) / 6
LET Y5 = (4*Y1 - 3*Y3 + 5*Y2) / 6
IF N = 0 THEN
PLOT LINES: X1,Y1;X3,Y3
IF F$<>"" THEN PRINT #1:"<line x1=";CHR$(34);STR$(PIXELX(X1));CHR$(34);" y1=";CHR$(34);STR$(YSIZE-PIXELY(Y1));CHR$(34);" x2=";CHR$(34);STR$(PIXELX(X3));CHR$(34);" y2=";CHR$(34);STR$(YSIZE-PIXELY(Y3));CHR$(34);" stroke=";CHR$(34);"black";CHR$(34);" stroke-width=";CHR$(34);"1";CHR$(34);"/>"
PLOT LINES: X4,Y4;X2,Y2
IF F$<>"" THEN PRINT #1:"<line x1=";CHR$(34);STR$(PIXELX(X4));CHR$(34);" y1=";CHR$(34);STR$(YSIZE-PIXELY(Y4));CHR$(34);" x2=";CHR$(34);STR$(PIXELX(X2));CHR$(34);" y2=";CHR$(34);STR$(YSIZE-PIXELY(Y2));CHR$(34);" stroke=";CHR$(34);"black";CHR$(34);" stroke-width=";CHR$(34);"1";CHR$(34);"/>"
ELSE
CALL RECURSIVE(N-1, X1, Y1, X3, Y3, X4, Y4,#1)
CALL RECURSIVE(N-1, X4, Y4, X2, Y2, X5, Y5,#1)
END IF
END SUB
|
|
|
投稿者:しばっち
投稿日:2012年10月21日(日)16時24分23秒
|
|
|
PUBLIC NUMERIC XMIN,XMAX,YMIN,YMAX,XSIZE,YSIZE
PUBLIC STRING F$
LET XSIZE=600
LET YSIZE=600
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0,1,-.5,.5
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
LET N=10
!'INPUT PROMPT "LEVEL=": N
!'LET F$="葉脈.svg"
IF F$<>"" THEN
OPEN #1:NAME F$
ERASE #1
PRINT #1:"<?xml version=";CHR$(34);"1.0";CHR$(34);" encoding=";CHR$(34);"utf-8";CHR$(34);"?>"
PRINT #1:"<!DOCTYPE svg PUBLIC ";CHR$(34);"-//W3C//DTD SVG 1.1//EN";CHR$(34);" ";CHR$(34);"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";CHR$(34);" ["
PRINT #1:" <!ENTITY ns_svg ";CHR$(34);"http://www.w3.org/2000/svg";CHR$(34);">"
PRINT #1:" <!ENTITY ns_xlink ";CHR$(34);"http://www.w3.org/1999/xlink";CHR$(34);">"
PRINT #1:"]>"
PRINT #1:"<svg version=";CHR$(34);"1.1";CHR$(34);" xmlns=";CHR$(34);"&ns_svg;";CHR$(34);" width=";CHR$(34);STR$(XSIZE);CHR$(34);" height=";CHR$(34);STR$(YSIZE);CHR$(34);" viewBox=";CHR$(34);"0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34)
PRINT #1:" overflow=";CHR$(34);"visible";CHR$(34);" enable-background=";CHR$(34);"new 0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34);" xml:space=";CHR$(34);"preserve";CHR$(34);">"
END IF
CALL RECURSIVE(N,.5,SQR(3)/6,0,0,1,0,#1)
IF F$<>"" THEN
PRINT #1:"</svg>"
CLOSE #1
END IF
END
EXTERNAL SUB RECURSIVE(N,AX,AY,BX,BY,CX,CY,#1)
IF N=0 THEN
PLOT AREA:AX,AY;BX,BY;CX,CY
IF F$<>"" THEN PRINT #1:"<polygon fill=";CHR$(34);"black";CHR$(34);" stroke=";CHR$(34);"black";CHR$(34);" stork-width=";CHR$(34);"1";CHR$(34);" points=";CHR$(34);STR$(PIXELX(AX));",";STR$(YSIZE-PIXELY(AY));" ";STR$(PIXELX(BX));",";STR$(YSIZE-PIXELY(BY));" ";STR$(PIXELX(CX));",";STR$(YSIZE-PIXELY(CY));" ";STR$(PIXELX(AX));",";STR$(YSIZE-PIXELY(AY));CHR$(34);"/>"
ELSE
CALL RECURSIVE(N-1,(CX+2*BX)/3,(CY+2*BY)/3,BX,BY,AX,AY,#1)
CALL RECURSIVE(N-1,(3*CX+2*BX-2*AX)/3,(3*CY+2*BY-2*AY)/3,(CX+2*BX)/3,(CY+2*BY)/3,CX,CY,#1)
END IF
END SUB
|
|
|
投稿者:しばっち
投稿日:2012年10月21日(日)16時25分16秒
|
|
|
PUBLIC NUMERIC L1,L2,LTH,RTH,XSIZE,YSIZE
PUBLIC STRING F$
LET XSIZE=600
LET YSIZE=600
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0 , XSIZE-1 , 0,YSIZE-1
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
CLEAR
LET N=11
!'INPUT PROMPT "LEVEL":N
LET L1=.6523
LET L2=.6523
LET LTH=45
LET RTH=17.5
!'LET F$="雲.svg"
IF F$<>"" THEN
OPEN #1:NAME F$
ERASE #1
PRINT #1:"<?xml version=";CHR$(34);"1.0";CHR$(34);" encoding=";CHR$(34);"utf-8";CHR$(34);"?>"
PRINT #1:"<!DOCTYPE svg PUBLIC ";CHR$(34);"-//W3C//DTD SVG 1.1//EN";CHR$(34);" ";CHR$(34);"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";CHR$(34);" ["
PRINT #1:" <!ENTITY ns_svg ";CHR$(34);"http://www.w3.org/2000/svg";CHR$(34);">"
PRINT #1:" <!ENTITY ns_xlink ";CHR$(34);"http://www.w3.org/1999/xlink";CHR$(34);">"
PRINT #1:"]>"
PRINT #1:"<svg version=";CHR$(34);"1.1";CHR$(34);" xmlns=";CHR$(34);"&ns_svg;";CHR$(34);" width=";CHR$(34);STR$(XSIZE);CHR$(34);" height=";CHR$(34);STR$(YSIZE);CHR$(34);" viewBox=";CHR$(34);"0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34)
PRINT #1:" overflow=";CHR$(34);"visible";CHR$(34);" enable-background=";CHR$(34);"new 0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34);" xml:space=";CHR$(34);"preserve";CHR$(34);">"
END IF
CALL RECURSIVE(N,150,300,550,300,#1)
IF F$<>"" THEN
PRINT #1:"</svg>"
CLOSE #1
END IF
END
EXTERNAL SUB RECURSIVE(N,X1,Y1,X2,Y2,#1)
IF N=0 THEN
PLOT LINES: X1,Y1;X2,Y2
IF F$<>"" THEN PRINT #1:"<line x1=";CHR$(34);STR$(INT(X1));CHR$(34);" y1=";CHR$(34);STR$(INT(YSIZE-Y1));CHR$(34);" x2=";CHR$(34);STR$(INT(X2));CHR$(34);" y2=";CHR$(34);STR$(INT(YSIZE-Y2));CHR$(34);" stroke=";CHR$(34);"black";CHR$(34);" stroke-width=";CHR$(34);"1";CHR$(34);"/>"
ELSE
CALL RECURSIVE(N-1,X1,Y1,L1*(X2-X1)*COS(LTH*PI/180)-L1*(Y2-Y1)*SIN(LTH*PI/180)+X1,L1*(X2-X1)*SIN(LTH*PI/180)+L1*(Y2-Y1)*COS(LTH*PI/180)+Y1,#1)
CALL RECURSIVE(N-1,L2*(X1-X2)*COS(-RTH*PI/180)-L2*(Y1-Y2)*SIN(-RTH*PI/180)+X2,L2*(X1-X2)*SIN(-RTH*PI/180)+L2*(Y1-Y2)*COS(-RTH*PI/180)+Y2,X2,Y2,#1)
END IF
END SUB
|
|
|
投稿者:しばっち
投稿日:2012年10月21日(日)16時26分1秒
|
|
|
PUBLIC NUMERIC L1,L2,LTH,RTH,XSIZE,YSIZE
PUBLIC STRING F$
LET XSIZE=600
LET YSIZE=600
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0 , XSIZE-1 , 0,YSIZE-1
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
LET N=12
!'INPUT PROMPT "LEVEL":N
LET L1=1/SQR(2)
LET L2=.5
LET LTH=90
LET RTH=0
!'LET F$="霜柱.svg"
IF F$<>"" THEN
OPEN #1:NAME F$
ERASE #1
PRINT #1:"<?xml version=";CHR$(34);"1.0";CHR$(34);" encoding=";CHR$(34);"utf-8";CHR$(34);"?>"
PRINT #1:"<!DOCTYPE svg PUBLIC ";CHR$(34);"-//W3C//DTD SVG 1.1//EN";CHR$(34);" ";CHR$(34);"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";CHR$(34);" ["
PRINT #1:" <!ENTITY ns_svg ";CHR$(34);"http://www.w3.org/2000/svg";CHR$(34);">"
PRINT #1:" <!ENTITY ns_xlink ";CHR$(34);"http://www.w3.org/1999/xlink";CHR$(34);">"
PRINT #1:"]>"
PRINT #1:"<svg version=";CHR$(34);"1.1";CHR$(34);" xmlns=";CHR$(34);"&ns_svg;";CHR$(34);" width=";CHR$(34);STR$(XSIZE);CHR$(34);" height=";CHR$(34);STR$(YSIZE);CHR$(34);" viewBox=";CHR$(34);"0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34)
PRINT #1:" overflow=";CHR$(34);"visible";CHR$(34);" enable-background=";CHR$(34);"new 0 0 ";STR$(XSIZE);" ";STR$(YSIZE);CHR$(34);" xml:space=";CHR$(34);"preserve";CHR$(34);">"
END IF
CALL RECURSIVE(N,200,300,600,300,#1)
IF F$<>"" THEN
PRINT #1:"</svg>"
CLOSE #1
END IF
END
EXTERNAL SUB RECURSIVE(N,X1,Y1,X2,Y2,#1)
IF N=0 THEN
PLOT LINES: X1,Y1;X2,Y2
IF F$<>"" THEN PRINT #1:"<line x1=";CHR$(34);STR$(INT(X1));CHR$(34);" y1=";CHR$(34);STR$(INT(YSIZE-Y1));CHR$(34);" x2=";CHR$(34);STR$(INT(X2));CHR$(34);" y2=";CHR$(34);STR$(INT(YSIZE-Y2));CHR$(34);" stroke=";CHR$(34);"black";CHR$(34);" stroke-width=";CHR$(34);"1";CHR$(34);"/>"
ELSE
CALL RECURSIVE(N-1,X1,Y1,L1*(X2-X1)*COS(LTH*PI/180)-L1*(Y2-Y1)*SIN(LTH*PI/180)+X1,L1*(X2-X1)*SIN(LTH*PI/180)+L1*(Y2-Y1)*COS(LTH*PI/180)+Y1,#1)
CALL RECURSIVE(N-1,L2*(X1-X2)*COS(-RTH*PI/180)-L2*(Y1-Y2)*SIN(-RTH*PI/180)+X2,L2*(X1-X2)*SIN(-RTH*PI/180)+L2*(Y1-Y2)*COS(-RTH*PI/180)+Y2,X2,Y2,#1)
END IF
END SUB
|
|
|
戻る