CS 372 Spring 2016 > Assignment 3
CS 372 Spring 2016
Assignment 3
Assignment 3 is due at 5 pm Tuesday, April 5. It is worth 20 points.
Procedures
This assignment is to be done individually.
Turn in answers to the exercise below on the UAF Blackboard Learn site, under Assignment 3 for this class.
- Your answers should consist of one file:
a PostScript file containing the final PostScript program
produced in Exercise A.
(As a correct PostScript file,
the filename should end with “
.ps
”, and the first line of the file should be “%!
”.) This file should be attached to your submission. - I may not look at your homework submission immediately. If you have questions, e-mail me.
Exercises (20 pts total)
Exercise A—Introduction to PostScript
Purpose
In this exercise you will learn the basics of the PostScript programming language, and you will write a PostScript program.
Instructions
Install a PostScript previewer, if you do not already have one.
- On Windows & Linux, GhostScript and GSView work well.
- On MacOS, the Preview application will do PostScript previewing.
However, it will not report PostScript errors.
To see error messages,
run
/usr/bin/pstopdf
from the terminal command line; this prints error messages to the standard output.
Work through A First Guide to PostScript, by Peter Weingartner. Focus on the first 5 sections, through “Drawing and Filling Shapes”. You may then skip a couple of sections, to cover the “Transformations” section.
Then do each of the following 7 steps.
- Modify the Drawing a Box program, so that one side of the square is left open—that is, without a visible stroke.
- Modify the Rotation Example program, so that the line being drawn gets longer as the rotation progresses.
- Modify the Translate program, so that it draws a 3-by-3 array of boxes.
- Modify the Shade and Width Example program, so that the boxes appear to have roughly the same size.
- Modify the above program again, so that the last box is drawn several times at different rotations.
- Write a program of your own
that draws something moderately complex,
including at least one circle or circular arc.
To draw a circle or arc,
you will need to use the
arc
command, described in the tutorial here. - Combine these six programs into one program that prints six pages. The first page contains the output from step 1, the second page contains the output from step 2, etc.
On Blackboard, turn in the .ps
file
for the final (step 7) program above.