RecursiveDraw Applet Tutorial

One of the more interesting pictures I made with RecursiveDraw.

Recursion

Recursion is a way of defining something in terms of itself. For those familiar with programming languages, a recursive function or procedure is one which calls itself.

How the Applet works

The heart of this Applet is a recursive function.

First, the program takes line segments and points that the user has drawn and finds the distance between the first and the last point, and the angle that it forms with the x-axis. It then computes the angles and distances between every consecutive point, and expresses them in terms of the distance between and the angle formed by the first and last points.

The first time the Generate button is pushed, the program creates a 2nd figure by extrapolating the entire original figure between two consecutive points, treating the two consecutive points like the first and last point of the original figure. The second time the Generate button is pushed, the program extrapolates the original figure between every two consecutive points that are on the 2ND figure. After only a short time, the figure gets very complicated.

An example will probably make it clearer.

An Example Figure

Features of the RecursiveDraw Applet

I don't need directions! I want to see the Applet now!