CS 242 Spring 2010 : Assignment 2.1
CS 242 Spring 2010 : Assignment 2.1
This page last changed on Mar 02, 2010 by m3rabb.
You will be given a file of data. This file is a formatted set of data and data graphics transformation operations. This data file would be interpreted by a real-time system meant to display the items in the display list.
You are welcome to use whichever C development environment you prefer.
For the Mac, we recommend that you use either Apple’s Xcode, which is free if you register
For Windows, we recommend you use either Visual Studio 2008 or Dev-C++. VS is free from the web store for engineers (http://webstore.illinois.edu click on the departments tab once you login).
For Linux, we recommend using Eclipse with CDT, installed using the same method mentioned above for Mac. Before you install the CDT or download the C/C++ version of eclipse, make sure you have all the necessary build tools installed on your machine first, since it will allow eclipse to autoconfigure itself rather than you doing it manually after the fact. To install the necesary files on popular distributions:
The data file will be composed of a header region followed by a data region The header region is contains two header blocks, and the data region contains a number of data blocks. Each data block represents either data coordinates, and transformations to be applied to data coordinates.
You must authenticate the file and successively trace through each data block.
The header region contains an authentication block followed by an offset table block.
The offsets contained in the table in the header are used to locate the start of the data blocks within the data region. Each offset represents the number of bytes after the end of the authentication block to the start the offset data block. The data blocks may or may not occur in memory in the order that their offsets occur.
A sequence of data blocks referenced from an offset is completed when you encounter a data return block.
Following the header block is the data region containing the data blocks.
Below are the byte formats of the possible data blocks. Each block begins with a one byte record id which determines its type:
A centroid sets the context for subsequent coordinates; i.e. coordinates are are offset relative to the current centroid stack. When you output coordinates, you should always output their absolute coordinates. If the same set of coordinated are “called” after a different centroid, you will output a different set of absolute coordinates. Whenever you encounter a new centroid it replaced the previous one.
If there were 4 successive calls to a set of coordinates you would output those coordinates 4 separate times.
Each list of 3D coordinates represent the raw data. Each coordinate is always relative to the current centroid.
When you encounter a scaling factor, you scale relative coordinates by shifting them left by the indicated number of bits. For example, a scaling factor of 5 will result in all x, y, and z coordinates to be shifted left 5 bits. Beware of shifting a coordinate value and causing an unintended overflow.
This operation jumps the trace to the data block at the specified offset. When a data return occurs, you must be able to return to the following data block.
As with the previous operation, this operation jumps to the data block at the specified offset. However, it also causes a rotational transformation on the subsequent coordinates. When a data return occurs, it undoes the current rotational transformation, and returns like the previous operation. New rotation calls build upon previous rotation calls, so you must be able to handle the stacked rotational contexts.
The data return pops your trace back to the position in the data block immediately following the previous call.
If there are no other return addresses on the data return stack, the trace returns to next offset in the offset table block.
Ultimately, you will need to output a human readable version of the data as if you traced an entire “frame” of a simulation. Some of the interpreted instructions will branch to other locations within the data and return to continue where they had left off.
You will need to output coordinates and indications of state changes. Coordinate values must be output in hexadecimal.
You must authenticate the binary data file and successively trace through each data block in the order in which its offset appears in the table. As you trace through the file you will output the encountered centroids, graphic transformations, and the values of absolute coordinates in a human readable form.
When a call occurs, you must:
Write specifications for a library of C functions that you will use to complete this assignment. You will give those specifications to another student in the form of comments describing the functionality you want and function “stubs”. A stub is the first line of the function declaration indicating the arguments and their order as well as the return type. In C these stubs are known as function prototypes. Your comments must be Doxygen compliant. Your commented prototype functions should be composed into a single valid .h header file.
You will receive specifications from another student assigned to you. The person for whom you are writing specifications and the person for whom you are writing code may not be the same person.
Present your specification in discussion section, pass them to the assigned student. Be prepared to review the specifications of the student assigned to you. You will be writing code to this specification the following week. The second week you will present the code of the person that wrote code to your specification.
Remember, one of the core goals of this course is to learn the power of small, focused and well-named functions and methods. You should specify functions that would be both necessary and useful to process the data file, such as:
|Document generated by Confluence on Feb 22, 2012 18:15|