stairs Art/Electric
L-SYSTEMS
back to programs
 
koch snowflakes
general von koch
hilbert curve
pythagorean tree
H-H dragon curve
peano-gosper 19
'H' branching curve
plant
sierpinski square
sierpinski arrow
gosper square
sierpinski curve
spirograph circle
sierpinski carpet
sierpinski gasket
peano-gosper 13
peano-gosper 7
peano curve
penrose tiling
snowflake halls
peano octagon
peano hexagon
levy curve
sierpinski pentagon
not sierpinski
peano curve - H
square knot
sierpinski square 2
koch pentagram
fass curve
square cross
cesaro triangle
realistic snowflake
gray code dragon
sierpinski gasket 3
sierpinski sieve
koch square curve
koch curve 2
dekking island
koch island
koch ff curve
hexagon spacefill
 
e-mail
KOCH SQUARE CURVE 2 L-SYSTEM
lsys koch square curve
von koch square curve 2

PROGRAM KochIslandsCurve2   ! © W.van Duyn 15th May 2004
SET MODE "color"
SET WINDOW 0,1199,0,903
SET BACKGROUND COLOR "white"
CLEAR
CALL init
END

SUB init
OPTION ANGLE degrees
PRINT "input: x try 400, y try 200"
INPUT x,y
PRINT "input: Side try 400,level try 4, dimension try 4"
INPUT side,level,ak
CLEAR
SET COLOR "black"
BOX AREA 0,1199,0,903
FLOOD 1,1
LET a=0
LET k=360/ak
LET r=3+2*COS(k)
LET d= side/(r^(level))
FOR i = 1 TO ak
SET COLOR 11
CALL axiom(level,d,x,y,a,ak,k)
NEXT i
END SUB

SUB axiom(level,d,x,y,a,ak,k)
LET lev=level
CALL move(d,lev,a,x,y,k,ak)
CALL turnLEFT(a,k)
END SUB

SUB move(d,lev,a,x,y,k,ak)
IF lev=0 THEN
CALL travelON(d,a,x,y)
EXIT IF
ELSE
CALL move(d,lev-1,a,x,y,k,ak)
CALL turnLEFT(a,k)
CALL move(d,lev-1,a,x,y,k,ak)
CALL turnLEFT(a,k)
FOR p=1 TO ak-2
CALL move(d,lev-1,a,x,y,k,ak)
CALL turnRIGHT(a,k)
NEXT p
CALL move(d,lev-1,a,x,y,k,ak)
CALL turnLEFT(a,k) CALL move(d,lev-1,a,x,y,k,ak)
CALL turnLEFT(a,k) CALL move(d,lev-1,a,x,y,k,ak)
END IF
END SUB

SUB travelON(d,a,x,y)
OPTION ANGLE degrees
LET x2=x+d*cos(a)
LET y2=y+d*sin(a)
PLOT x,y;x2,y2
LET x=x2
LET y=y2
END SUB

SUB turnRIGHT(a,k)
LET a=a-k
END SUB

SUB turnLEFT(a,k)
LET a=a+k
END SUB


Website, Text and Some Images Copyright © 2002 tzingaro.com, all rights reserved.