OOD Assignment – To be performed in groups of three people.

Your task is to write a 2D graphics engine for drawing composite objects out of basic primitives. Your program will read in a file containing a description of a scene in terms of n sided polygons and circles along with 2 basic types of manipulation (a 2D translation and a 2D scale). Your program will then turn this description into a 2D line drawing. Below are two examples for you to test your programs with, along with the picture that your program should produce.

Sample 1 file and the resulting picture

Sample 2 file and the resulting picture

A 3rd unseen file will be used in testing to see if your program operates correctly.

You'll be glad to know that you are not expected to build your graphics application from scratch and a sample application has been assembled to simplify the use of graphics. Please copy it to your local directory and compile it (make -f makefile_shape). The program uses openGl and glut, although these have been hidden away as much as possible so should not concern you. Should you wish to develop upon another platform you will need to install Glut to use the sample code.

All the rendering should occur within the draw function (see example), this unfortunately means you may need some global variables but the use of the static keyword will minimise this. Any initialisation within main should be done before the window object is instantiated.

Some basic openGl commands you will need to know are glColor3f(r,g,b); sets the colour to that specified by r,g,b.

glBegin(GL_LINE_LOOP);
        glVertex3f( 0.0f, 1.0f, 0.0f);                     // Top
        glVertex3f(-1.0f,-1.0f, 0.0f);                     // Bottom Left
        glVertex3f( 1.0f,-1.0f, 0.0f);                     // Bottom Right
glEnd();

This draws 3 connected vertices. You can have any number of vertices listed between the glBegin and glEnd commands.

glTranslatef(x,y,z) translates the cursor on the screen as we are only dealing with 2D you can keep z set to 0.0

glScalef(x,y,z) scales the objects being drawn, again as we are only dealing with 2D you can keep z set to 1.0

You shouldn't need to know anything more about OpenGL and rendering than that but should you wish, more details can be found here.

Design Specification Hints.

Use polymorphism to build an object which renders differently depending upon the type of object. That object may be a polygon, a circle, a translation or a scaling.

Use overloaded input/output operators to read in the content of the file


Assessment

The project will be assessed in three parts:

1) Initial Design: description of design and specification [30%] Due (Week 9) Wed 1/11/06 5pm (18:00).
2) Quality of code; good structure, correct use of language features, clarity of implementation, error checking, good comments [50%] Due (Week 12) Monday 23/11/06 10am (10:00).
3) Working code: demonstration of full implementation [20%] To be performed in Week 12 laboratory session 23rd November


Submission details:

Title: Preliminary Design

Due Date: (Week 9) Wed 1/11/06 5pm (18:00).

Length: 2 Pages Max A4 11pt text

Contents: The title, names of members of group and login id's. It should then discuss the software design in broad terms: include decisions on the overall software design (with diagram of class hierarchy), the memory management used, error handling and any additional related class and functionality implemented.


Title: Final Submission

Due Date: (Week 12) Monday 23/11/06 10am (10:00). You will demonstrate your program in the laboratories on the 23rd November.

Length: 1 Page A4 11pt text + compact printout of code

Content: A Title page stating team members names and login id's and declaring their contributions to the project i.e. 33% each. Each student should sign this declaration to show they agree with the weight of their contribution. A clear class hierarchy diagram should be included followed by a compact printout of the code.

A hardcopy of assignments whether postgrad or undergrad should be submitted to the appropriate assignment submission box or office prior to the deadline of 3pm today. No electronic submission is required this year unless I decide I need to do a plagiarism test. In which case you will be contacted.

Failure to adhere to these guidelines will result in marks being deducted. There will be no extensions. Work handed in late will suffer the standard penalties laid out by the school.

The Default Lateness Penalty Scheme

The late submission of an assignment or piece of coursework will lead to the reduction of the unpenalised mark by 10% per day, or per part day, of lateness. After the first day, the 10% reductions will accrue in compound fashion. Since extending a deadline over a weekend may be very beneficial to a candidate, days will be counted to include weekends and Bank Holidays.

Module organisers must specify each assignment deadline, to include the latest acceptable date and time of submission. Work should be put into the Undergraduate Post Box in the Student Common Room, which is emptied every day by the staff in the Undergraduate Office, before being passed to the relevant examiner for marking. The examiner will then calculate the applicable penalty. Any subsequent marksheet will be annotated with the penalty, for record keeping purposes (e.g. in the case of appeal).

Students who wish to avoid a penalty in the case of illness or another good cause must provide comprehensive documentation, medical or otherwise.