CS430/536 - Extra Credit Assignment

Programming Problem:

1. The new command you'll be required to implement is:
    1. x1 y1 x2 y2 x3 y3 curveto
The curveto command draws a cubic bezier curve using the current position of the pen, and the three integer points given as control points. Each curve will be defined by a "moveto", "curveto", "stroke" triplet.

%%%BEGIN
10 10 moveto
20 20 130 130 250 20 curveto
stroke

250 20 moveto
120 120 170 170 50 20 curveto
stroke

350 350 moveto
370 400 425 450 450 400 curveto
stroke
%%%END

2. Write a program, named CG_hwEC, to:
  1. Accept the "Curveto" Postscript command
  2. All the command line options implemented in HW3 should be supported.
    NOTE: You should be able to process any subset of the command-line arguments in any arbitrary order.
  3. Draw the Bezier curve as a sequence of (potentially clipped) line segments.
  4. Define the resolution of your output image to be 501 x 501.
  5. Each Bezier curve is parameterized from 0 to 1.
  6. [-L] This option specifies the increment of the parameter u to be used when generating points on the curve.
    The next argument is a real number between 0 and 1. (0.05)
  7. Be sure to evaluate the curve only in the range 0 ≤ u ≤ 1, and to include both endpoints.
  8. You can test your program with ExtraCredit.ps.
  9. The default option set for this assignment is equivalent to this command line.
        ./CG_hwEC -f ExtraCredit.ps -a 0 -b 0 -c 250 -d 250 -j 0 -k 0 -o 200 -p 200 -s 1.0 -m 0 -n 0 -r 0 -L 0.05 > out.xpm
  10. If the tester enters ./CG_hwEC > out.xpm , the results should be the same as from the command line above, and produce the following image. Here is the XPM image file.
    PLEASE NOTE THAT THE BORDER IS NOT PART OF THE OUTPUT IMAGE. IT HAS BEEN PLACED AROUND THE IMAGE TO HIGHLIGHT THE POSITION OF THE VIEWPORT WITHIN THE WINDOW.

  11. Input/Output Example:
            i. Input: ./CG_hwEC -f ExtraCredit.ps -a 0 -b 0 -c 500 -d 500 -j 0 -k 0 -o 500 -p 500 > hwEC.xpm         ii. Output: Here is the XPM image file.

  12. Input/Output Example:
            i. Input: ./CG_hwEC -f ExtraCredit.ps -a 110 -b 0 -c 410 -d 500 -j 0 -k 110 -o 500 -p 410 -s 1 -m 0 -n 0 -r 0 -L 0.05 > hwEC.xpm         ii. Output: Here is the XPM image file.

  13. Input/Output Example:
            i. Input: ./CG_hwEC -f ExtraCredit.ps -a 10 -b 10 -c 500 -d 400 -j 10 -k 10 -o 500 -p 400 -s 1.2 -m 30 -n 20 -r 10 -L 0.05 > hwEC.xpm         ii. Output: Here is the XPM image file.

  14. Input/Output Example:
            i. Input: ./CG_hwEC -L 0.25 > hwEC.xpm         ii. Output: Here is the XPM image file.

  15. Input/Output Example:
            i. Input: ./CG_hwEC -a 110 -b 50 -c 410 -d 500 -j 123 -k 50 -o 379 -p 477 -L 0.125 > hwEC.xpm         ii. Output: Here is the XPM image file.


    3. Grading Scheme

    1. HW3 options correct : 0.5 point
    2. Parsing input file correct : 1 point
    3. Incremental curve segments correct : 1 point
    4. Bezier curve evaluation/drawing correct : 2.5 points

    4. Submission Guidelines:

    1. Assignments must be submitted via Bb Learn.
    2. README file: explain the features of your program, language and OS used, compiler or interpreter used, name of file containing main(), and how to compile/link your program. Text files only. Word and PDF documents will NOT be accepted.
    3. All source code. Your code must compile and run on tux (Linux). The executable should be named CG_hwEC.
    4. You may program in any language you like as long it can produce a usable executable on tux.
    5. 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 tux without the installation of "special" libraries.
    6. Makefile: have the default rule compile your program. Jar file, if using java.
    7. If you are using a language that doesn't produce an executable file, e.g. python, then be sure to include a script called CG_hwEC that accepts arguments and prints XPM to standard out.
    8. Points will be deducted if submission guidelines are not followed.
    9. Further details about Bb Learn
      1. You can reach Bb Learn through DrexelOne.
      2. 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.
      3. Click on the assignment you wish to submit.
      4. Find your file and click Upload button.
      5. 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 19, 2015.