CS 5721 - Computer Graphics
Homework 2: Rasterizing Lines (40 pts)
Due Date: Sept. 24, 2007 (before class)
Description
In this programming assignment, you will develop the algorithms that rasterize lines on a pixel display. There are two parts to this assignment:
- Draw lines using the integer-only version of the implicit line drawing equation
- Draw lines interpolating between two different colors at the start and end points of the line
Important Notes and Considerations
Both parts require that you create functions that can draw lines into your FrameBuffer. The simplest way to do this is to create member functions of the FrameBuffer class:
void FrameBuffer::rasterizeline_implicit( const Vector2D& p0, const Vector2D &p1, const Vector3D& c)
void FrameBuffer::rasterizeline_parametric( const Vector2D& p0, const Vector2D& p1, const Vector3D& c0, const Vector3D& c1)
These functions should be able to draw any line, given within the bounds of the frame buffer. In the implicit equation, lines will be a single color. In the parametric version, the color is interpolated between the endpoints.
Your FrameBuffer class must use dynamic memory allocation!
If you choose to provide gamma correction in your program (and it works), you will receive 10pts of extra credit on this assignment.
Grading
There are 40 points in this assignment and they will be broken down as follows:
- Code appears correct and compiles - 12pts
- Code executes correctly - 12pts
- Test images correctly generated - 12pts
- Creativity - 4pts
Testing
You need to test your functions and classes. You are responsible to make sure your classes work as specified and are correct. Your code should be robust. For instance, what happens when points are specified outside the frame buffer dimensions?
You programs need to create 3 images. We will compile and run your programs to verify these images are created.
For the first image you will allocate a framebuffer of size 725 pixels wide by 408 pixels high. In the center of this image, you need to generate a series of radial lines (mimicing a circle) with the implicit line rasterization. There should be at least 30 lines of all the same color. An example of the radial pattern follows:

For the second image, you need to allocate a framebuffer of size 640 pixels wide by 480 pixels high. You will now create a similar radial pattern but with random colors for all end points of the many lines.
For the third image, you need to generate your own creative rasterization. This is where the creativity aspect will be graded. Be creative. The image needs to be at least 640 wide by 480 high in size. Note that you will not receive many (if any) creative points for recreating the radial patterns above. Nor will you receive many creative points if you simply draw a few scattered lines. Be creative and try to come up with something interesting.
What to Turn In
As always, assignments should be turned in via the webdrop. Assignments must be received before class starts on the due date.
You need to turn in ALL of your code for this assignment. This includes any C++ files along with the main.cpp file that tests your code. We MUST know how to compile your program. It is easiest if you create a README.txt file in your submission that describes how to compile the program. If you use any additional files (like project files from Visual C++/.Net/Makefiles/Whatever) you must include these as well.
|