CS-511 - Assignment 1 (5%)

2D Paint Program

Due by: September 9, 2008

Assignment Specifications

In this assignment you have to write a 2D Paint program. The program reads an input file in which geometric objects and associated attributes are described, and draws it on the screen. The objects are layered based on the order of their specification (the latest being drawn on top). Modified attributes affect only objects which are specified after their modification. The program should satisfy the following:

  1. Supported objects: Objects that may be drawn by the program include:

  2. Supported attributes: Attributes of objects include the following:

  3. Input file format: The input file describing the objects is a text file in which each line describes the addition of an object or the modification of the current attributes. Empty lines, and lines beginning with a # should be ignored. All the numbers in the file are considered to be real numbers. The following are possible lines in the input file:

      # Add a rectangle:
      ar <ll-corner-x> <ll-corner-y> <ur-corner-x> <ur-corner-y>
    
      # Add a circle:
      ac <center-x> <center-y> <radius>
    
      # Add a polyline:
      al <num-vertices> <v1-x> <v1-y> <v2-x> <v2-y> ...
    
      # Add a polygon:
      ap <num-vertices> <v1-x> <v1-y> <v2-x> <v2-y> ...
    
      # Set color:
      sc <R> <G> <B>
    
      # Set fill mode:
      sf <0.0|1.0>
    
      # Set translation:
      st <trans-x> <trans-y>
    
      # Set rotation:
      sr <deg-angle>
    
      # Set scale:
      ss <scale-x> <scale-y>
    

  4. Applying the attributes: Whenever an object is drawn it should be drawn with the currently set attributes. Changed attributes remain in effect until modified again. Transformations are considered in this program as attributes and should always be applied in a fixed order regardless of the order of their specification. Transformations should be applied in the following order: first the object should be scaled, then rotated, and finally translated. The initial attributes are:

  5. Modifying the coordinate system: By default the displayed part of the coordinate system is a range of $[-10.0, 10.0]$ in both the $x$ and $y$ directions. By pressing 'i' on the keyboard a ``zoom-in'' effect should be obtained by modifying the displayed range of the coordinate system to be half of its previous value in both the $x$ and $y$ directions. By pressing 'o' on the keyboard a ``zoom-out'' effect should be obtained by modifying the displayed range of the coordinate system to be double of its previous value in both the $x$ and $y$ directions.

Specific implementation notes

The following are required implementation notes:

Electronic Submission Instructions

Please follow the following submission procedure:

  1. Use OpenGL, C/C++, and GLUT. Do not use any Microsoft specific classes (MFC). Use SVL/VL for matrix and vector operations.

  2. Direct all questions/comments regarding the assignment to: $@cs.iit.edu$

  3. On or before the due date send an email to $@cs.iit.edu$ with a subject line stating ``assignment submission'', and attach to it a ZIP file containing the following:

    Note: we must be able to view your report, compile your code, and execute your program in order to grade it

  4. The organization of the submitted material should be as follows:

  5. Do not submit a paper copy of your report. You will be contacted by email if some material is missing or if you will need to meet with the TA.

  6. If you are late in the submission, send it by email as soon as you have it to $@cs.iit.edu$ . ``late days'' will be determined by your email date.



Gady Agam 2008-09-02