CSU540 Computer Graphics Color Triangle Project Project

Professor Fell

     

Goals

In this assignment, you will use barycentric coordinates to smoothly blend RGB colors within a triangle. You will also learn to write your image to a file in ppm (portable pix-map format).

 

     

RGB Triangle Assignment

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 verticesOther 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.

What to submit
A zipped folder containing:

  • 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

How to submit
Email your zipped work as an attachment to fell@ccs.neu.edu with Subject: CSG540-triangle.

Grading
Your program will be graded on:

  • correctness (60%).
  • style of your program (10%)
  • documentation:
    • inline comments (10%)
    • README (10%)
  • quality of the resulting image(s). (10%)

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 #340WVH,
Boston, MA 02115
email: fell@ccs.neu.edu
Phone: (617) 373-2198 / Fax: (617) 373-5121

Last Updated:
The URL for this document is: http://www.ccs.neu.edu/home/fell/CSU540/programs/CSU540ColorTriangle.html