Chapter 9. Graphical Applications
Dost thou love pictures?
—William Shakespeare, The Taming of the Shrew, 1594
In teaching almost any discipline, one quickly comes to appreciate the truth of the old saying that "a picture is worth a thousand words." As a means of expressing a general concept, a simple diagram often conveys far more than many pages of descriptive text. In computer science, however, this adage has another interpretation—a program that generates a picture is often a thousand times more captivating and exciting than one whose output is limited to words or numbers.
There are many applications in computer graphics in which recursion plays an important role. In Chapter 1, one of the first examples used to illustrate the idea of recursion was the problem of generating "computer art" reminiscent of Mondrian's style:
In this example, the complete picture is produced by dividing the original rectangle into parts which are, in turn, recursively subdivided until the program determines that the units are small enough to remain undivided.
Get Thinking Recursively with Java now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.