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
PEANO CURVE - OCTAGON
peano curve octagon
comparison mouseover clarifies construction

PROGRAM Peano_Curve_OctagonStyled     !© W.van Duyn 23rd April 2004
!(see B.B.Mandelbrot, The Fractal Geometry of Nature: p63 )
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 200, y try 450"
INPUT x,y
PRINT "input: Size try 320,level try 3"
INPUT size,level
CLEAR
SET COLOR "black"
FLOOD 1,1
LET a=0
LET k=45
LET r=3
LET d=size/(r^(level))
LET lev=level
SET COLOR 13
CALL move(d,lev,a,x,y,k)
CALL travelON(d,a,x,y)
END SUB

SUB move(d,lev,a,x,y,k)
IF lev=0 THEN
EXIT IF
ELSE
CALL move(d,lev-1,a,x,y,k)
CALL travelON(d,a,x,y)
CALL turnLEFT(a,k)
CALL travelON(d,a,x,y)
CALL turnLEFT(a,k)
FOR i = 1 TO 3
CALL move(d,lev-1,a,x,y,k)
CALL travelON(d,a,x,y)
CALL turnRIGHT(a,k)
CALL travelON(d,a,x,y)
CALL turnRIGHT(a,k)
NEXT i
FOR j = 1 TO 3
CALL move(d,lev-1,a,x,y,k)
CALL travelON(d,a,x,y)
CALL turnLEFT(a,k)
CALL travelON(d,a,x,y)
CALL turnLEFT(a,k)
NEXT j
CALL move(d,lev-1,a,x,y,k)
CALL travelON(d,a,x,y)
CALL turnRIGHT(a,k)
CALL travelON(d,a,x,y)
CALL turnRIGHT(a,k)
CALL move(d,lev-1,a,x,y,k)
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 turnLEFT(a,k)
LET a=a+k
END SUB

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


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