COM 1370 Computer Graphics - Summer 2001 - Assignment 3

Professor Futrelle -- College of Computer Science, Northeastern U., Boston, MA


Updated Friday 7/6/2001

Your grade: Doing Part 1 tolerably will get you a 'C'. Doing it particularly nicely can get you a B. Doing the more difficult part (Part 2) and doing it well can earn you up to an 'A'.

This assignment is due electronically by the midnight on Thursday, July 12th (by the end of that day). Remember, turn in whatever you have done by that time.


This will be our introduction to geometric transformations, which lie behind much of computer graphics, especially animation. The basic part of this assignment will involve simple translation of a line, using the appropriate transformation matrices and a timing loop (thread). No grid or fat pixels are used in this assignment.

Demo: Here's a simple demo of how a timing loop could be used to move a line, but done without the matrix transformations you'll need to do. Here's the demo applet and the demo source code.

The assignment:

Assignment 3, Part 1: You are to create a Matrix2D class and a CGLine2D class such that the matrix can move the line in 2D and allows the line to be drawn. The specifics follow:

Assignment 3, Part 2 (Pretty Hard): Create a static method mult(Matrix2D, Matrix2D) of Matrix2D that multiplies two matrices together and returns the result as a new matrix. Use this to write a static method rotateAroundPoint(double x, Point p) that composes three matrices to first translate to the origin from p, then rotate by theta and then translate back, effectively rotating around the point specified. The method returns a new matrix that is the appropriate product of the three specified. Use this to "spin" a line around its center. Do this in parallel for three different lines of three different colors, each spinning around their own centers at different rates. It'll be hard but it will look nice! Hint: In doing these multiplications, you'll find it useful to create a matrix of all zeroes, which you can do with zero arguments constructor. You'll need this because matrix multiplication involves *adding* a set of products to get the final value of each element.

See the page on electronic handins for the correct way to set up your directories and files for your electronic handins.

Go to COM1370 home page

Return to Prof. Futrelle's home page