Homework 2

Interactive Computer Graphics: A Top-Down Approach Using OpenGL (4th Edition)

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS/ECE 433 Introduction to Computer Graphics, Fall 2007 Homework 2 Due Sunday, October 7, 2007 at 11:59pm In this homework, you will get to experiment with the 2D and 3D transformations we have been talking about in class. 1. Experimentation with 2D Transformations (30 pts) In this portion of the assignment, you will write code that will allow you to apply a series of 2D transformations to the 2D model of a house. First, you will begin by writing a Matrix3x3 class that allows you to express rotations, translations, scales and shears in 2D as we discussed in class. Specifically you must: 1. Create a “*” operator that allows you to multiply the matrix by a vector of class Vector2D and returns a new vector 2. Create a “*” operator that allows you to multiply the matrix by another matrix and return a new matrix 3. Create an “=” operator that allows you to set the matrix to a set of new values 4. Create an identity method that sets the matrix to the identity matrix 5. Create methods to specify various transformations using the matrix. In particular, you will have to implement the matrices for translations, rotations, scaling, and shears. 6. For debugging, add a print() method that prints out the values of the matrix Once this has been done, you can verify that your matrix class works by creating matrices to transform the vertices of the house. To do this, multiply the vertices by the transformation matrix in the draw loop and the house should appear transformed in the result. Now implement a modelview matrix similar to that of OpenGL by making a global
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

Homework 2 - CS/ECE 433 Introduction to Computer Graphics,...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online