## CS 106 Winter 2017

### Question 1 Hierarchical drawing

Write a Processing sketch that draws a scene of your design, making use of geometric context functions. The scene can consist of anything you want, as long as it satisfies the conditions below.

1. Your sketch window should have size at least 400×400, and no more than 1000×1000. Choose a size that's most appropriate for your scene.

2. The scene should be figurative: it should contain clear objects (people, animals, plants, buildings, vehicles, etc.), and not consist entirely of abstract shapes.

3. Don't use any data from external files (images, SVG files, text files, etc.). All drawing should be based on calls to built-in drawing functions in the sketch itself.

4. At least one object must be an "advanced shape" (i.e., it must be drawn using beginShape(), vertex(), and endShape()).

5. There must be at least one object that's repeated: it should appear at least three times with different transformations, carried out using geometric context. Put the code to draw the object into a helper function, and call that function three times wrapped inside different transformations. At least one of the copies should be scaled, and at least one should be rotated.

Note that "repetition" doesn't necessarily imply the use of a loop. Suppose you have a helper function called myShape(). Then both of the following would be considered to contain three calls to the function:

```pushMatrix();
// Perform some transformations
myShape();
popMatrix();

pushMatrix();
// Perform some transformations
myShape();
popMatrix();

pushMatrix();
// Perform some transformations
myShape();
popMatrix();```
```for( int idx = 0; idx < 3; ++idx ) {
pushMatrix();
// Perform some transformations
myShape();
popMatrix();
}```
6. At least one object must use more than one level of hierarchy: a geometric context nested inside of another geometric context. See, for example, the door() and house() functions in the HierarchicalStreet sample sketch to see places where nested contexts are used.

The goal of this question is for you to exercise your use of translate(), rotate(), scale(), pushMatrix() and popMatrix(), but in an open-ended way. You should think carefully about what sort of scene you'd like to draw within the constraints above. Because this is the only question in this assignment, we encourage you to design a visually rich and interesting scene. Needless to say, we'll award bonus marks for especially creative or artistic results.

Save your work in a sketch called Scene, inside a folder called A05.

### Submission

When you are ready to submit, please follow these steps.

1. If necessary, review the Code Style Guide and use Processing's built-in auto format tool. You do not need to use the precise coding style outlined in the guide, but whatever style you use, your code must be clear, concise, consistent, and commented.

2. If necessary, review the How To Submit document for a reminder on how to submit to LEARN.

3. Make sure to include a comment at the top of all source files containing your name and student ID number.

4. Create a zip file called A05.zip containing the entire A05 folder and all its subfolders.

5. Upload A05.zip to LEARN. Remember that you can (and should!) submit as many times as you like. That way, if there's a catastrophe, you and the course staff will still have access to a recent version of your code.

6. If LEARN isn't working, and only if LEARN isn't working, please email your ZIP file to the course account (see the course home page for the address). In this case, you must mail your ZIP file before the deadline. Please use this only for emergencies, not "just in case". Submissions received after the deadline may receive feedback, but their marks will not count.