Don't print this page. You can read it from the screen as you follow the steps.
Tutorial for Recursive Picture
A face should appear on the left hand side. It is a figure specified by a set of lines, circles, and arcs and by two points that are referred to as the "handles". The handles are the two red dots. Note where they are located with respect to the face.
Press the left mouse button down in one location. Continue to hold the button down while moving the mouse. Lift the button in a second location. Note where the face gets drawn with respect to where you press and release the mouse button. The figure of the face is translated, rotated, and scaled so that the two handle points of the figure land on the two points that you have specified.
A rectangle should appear on the left, with the handle at the top edge of the rectangle. On the right, a rectangle with an arrow pointing pointing down towards the "recurse" arrow "---> >---". Note that the handle at the top edge of the rectangle.
When "n=base=1", the figure that is on the left hand side is drawn. When "nonbase", the figure on the right is drawn.
Hold down the mouse button at the beginning of the arrow, i.e. "x---> >---", move the mouse to the end of the arrow, i.e. "---> >---x", and lift up the button.
A smaller "rectangle with arrows" with a smaller place to recurse arrow is pointed to by the first (and larger) rectangle.
You have drawn a "recursive picture". recPic.dem draws such pictures automatically. A recursive picture is specified by a "base case" figure, a "nonbase case" figure, by a set of "places to recurse", and by an integer "n". The base case figure is shown on the left hand side of the Edit Mode screen. In this case, it is the rectangle. The nonbase case figure and the places to recurse are shown on the right. The places to recurse are specified by an arrow. In our present example, the nonbase case figure is the "rectangle with arrows",and there is a single place to recurse. The value n is selected with the circle radio buttons on the right of the draw screen.
A recursive picture is drawn as follows. If n=base=1, then the base case figure is drawn. If n>1, then the nonbase case figure is drawn. As well, the location on the screen (specified by two points) of each place to recurse is determined. Then recursively the same picture is drawn at these locations but with the value n-1.
The best way to understand this is to try it with larger and larger values of n.
With n=2, the "rectangle with arrows" is drawn. Then at the one location to recurse the recursive picture for n'=n-1=1 is drawn. Recall the n=1 picture is only a rectangle (no arrows). Therefore, the rectangle is drawn at the place to recurse. Remember what the n=2 picture looks like.
Again the "rectangle with arrows" is drawn. Now, however, at the place to recurse, the n'=n-1=2 is drawn (the previous picture). Remember what the n=3 picture looks like.
Now the n=3 picture is drawn at the location of the first place to recurse.
Open <Examples:three>. Note what the base and the nonbase case figures are. Go into edit mode and select <nonbase>. Draw a big copy of the picture. Then in each of the four places to recurse draw a smaller copy of nonbase case figure. This produces 16 places to recurse. Again draw an even smaller copy at each of these locations. Repeat this until you get the idea. In order to stop, select <n=base=1> and draw the base case figure at each place to recurse.
Clear the screen and have the program draw the recursive picture. Start with n=base=1. Then n=2, n=3, ... . Each time remember what the previous picture looks like. Then for the next value of n, note how the nonbase case picture is drawn, however, in the "places to recurse" the picture for n-1 is drawn.