> Date - Sat, 13 Jun 1998 08:28:55 +0200
> From - Peter Rottensteiner <rope@netway.at>
>
> Hi there!
> I'd like to have same examples for recursion, such like the Koch-curve.
> Could any send me in MSW-LOGO
> Please
> Thanx
> Rope
>
Hi Peter,
On the page
http://archives.math.utk.edu/software/msdos/fractals/fractree/.html
you may find rather interesting program FRACTREE with the lot of
examples on recursion graphics, though I'm not sure it's easy to
translate the formal descriptions presented there into Logo (for me,
it turned to be a hard problem). But, I think, you'll get a lot of
pleasure working with it.
As to real codes, may be these ones will suit you.
The first two programs were designed according to Yehuda's wonderful
lessons, which he made for me and my students. You might want to test
other parameters.
The third program is called "AntiSnowflake" and if you compare it
with the Koch snowflake, it'll be clear where the name comes from.
The fourth program was designed by my young student. We were studying
the page on fractals
http://www.math.umass.edu/~mconnors/fractal/fractal.html
and discussing the question how to draw a fractal using
initiator/generator and he just invented his own generator.
Regards,
Olga
-------------- 1 --------------------------
to main1 ; Example for square shapes
cs ht ; plain cosmetics
setsc 0
setpc 4
pu setxy -70 -70 seth 0 pd
shape1 4 140 .45 6
end
to shape1 :sides :size :fract :level
if :level<1 [stop] ; every recursive program needs a stop rule
repeat :sides[shape :sides :size*:fract :fract :level-1 fd :size rt
360/:sides] end
------------------ 2 -----------------------------
to main2 ; An example for pentagonal shape
cs ht setsc 0
setpc 3
pu setxy -25 -30 seth -18 pd
draw2 5 50 .33 4
end
to draw2 :sides :size :fract :level
if :level<1[stop]
repeat :sides[shape2 :size :fract rt 360/:sides]
end
to shape2 :size :fract
fd .5*:size*(1+:fract) rt 180
draw :sides :size*:fract :fract :level-1
rt 180 fd .5*:size*(1-:fract)
end
------------------------ 3-------------------
to main ; AntiSnowflake
cs ht
pu setxy -100 -85 seth 30 pd
draw 200 3
end
to draw :size :level
repeat 3[side :size :level rt 120]
end
to side :size :level
if :level<1[fd :size stop]
side :size/3 :level-1
rt 60 side :size/3 :level-1
lt 120 side :size/3 :level-1
rt 60 side :size/3 :level-1
end
------------------------- 4 ------------------
to main ; Cross
cs ht
pu setxy -22 -22 pd
do 45 3
end
to do :size :level
repeat 4[shape :size :level rt 90]
end
to shape :size :level
if :level<1[fd :size stop]
shape :size/3 :level-1 lt 90
shape :size/3 :level-1 lt 90
shape :size/3 :level-1 rt 90
shape :size/3 :level-1 rt 90
shape :size/3 :level-1 lt 90
shape :size/3 :level-1 rt 90
shape :size/3 :level-1 rt 90
shape :size/3 :level-1 lt 90
shape :size/3 :level-1 rt 90
shape :size/3 :level-1 rt 90
shape :size/3 :level-1 lt 90
shape :size/3 :level-1 lt 90
shape :size/3 :level-1
end
---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org. Mail
questions about the list administration to logofdn@gsn.org. To
unsubscribe send unsubscribe logo-l to majordomo@gsn.org.
Global SchoolNet Foundation -
Linking Kids Around the World!
Copyright GSN - All Rights Reserved
- Comments
& Questions
Visit GSN's
Global
Schoolhouse for more exciting learning resources!
Search our Site
-
Home