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
dekking island
koch island
koch ff curve
hexagon spacefill
 
e-mail
HEXAGONAL SPACEFILL CURVE L-SYSTEM
lsys Koch Curve FF
hexagon spacefill

PROGRAM LSYS_TRIPOD_1   !© W.van Duyn May 19th 2004
OPTION ANGLE degrees
SET WINDOW 0,1199,0,903
SET background color "white"
SET color 0
PRINT "location: x try 400,y try 450"
INPUT x,y
PRINT"Number of iterations try 4 or 5, size try 360,angle try 6"
INPUT depth,size,ak
CLEAR
SET COLOR "black"
BOX AREA 0,1199,0,903
LET k=360/(2*ak)
LET r=SQR(3)
LET d=size/r^depth
LET a=0
FOR i=1 TO ak/2
SET color i+9
CALL lsys(depth,d,a,k,x,y)
CALL turnRIGHT(a,k)
CALL turnRIGHT(a,k)
CALL turnRIGHT(a,k)
CALL turnRIGHT(a,k)
NEXT i
END

SUB lsys(depth,d,a,k,x,y)
IF depth=0 THEN
CALL moveON(d,x,y,a)
EXIT IF
ELSE
CALL turnLEFT(a,k)
CALL lsys2(depth-1,d,a,k,x,y)
CALL push(d,x,y,a)
CALL turnLEFT(a,k)
CALL turnLEFT(a,k)
CALL lsys(depth-1,d,a,k,x,y)
CALL pop(d,x,y,a)
CALL turnRIGHT(a,k)
CALL turnRIGHT(a,k)
CALL lsys(depth-1,d,a,k,x,y)
CALL turnLEFT(a,k)
END IF
END SUB

SUB lsys2(depth,d,a,k,x,y)
IF depth=0 THEN
CALL moveON(d,x,y,a)
EXIT IF
ELSE
CALL turnRIGHT(a,k)
CALL lsys2(depth-1,d,a,k,x,y)
CALL push(d,x,y,a)
CALL turnRIGHT(a,k)
CALL turnRIGHT(a,k)
CALL lsys(depth-1,d,a,k,x,y)
CALL pop(d,x,y,a)
CALL turnLEFT(a,k)
CALL turnLEFT(a,k)
CALL lsys(depth-1,d,a,k,x,y)
CALL turnRIGHT(a,k)
END IF
END SUB

SUB moveON(d,x,y,a)
OPTION ANGLE degrees
LET dx=d*cos(a)
LET dy=d*sin(a)
PLOT x,y;x+dx,y+dy
LET x=x+dx
LET y=y+dy
END SUB

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

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

MODULE stack
SHARE state(40,4),stack
LET stack=1

SUB push(d,x,y,a)   !save the graphics state
LET state(stack,1)=d
LET state(stack,2)=x
LET state(stack,3)=y
LET state(stack,4)=a
LET stack=stack+1
END SUB

SUB pop(d,x,y,a)   !restore the graphics state
LET stack=stack-1
LET d=state(stack,1)
LET x=state(stack,2)
LET y=state(stack,3)
LET a=state(stack,4)
END SUB

END MODULE


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