See below.
The root of the scene graph is a Group
.
The nine rectangles are children of the root.
When the scene is rendered (used to make a picture),
the graphics system traverses the graph,
looking in each object for its color, size, and location.
The scene graph is rendered in the order that Shape
s were added to it.
So in this scene graph the first rectangle (at scale=0.9
) is drawn first.
If you set the fill colors of the rectangles to something other than TRANSPARENT
this will affect the picture.
If you draw solid rectangles, draw the largest rectangle first (as here) so that the smaller rectangles are placed on top of it and are visible. This is one of the exercises for this chapter.
Here are (again) the two parts to recursion:
For the nested rectangles, there are two parts, also.
What is the easy problem that can be solved in one step?
What is the big problem that must be divided into smaller problems?