Sometimes the failures are more fun then the success's. The following code came about as I was looking for the sierpinski curve! Wasn't close, but this does draw some interesting pictures. I found the wreath and star buried in the code. The wreath was run with the arguments: '12 22000 120 6' the star was run '6 2000 90 5'. The idea here is to divide the line segment by 5 instead of 3 as in the Koch curve. to fract :n :len :angle :level repeat :n [fractf :len :angle :level rt 360 / :n] end to fractf :len :angle :level if :level < 1 [fd :len stop] sepisf :len / 5 :angle :level - 1 rt :angle sepisf :len / 5 :angle :level - 1 lt 90 sepisf :len / 5 :angle :level - 1 lt 90 sepisf :len / 5 :angle :level - 1 rt :angle sepisf :len / 5 :angle :level - 1 end There's lots more in there. Be warned the code does alot of backtraking so while it may not look like anyting is going on before you stop it check the status box to see if its really done (or better yet put a 'show "done' inst at the end of the main procedure). :n is the number of 'sides', :len is the starting segment length, :angle is the angle between line segments and :level controls the recusion. With high levels of recursion (and high here is really over 4) you need large numbers for the :len parameter to really see anything. The :len is being divided by 5 at each level of recursion. This code is pretty much 'standard form' for these types of images. The idea for it came from Clayson's book, 'Visual Modeling with Logo'. (Gee how I wish they would reissue it.) regards -- Frank Caggiano caggiano@atlantic.net http://www.atlantic.net/~caggiano
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