Handout 14B

The purpose of this exercise is to use LOGO to create repeating patterns that cover the entire plane.

Last week we created beautiful patterns in a horizontal strip by drawing repeated copies of a motif transformed by various symmetries. This week we will fill the entire screen with our patterns; the patterns we will generate are traditionally called "wallpaper patterns". There are exactly seventeen different symmetry types of wallpaper pattern (so we would need to write seventeen different LOGO programs if we wanted to reproduce all of them.) We will start with a very simple pattern, using the same motif as last week.

TO RMOTIF :SIZE
  RIGHT 45 FORWARD :SIZE / (SQRT 2)
  LEFT 135 FORWARD :SIZE / 2
  LEFT 90 FORWARD :SIZE
  BACK :SIZE / 2
  RIGHT 180
END
We will need to use the Last week we used an infinitely repeating recursive procedure to repeat this motif over the whole screen. To cover the entire screen we need to repeat as often as possible in both horizontal and vertical directions. We'll use two FOR loops to do that, and the MOVERIGHT procedure from last week. Because the vertical motion will change depending on the pattern, we might or might not decide to write a corresponding MOVEUP procedure.
TO MOVERIGHT :DISTANCE
  PENUP
  RIGHT 90
  FORWARD :DISTANCE
  LEFT 90
  PENDOWN
END
In the pattern produced by the procedure below, the nearest neighbors of a motif surround it in a regular hexagonal pattern. Notice that one of the arguments of this procedure (:ROSETTE) is the name of a procedure that draws a motif!
TO HEXLATTICE :NUMBER :SIZE :ROSETTE

  MOVERIGHT -1 * :NUMBER * :SIZE     ; Move to lower left corner of grid.
  PENUP
  RIGHT 30 BACK :NUMBER * :SIZE LEFT 30
  PENDOWN

  FOR [HORIZONTAL 1 [2*:NUMBER]] ~
   [FOR [VERTICAL 1 [2*:NUMBER]] ~
     [
      RUN (SENTENCE :ROSETTE :SIZE)  ; Draw the "rosette pattern".
      PENUP
      RIGHT 30 FORWARD :SIZE LEFT 30 ; Move up to next row.
      PENDOWN
     ]

    PENUP
    RIGHT 30 BACK 2 * :NUMBER * :SIZE LEFT 30 ; Move to bottom row.
    MOVERIGHT :SIZE                  ; Move right a column.
    PENDOWN
   ]

  MOVERIGHT -1 * :NUMBER * :SIZE     ; Move the turtle back to start.
  PENUP                         
  RIGHT 30 FORWARD :NUMBER * :SIZE LEFT 30
  PENDOWN

END
Run the procedure a few times using commands like HEXLATTICE 3 40 "RMOTIF. Can you see the equilateral triangle and hexagonal elements of the pattern? Can you explain why the grid of flags isn't exactly centered on the turtle's starting position?

Write a procedure to draw your own motif which takes one argument, :SIZE, and use the HEXLATTICE procedure with that. If you're not sure what type of motif you want, try redesigning RMOTIF so that the flags don't touch when you run HEXLATTICE, or so that the grid of flags is centered on the turtle's starting position.

If you wish to make the program more readable and more modular, write a procedure HEXMOVEUP that takes a distance as an argument and then moves the turtle forward that distance at the appropriate angle.

Note: Following the conventions used to name the frieze patterns, the name for this pattern is o.


Write a procedure SQUARELATTICE :NUMBER :SIZE :ROSETTE that arranges copies of a motif in a square grid on the screen.

Square grid of copies of RMOTIF.
Note: The name for this pattern is also o, since there is a way to gradually change it until it matches the first pattern.


With carefully chosen arguments, we can draw repeating patterns that are even more beautiful and symmetric. Enter the following procedure and run the command HEXLATTICE 4 40 "THREE. What symmetries does the final pattern have?

TO THREE :SIZE
  REPEAT 3 [
    RUN (SENTENCE [RMOTIF] :SIZE)
    RIGHT 120
   ]
END
Note: The pattern drawn by THREE 50 is named 3. The pattern we got by repeating it on the hexagonal lattice is known as 333. Can you guess why?

Write a procedure named FOUR that draws a figure with four-fold rotational symmetry. Use this as an argument to your SQUARELATTICE procedure. (The name of the resulting pattern is 442.)


If have time left over you can try writting a ROSETTE procedure that has some mirror symmetry, explore the remaining thirteen wallpaper patterns using the program Kali (http://www.geom.umn.edu/java/Kali/program.html), or learn more about how these patterns are named by using Kali to follow the instructions at:

http://www.geom.umn.edu/education/math5337/Wallpaper/kali_exercise.html


Mtht420