CSE 681 - Autumn 2009

Homework #0

NOTE: This is not to be handed in. This is just if you want to get started early on code you going to have to write at some point anyway. This should not be a difficult exercise. If you have problems writing this code, then you should see me about what classes you should be taking.

  1. This code will be part of Lab 1. Write a small test program to make sure you understand how to write out ppm fil\ es. Portable pixmap format (ppm) is a very simple color image file format. We will be outputting images in this format in all the labs throughout the quarter. Use gimp, gqview or display to view it.

  2. This code will go right into Lab 2. Also, the code that parses the transformation commands will be used in an upcoming homework assignment.

    ASSIGNMENT:
    Write a parser for an input text scene description file(see format below), reading in values and setting variables in a scene description data structure.

    Data Structure

    Set up data structures for the following items. The variables in the data structures are the ones that are in the input file (see below).

    Simple Scene File Format
    bracketed values are floats unless they end in:

       '_i' : integer
       '_s' : non-whitespace string
       '_ws': text with whitespace terminated by the end of line
    

    # <comment_ws>
    sphere <x> <y> <z> <radius>  <r> <g> <b> <kd>
    camera <x> <y> <z> <cx> <cy> <cz> <angle> <aspect> <hither> <yon> <tilt> <xres_i> <yres_i>
    ambient <a>
    background <r> <g> <b>
    output <filename_s>
    identity
    rotate [x|y|z] <angle>
    translate <tx> <ty> <tz>
    scale <sx> <sy> <sz>