CS430/585 Homework Assignment 2
1. The new Postscript commands you will be required to implement are:
1. x y moveto
2. x y lineto
moveto command simply moves the
pen to a particular location without drawing anything.
The lineto command draws a line
from the current position of the pen, to the point indicated.
The stroke command can be ignored
in your program, but actually draws the line sequence in Postcript interpreters
The following commands will draw two boxes.
100 100 moveto
200 100 lineto
200 200 lineto
100 200 lineto
100 100 lineto
300 300 moveto
400 300 lineto
400 400 lineto
300 400 lineto
300 300 lineto
You can assume that a "moveto"/"stroke" pair defines a single closed polygon
with no holes and with vertices given in counter-clockwise order.
2. Modify your HW1 program to:
- Accept the "Moveto", "Lineto" and "Stroke" Postscript
- All the command-line options implemented in HW1 should be supported.
- Read in two polygons (first one is A, the second is B) and perform a
Boolean operation on them depending on one of the following flags
- -A union (A ∪ B)
- -I intersection (A ∩ B)
- If neither flag is given, draw both polygons.
- Your program does not need to handle situations that
produce mutiple polygons or polygons with holes.
- Display the polygon edges with the code implemented in HW1.
- Additional Weiler-Atherton resources
- You can test your program with several files that contain two
- This is what hw2_a.ps looks like.
- This is what hw2_b.ps looks like.
- This is what hw2_c.ps looks like.
3. Grading Scheme
- Assignment 1 features : 3 points
- Comand-line argument reading
- Image format
- Edge drawing
- Viewing/clipping operations
- Postcript reading : 1 point
- Union operator : 3 points
- Intersection operator : 3 points
4. Submission Guidelines:
- Assignments must be submitted via WebCT.
- README file: explain the features of
your program, language and OS used, compiler or interpreter used,
name of file containing main(). Word documents will NOT be accepted.
- All source code. Your code must compile and run
on either queen (Solaris) or tux (Linux). MacOS X is a negotiable
possibility. The TA will use one of these as the test platform.
- Binary executable named cs585_hw2
- You may program in any language you like as long as you
can deliver a usable executable on queen or tux. Please contact
the TA if you plan on using something other than C, C++ or Java.
- Your program will be run by the TA. Please do
NOT submit any image files, Visual C++ project files, or anything not requested
in this section. Your program must run on queen or tux without the
installation of "special" libraries.
- If programming in Java
- Test on queen with version 1.4.1. This is how your
assignment will be evaluated.
- No class or jar files. Submit your java files.
- Makefile (optional but appreciated): have the default
rule compile your program.
- Points will be deducted if submission guidelines are not followed.
- Futher details about WebCT
- You can reach WebCT from http://webct.drexel.edu.
- Choose Computer Graphics among your list of courses. There is an "assignments" link in
the left frame which will give you the list of assignments in the right frame.
- Click on the assignment you wish to submit.
- Find your file and click Upload button.
- Hit Submit button. DO NOT FORGET TO HIT THE SUBMIT BUTTON AFTER YOU UPLOAD ALL YOUR FILES.
NOTE: Your source code for all programming assignments will be run through
a plagiarism detection system. This program uses compiler techniques which
are invariant of syntax and style. If you are sharing code with other classmates,
you will get caught. Please refer to the student
handbook for actions that will be taken.
Last modified on January 18, 2005.