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
GENERALIZED VON KOCH
snowflake
mouseover reveals six sided von koch

PROGRAM Generalized_von_Koch ! © W.van Duyn April 18th 2004
SET MODE "color"
SET WINDOW 0,1199,0,903     !tune to suit monitor
SET BACKGROUND COLOR "white"
CLEAR
CALL init
END

SUB init
PRINT "input position try x, 200 and y, 600"
INPUT x,y
PRINT "input side try 400, level try 4, dimension try 6."
INPUT size,level,ak
CLEAR
SET COLOR "blue"
FLOOD 1,1
SET COLOR "white"
LET a=0
LET k=360/ak
For ii = 1 TO ak
CALL shift(level,size,x,y,a,ak,k)
NEXT ii
SET COLOR "black"
FLOOD 1,1
END SUB

SUB shift(level,size,x,y,a,ak,k)
LET r=3
LET d=size/(r^level)
LET lev=level
CALL move(d,lev,a,x,y,k,ak)
CALL turnRIGHT(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)
FOR p=1 TO ak-2
CALL turnRIGHT(a,k)
CALL move(d,lev-1,a,x,y,k,ak)
NEXT p
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 dx=d*cos(a)
LET dy=d*sin(a)
LET x2=x+round(dx)
LET y2=y+round(dy)
PLOT x,y;x2,y2
LET x=x+dx
LET y=y+dy
END SUB

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

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


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