Fractalgon — Programs — LOGO last changed 3 June 2008 |
Fractalgon represents our final manipulation of CNgon. Here we replace each side of the polygon with a fractal line.
to CFNGON :sides :radius :lev :dir
ifelse (:dir >= 0) [set :dir 1] [set :dir -1]
pu fd :radius rt (90 + 180 / :sides) * :dir pd
repeat :sides
[FRACTALINE ((sin 180 / :sides) * :radius * 2) :lev rt (360 / :sides) * :dir]
pu lt (90 + 180 / :sides) * :dir bk :radius pd
end
to FRACTALINE :dist :lev
setc random 140 if :lev < 2 [fd :dist stop]
FRACTALINE (:dist / 3) (:lev - 1) lt 60
FRACTALINE (:dist / 3) (:lev - 1) rt 120
FRACTALINE (:dist / 3) (:lev - 1) lt 60
FRACTALINE (:dist / 3) (:lev - 1)
end