Due: 8 a.m., Friday, September 21
No extensions!
Summary: In this assignment, you will extend the ideas from the lab on iterating over positions in an image to build an interesting composite image.
Purposes: To give you further experience
with the region.compute-pixels! procedure. To
help you think about
applications of recent techniques to making images.
Expected Time: 1-2 hours
Collaboration: I encourage you to work in groups of size three. You may, however, work alone or work in a group of size two or size four. You may discuss this assignment with anyone, provided you credit such discussions when you submit the assignment.
Submitting: Email me your answer. More details below. Each group need submit only one answer.
Warning: So that this assignment is a learning experience for everyone, I may spend class time publicly critiquing your work.
Contents:
In the lab on
iterating over positions
in an image, you learned
how to use the region.compute-pixels! procedure to create
rectangles in which the color at any position is computed by a formula
based on the position. We call such computed swatches of color
gradients. For example, the following puts a 41x41
box with an interesting gradient somewhere in the middle of the image called
canvas.
(define square (lambda (x) (* x x)))
(region.compute-pixels!
canvas
80 80
120 120
(lambda (pos)
(rgb.new (* 0.5 (+ (square (- (position.row pos) 100))
(square (- (position.col pos) 100))))
(* 150 (abs (sin (* .2 (position.row pos)))))
0)))
We've also seen how to put borders on those gradients. One simple technique is to draw a larger, single-colored, box before we draw the gradient. For example, we might precede the preceding code with
(region.compute-pixels!
canvas 76 76 124 124
(lambda (pos) (rgb.new 0 0 0)))
Create an interesting image with three bordered rectangles. Each rectangle should have a different gradient, although you should use a similar formula to compute each gradient. At least two of the gradients should overlap. You may choose the size of the image, the size of the rectangles, and the formula for the gradients.
Write a short paragraph that explains your choice of gradients and placement.
I will primarily judge your work on your success and the structure of your code.
You are likely to receive a higher grade if you give a more careful analysis of how you arrived at your code and how the code relates to your goals for the gradient.
You are also likely to receive a higher grade if you find a way to generalize your code.
Please submit this work via email. The email should be titled CSC151 HW7 and should contain your code for creating the image.
Please send your work as the body of an email message. I don't like attachments, and prefer not to receive them when they can be avoided.
You need not attach the image you've created - I can run the code to create the image. (Note, also, that the code is likely to be much smaller than the image.)
Janet Davis (davisjan@cs.grinnell.edu)
Created September 17, 2007 based on http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2007F/Assignments/assignment.07.html