CS430 - 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/page to be 501 x 501.
  5. Each Bezier curve is parameterized from 0 to 1.
  6. [-N] This option specifies the number of line segments used to represent the curve. The increment of the parameter u is defined as 1/N.
    The next argument is a positive integer. (20)
  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 -N 20 > out.ps
  10. If the tester enters ./CG_hwEC > out.ps , the results should be the same as from the command line above, and produce the following image.
    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.ps         ii. Output:

  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 -N 20 > hwEC.ps         ii. Output:

  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 -N 20 > hwEC.ps         ii. Output:

  14. Input/Output Example:
            i. Input: ./CG_hwEC -N 4 > hwEC.ps         ii. Output:

  15. Input/Output Example:
            i. Input: ./CG_hwEC -a 110 -b 50 -c 410 -d 500 -j 123 -k 50 -o 379 -p 477 -N 8 > hwEC.ps         ii. Output:


    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 Postscript 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 December 3, 2021.