CS 110 (Introduction to Computing)
Spring 2012
Assignment #3
Due by 12 midnight on Wednesday, February 15, 2012
Task: Design a sketch of your choice. Write functions to draw iconic shapes that will be in your scene. Your functions should take these parameters: an x and a y that define the starting location (center or corner) of the shape, and a scale factor (or two if you wish to scale in both x and y directions independently). You may wish to add additional parameter for color, fill, stroke, etc. Function-drawn shapes should draw properly no matter where on screen, and what scale factor is used.
Design at least two complex shapes that are drawn via functions. You should use at least one function per shape, but
possibly more as it is advisable to build complex shapes from simpler basic shapes, which are drawn via simpler functions. For example, if you decide to write a function to draw the Park Science Building (or any building), it will probably be a good idea to have a function that draws a window with parameterized location and size, and probably more for such things as the roof, the doors, etc. For each complex shape, show variations of location/size of the shape via multiple function calls.
- Make sure that your sketch is at least 500 pixels by 500 pixels.
- Interactivity is optional.
- Your scene does not need to be complex, but should be thematic and coherent.
- You must use explicit iteration (while or for-loop) somewhere in your drawing.
- Feel free to take code from a previous assignment and "functionize" it.
- Experiment with combining random, loops and function calls to generate many shapes.
- Include proper sketch source code header and adequate comments. (See
Assignment Submission Policy).
Requirements:
- At least two functions that draw shapes with some degree of complexity.
- Your shape functions should take at least the following parameters: an x and a y that define the starting location (center or corner) of the shape, and a scale factor (or two if you wish to scale in both x and y directions independently).
- Function-drawn shapes should draw properly no matter where on screen, and what scale factor is used.
- Multiple function calls to show variations of location/size of the shapes.
- Iteration (for-loop or while-loop) used somewhere in the assignment.
- Variables used appropriately in the remainder of the assignment.
- Includes proper header and adequate comments.
- Upload your sketch to Dropbox by 12 midnight, Wed 2/15
Extra Credit:
- Design your program so that it scales properly
regardless of the size of the sketch, that is, it looks and functions the same even if I go in and change the specified size of your sketch. Hint: compute all necessary
drawing parameters based on the width and height of the sketch.
- As always, extra credit will be given for creativity, aesthetics and work that goes above and beyond what's required.
Carefully read the Assignment Submission Policy
for how to submit your assignment.