Spring 2011 CS5310 Computer Graphics
Assignment 0
Introduction
There are two parts to this assignment.
- You will choose a programming platform for the quarter and familiarize yourself with RGB color and the ppm format. In part, this assignment is to ensure that you have a method of submitting you work so that I can:
- read the code
- compile (or interpret) the code
- run the code to produce a file in ppm format.
- You will write your own 3D vector tools (e.g. as a JAVA class) that you will use for your later programming assignments.
Part 1: RGB Triangle
Write a program that generates a picture of a triangle in arbitrary position, such that the color at each pixel within the triangle is the blend of the colors of the vertices of the triangle as determined by the barycentric coordinates of the pixel. The color must be generated one pixel at a time and written to a ppm file.
Here are some triangles that were generated by such a program.
|
|
|
RGB at the vertices |
Other RGB Colors at the Vertices |
- Your program should work with any triangle in your graphics space, e.g. with all vertex coordinates between 0 and 300.
- Your program should work with any RGB colors assigned to the vertices.
- You can get the data for your triangles by:
- reading the information from a file, or
- reading mouse clicks, or
- generating appropriate random numbers.
- You must ouput your image to a ppm file.
Resources
See /course/csg140/codeSamples for code samples. (This directory is still active and systems has not yet created a cs5310 directory.)
Part 2: Vector Tools
Write a (Java) class for handling 3D vectors of doubles. You should also write a driver that tests your class. Your class should allow you to:
- Set and Get the x, y, and z components of a vector.
- Add two vectors
- Subtract one vector from another
- Multiply vector by scalar
- Divide a vector by a non-zero scalar
- Determine whether a vector is zero
- Test whether two vectors are equal
- Compute the dot product of two vectors
- Compute the cross product of two vectors
- Compute the length of a vector
- Normalize a vector
- Compute the angle between two vectors
What to submit
A zipped folder containing one folder for each part of this assignment.
- Triangle Folder
- your code
- a readme.txt file containing:
- instructions on how to run your program
- what to expect as output
- data file(s) if required
- how I can change the triangles and their colors
- anything that causes your program to crash
- NOTHING ELSE
- Vector Folder
- your code
- a readme.txt file containing:
- instructions on how to run your program
- what to expect as output
- anything that causes your program to crash
How to submit
Email your zipped work as an attachment to
with Subject: CS5310SP2011-prog0.
Due
By midnight Thursday, January 27, 2011
Grading
These grading guidelines will be used for all programming assignments:
Your project will be graded on:
- correctness (60%).
- style of your program (10%) (20% for part 2)
- documentation:
- inline comments (10%)
- README (10%)
- quality of the resulting image(s). (10%) (0% for part 2)
Some points may be subtracted (up to 10%) if you need substantial help from the TA or professor to make your program run.
The penalty for a late homework is 5% per calendar day for up to one week late.
No homework will be accepted later than that.
Harriet Fell
College of Computer Science, Northeastern University
360 Huntington Avenue #202WVH
Boston, MA 02115
Phone: (617) 373-2198 / Fax: (617) 373-5121
Last Updated:
The URL for this document is: http://www.ccs.neu.edu/home/fell/CS5310/Assignments/CS5310SP2011prog0.html