# Geometer’s Sketchpad Tour 8: Iterating to Snowflake

In this tour you’ll create what’s called an iterated function system: a repeated sequence of rotation and dilation of some initial figure.  Using the Iterate command, you can repeatedly rotate and dilate the subsequent figures to produce a fractal called the Koch curve—and then a variation on the Koch curve which includes an interior fractal too.  You’ll then turn the intire figure into a custom tool that you can apply to the three vertices of an equilateral triangle…making the Koch snowflake.

After writing out the procedure for this guide, I decided to go to town with an animated snowflake that has variable ratios for dimensions of the basic snowflake motif (4 line sequentially connected line segments, first and last colinear), but most of it didn't translate into an html applet. This is what was left:

Sorry, this page requires a Java-compatible web browser.

### Ideas in this tour:

• Sketchpad’s Iterate command.
• Changing the appearance of iterated images.
• Controlling the number of iterations in an iterated image.
• Background colors.

To initialize the iteration, first do the operations you want to later iterate.  For the Koch curve, the basic operations are

• Construct a line segment.
• Trisect the line segment into three (equal) parts.
• On the middle part construct an (equilateral) triangle and then delete its base.

In Sketchpad, this might work like so:

1.      In a new sketch, choose Preferences from the Edit menu.  On the Text page, choose For All New Points and click OK.  Points will now be automatically labeled.

2.      Construct a horizontal line segment from right to left. Holding down the shift key as you do this helps keep the segment horizontal.

 3.      Select point B and choose Mark Center from the transform menu.  4.      Select point A and choose Dilate from the Transform menu and set the parameters to 1/3, as shown at right. 5.      Repeat steps 3 and 4, only to dilate B towards A, again with the parameter set to 1/3.  You’ll have a picture something like this: 6.      Double click point B’ to mark it as a center. 7.      Select point A’ and choose Rotate from the Transform menu.  Set the angle of rotation to 60°, as shown, and click Rotate. 8.      You now have the 5 points you need for initial motif.  Select the original segment and hide it (ctrl+H) and then use the Segment tool to connect the five points, producing this:

9.      You may want to relabel the points.  To do that move the cursor over the point until the text hand appears and double click.  A dialog box will appear that allows you to rename the point.

### Iterating

Reflect on what you’ve done so far.  Starting with parents A and B you performed dilations, a rotation, erased the original segment and replaced it with four new segments.  What you will do now is use the Iterate command to repeat this process to each of the 4 new segments, just as was done to the original segment, then to each of the 16 resulting segments, and so on.

10.  Select points A and B and choose Iterate from the Transform menu.  The Iterate dialog box appears showing the two points selected as Pre-images.  The idea, is that the actions performed to create children from these parents (?) can be iterated to any other pair of points.  Click on A and B’ in the figure on the page to select these as the parameters for To First Image.

 11.  Choose Add New Map from the Structure submenu and map the same pre-image to the next segment, B’ to A”. 12.  Repeat Add New Map to add two more maps for the third and fourth segments.  You should have something like what’s shown at right.  You can adjust these by clicking in the map box and then clicking on the desired point on the page.

13.  Before clicking Iterate, click on Display to bring up its submenu.  Note that you could increase or decrease the number of iterations here, but 3 is good.  It’s a good thing to click the Final Iteration Only option though, since this will hide the line segments in each iteration that clutter the final curve.  After deselecting all and hiding the four original segments, you’ll get something that looks like the Koch curve:

### Iteration Depth, Color and Full Orbit Iteration

14.  To simulate a snowflake, you might want a white curve on a blue background.  You can set the background color from the Edit/Preferences/Color/Background option.

15.  Drag one of the endpoints out far enough to so that you can select individual segments.  Right click on a segment and make it thick and white.  You’ll see one fourth of all segments turn thick and white. Repeat the process 3 times for the rest of the segment and you’ll have a white curve on a blue background.

16.  Now, with the three points of the middle triangle selected, choose Triangle Interior from the Construct menu.  Right click on the highlighted interior and change its color to white.

17.  To change all the other interiors’ colors to white, repeat steps 10-13, only this time don’t choose Final Iteration Only, since this time you do want to see the full orbit iteration.  You may want to increase the iteration depth under the Display submenu before clicking Iterate.

18.  Hide the three points of the middle triangle.

### The Koch Snowflake

Now you’ll construct a custom tool to repeat everything you’ve done so far twice, to complete the closed curve.

19.  Press ctrl+A to select all and then choose Create New Tool from the Custom Tools menu in the Toolbox.  A name like “Koch Curve” will do.

20.  Rotate point A 60° about point B by double clicking on B, selecting A and choosing Rotate from the Transform menu.

21.  Select the three points showing and set the interior of the triangle white.

22.  Apply the Koch Curve tool to each of the two new sides (making sure the curve will be constructed on the outside of the central triangle.)  Hide all the points that show (for tidiness) and admire your result.  It should look something like the figure below.