Problems for
Intermediate Methods in Theoretical Physics

Edward F. Redish

Matrices for Computer Graphics

These days, a lot of Holywood films are made with the assistance of computer graphics. Vectors are a critical tool in writing the code that implements these displays. But to use them for such a purpose they need to be thought of in a somewhat different way.

In considering vectors, we paid attention to how the description of a vector changed when our choice of the way to describe it changed -- how it changed when we changed our origin or the angle of orientation of our coordinate system. This view is called the passive transformation view. The object is considered fixed and the description of the object changes.

An alternative view is to consider the coordinate description fixed and the change due to the fact that we are moving our position or object. This is called the active transformation view.

The active view is particularly useful if we are writing computer programs to move objects around on the computer screen. Suppose we take the origin of our computer screen at the center of the screen with the x-axis running horizontally (positive to the right) and the y-axis running vertically (positive up). We specify the position of an object (say a graphic) by the vector of its coordinates, (x, y).

(a) If we have an object at the position (x,y) its distance from the origin is r = Sqrt(x2 + y2) and the angle its vector makes with the x axis is given by φ = tan-1(y/x). If we want to rotate the object's position so it is at the same distance from the origin but the angle its vector makes with the x axis is given by φ + θ, we can find its new coordinates (x',y') by multiplying the original coordinates by a matrix. Show that it is given by the following:

(b) Find the matrices that will flip an object around the x-axis (i.e., as if the x-axis were a mirror) and around the y-axis.

(c) Translating rather than rotating an object is a bit more difficult. It looks like we can't just use a matrix since matrices multiple our coordinates by something while translating by a displacement adds to our coordinates. It turns out we can get around this using a trick. If we imbed our 2-D vector in a 3-D space whose last component is always 1, we can create a 3x3 translation matrix. Find a 3x3 matrix that transforms any vector (x,y,1) into the vector translated by (a, b), that is, into the vector (x+a, y+a, 1).

(d) Find the 3-D imbedded versions of the rotation and reflection matrices.

This page prepared by

Edward F. Redish
Department of Physics
University of Maryland
College Park, MD 20742
Phone: (301) 405-6120

Last revision 27. December, 2010.