Geometric Art
Summary:
In this laboratory, you will further explore the techniques for making
geometric images.
Preparation
a. Create a new 200x200 image and call it canvas.
b. Make a copy of geometric-art-lab.scm.
Exercises
Exercise 1: Exploring Examples
a. Test each of the two basic procedures from
the reading:
draw-three-parallel-lines! and
draw-circle!. (Remember: You may need to
call context-update-displays! after drawing.)
b. Look at each of the examples in the introduction to the corresponding
reading, predict what you think the example code will do, and then run
the example in MediaScript.
c. The reading provides four procedures that draw parallel lines (with
some variation between them),
draw-parallel-lines!,
draw-colored-parallel-lines!,
draw-sin-with-parallel-lines!, and
draw-parallel-lines-with-decreasing-spacing!.
Make sure you understand what each of the procedures is supposed
to do, and then try using each with two different sets of parameters.
Exercise 2: Drawing Functions, Revisited
a. Make a copy of draw-sin-with-parallel-lines! and
rename it draw-func-with-parallel-lines!. Make
sure that this renamed copy still works.
b. Revise the procedure to graph cosine, rather than sine.
c. Revise the procedure to graph the sum of sine and cosine, rather than
the sine (or cosine).
d. Revise the procedure to graph a function of your choice.
e. Revise the function so that it draws each line in a different color
(based on the column of the line or the height of the line, as you
choose).
Exercise 3: Drawing Parallel Lines with Different Brushes
In the reading, we considered how one might use different brushes for
neighboring parallel lines, but never finished the procedure to do that.
Here's a header for that procedure.
(define draw-parallel-lines-with-many-brushes!
(lambda (image brushes n start-col start-row end-col end-row hoff voff)
...))
a. Finish writing the procedure. You should look at the definition of some
of the other parallel line procedures (such as
draw-parallel-lines!) to figure out what belongs.
b. What do you expect the following call to generate?
> (define some-brushes
(list "Circle (01)" "Circle (03)" "Circle (05)"
"Circle (07)" "Circle (09)" "Circle (11)"))
> (draw-parallel-lines-with-many-brushes!
canvas some-brushes 12
10 10 100 10
0 15)
c. Check your answer experimentally.
d. Extend the procedure so that it varies both color and brushes.
Exercise 4: Decreasing Spacing, Revisited
In the reading, we explored a procedure in which each space between lines
is half of the space between lines to the left. Some callers might prefer
to have a different ratio, such as 3/4 or 1/3. Let's rewrite the procedure
to permit the caller to specify that parameter, which we'll call
ratio. Here's the start of the new procedure,
with a somewhat shorter name.
(define draw-geometric-progression!
(lambda (image col start-row end-row spacing ratio close-enough)
...))
a. Write that procedure.
b. What do you expect the following set of instructions to do?
> (define new-canvas (image-new 200 200))
> (image-show new-canvas)
> (context-set-brush! "Circle (01)")
> (draw-geometric-progression! new-canvas 5 10 190 80 0.5 2)
> (context-update-displays!)
c. Check your answer experimentally.
d. Consider the following variant of the previous instructions, using a
smaller ratio. How do you expect the generated image to differ?
> (define new-canvas (image-new 200 200))
> (image-show new-canvas)
> (context-set-brush! "Circle (01)")
> (draw-geometric-progression! new-canvas 5 10 190 80 0.4 2)
> (context-update-displays!)
e. Check your answer experimentally.
f. Consider the following variant of the previous instructions, using a
larger ratio. How do you expect the generated image to differ?
> (define new-canvas (image-new 200 200))
> (image-show new-canvas)
> (context-set-brush! "Circle (01)")
> (draw-geometric-progression! new-canvas 5 10 190 80 0.75 2)
> (context-update-displays!)
g. Check your answer experimentally.
Exercise 5: Decreasing Spacing, Re-Revisited
As you probably discovered in the final problem of the previous exercise,
if the caller isn't careful, the final lines in the progression are drawn
off the side of the image.
a. Update draw-geometric-progression! so that
it stops for two reasons: the spacing is less than or equal to
close-enough (as before) or the line to be drawn is
outside the right-hand boundary of the image.
b. While draw-geometric-progression! is designed
for progressions in which the spacing between subsequent lines decreases,
we should also be able to make it draw progressions in which the spacing
increases. Write instructions for generating a sequence of lines in which
the first line appears in column 3, the next in column 5 (spacing of 2),
the next in column 9 (spacing of 4), the next in column 17 (spacing of 8),
and the spacing continues to double.
Exercise 6: Concentric Circles
In the introduction to the corresponding reading, after drawing three
parallel lines, we then generalized that technique. However, although
we drew three concentric circles, we never generalized that technique.
a. Write a procedure, (draw-bullseye!
image n
col row
outer-radius
delta-radius), that draws a
sequence of n concentric circles, all
with the same center, in which the outermost circle is radius of
outer-radius and each subsequent circle has a
radius that is delta-radius smaller.
b. As we saw in the reading, it can also be interesting to draw a
sequence of circles that do not share a center, but have a progression
of centers as well as a progression of smaller radii. Write a
procedure, (draw-circle-sequence!
image n
col row
radius d-col
d-row d-radius),
that draws a sequence of n
circles, the first of which is centered at
(col,row) with
radius radius, and each subsequent one
has the column offset by d-col, row
offset by d-row, and radius offset by
d-radius.
c. Rewrite draw-bullseye! so that its body is a call to
draw-circle-sequence!.
Explorations
Exploration 1: Your Own Images
Create an image that you find aesthetically appealing with a few calls to
one of the variants of draw-parallel-lines!. You should feel
free to change brush and foreground color between calls.
Exploration 2: Robert Delaunay
A number of artists have created interesting images using concentric
circles and other geometric shapes. One of the more famous is French
artist Robert Delaunay. Find a few of Delaunay's works and see if you
can make something that resembles a portion of a work using a variant
of draw-circle-sequence!.