CS 110 (Introduction to Computing)
Spring 2016
Assignment #3
Due by 11:40 AM on Monday, February 29, 2016
Task: Design a sketch of your choice. Write functions to
draw iconic shapes that will be in your scene. Each of your functions should
have parameters to specify the location and size of the shape as well
as at least one other feature. For
example, you could use an x and a y that define the starting
location (center or corner) of the shape, a scale factor (or two if
you wish to scale in both x and y directions independently), and a color. Function-drawn shapes should draw properly no matter where
on screen, and what scale factor is used.
Ideas for additional features as parameters in your shape:
- the number of subfeatures to draw
- a number for each subfeatures of your shape (e.g. 2 eyes, one mouth,
4 ears);
- a selection (as an integer) of one of 3 or more color pallets for
your shape (e.g. 1 for DARK, 2 for BRIGHT, or 3 for SNOWY)
- a color for each feature of your shape
- the angle of rotation of your shape (easier to handle if your
position is in the center)
Potential ways to specify location:
- Cartesian Coordinates (x,y)
- Polar Coordinates (r,theta)
- Grid Coordinates (row, column)
Potential ways to specify size:
- Percentage of default size (scale)
- Percentage of default width, height (scaleW,scaleH)
- Bounding rectangle (width,height)
- Bounding diameter (diameter)
Design at least two complex shapes that are drawn via functions. You should use at least one function per shape, but likely 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, size and shape, 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) to call your shape-drawing functions in your sketch.
- 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 fair complexity (just loading an image is treated as the same amount of effort of drawing an ellipse).
- Your shape functions should
have parameters to specify the location (e.g. x and y) and scale (e.g.
widthFactor and heightFactor) of the shape as well
as at least one other feature.
- 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 to call the shape-drawing functions.
- Variables used appropriately in the remainder of the assignment.
- Includes proper header and adequate comments.
- Drawing must scale properly regardless of the size of the sketch.
- Sign your work, using a parameterized function.
What to produce:
- The program
- A write-up with your name, course and assignment number and a paragraph about the sketch, its inspiration, and how you designed and implemented it. Include a brief discussion about your experience working on this assignment. It should be a separate document and left in the sketch folder.
- A gif/jpg/png image of your sketch. Place in the sketch folder.
What to Hand in:
- Submit a hard copy of 1, 2 and 3. This hard copy is due at the start of class on the due date.
- Submit an electronic copy of the entire sketch folder (including any images that you may have used), the screenshot and the writeup via Dropbox shared folder as usual. Please place the screenshot and write-up in the sketch folder.
Carefully read the Assignment Submission Policy
for how to submit your assignment.