Computer Graphics
The prior topic on Projective Geometry gives this model of how our eye, or a camera, sees the world.
All of the points on a line through the origin project to the same spot.
In that topic we defined that for any nonzero vector , the associated point in the projective plane is the set . This is the collection of nonzero vectors lying on the same line through the origin as .
To describe a projective point we can give any representative member of the line. Thus these each represent the same projective point.
Each is a homogeneous coordinate vector for the point . Two homogeneous coordinate vectors (which are by definition nonzero)
represent the same projective point if there is a scaling factor so that .
Of the infinitely many possible representatives, often we use the one whose third component is . This amounts to projecting onto the plane .
In this topic we will show how to use these ideas to perform some effects from computer graphics. For that we will take the prior picture and redraw it without the sphere, with a movie projector at the origin, and with plane looking like a movie theater screen.
This associates vectors in three-space on the grey line with in the screen plane.
We can adapt the things we have already seen about matrices to perform the transformations. Rotation is an example. This matrix rotates in the plane about the origin by the angle .
Notice that it works on any homogeneous coordinate vector; if we apply the matrix
and then move to the plane
then we get the same result as if we had first moved to the plane and then applied the matrix.
So there is no harm in working with homogeneous coordinates. But what is the advantage?
The computer graphic operation of translation, of sliding things from one place to another, is not a linear transformation because it does not leave the origin fixed. But if we work with homogeneous coordinates then we can use matrices. This matrix will translate points in the plane of interest by in the direction and in the direction.
That is, in the plane of interest this matrix slides to . So the homogeneous coordinates allow us to use matrices.
OK then, but what is the advantages of using these matrices? What does the extra coordinate get us? Suppose that we are making a movie with computer graphics. We are at a moment where the camera is panning and rotating at the same time. Every single point in the scene needs to be both translated and rotated. Rather than have the computer perform two operations to each point, we can multiply the two matrices and then the computer only applies one operation to each point; it multiplies that point by the resulting matrix. That is a tremendous speedup and simplification.
We will list some examples of the effects that we can get. We have already talked about rotation. Here is the picture of rotation by a half radian.
And here is a translation with and .
Next is scaling. This matrix rescales things in the target plane by a factor of in the -direction, and by a factor of in the direction.
In this picture we rescale in the direction by a factor of and in the -direction by .
If we take then the entire shape is rescaled. For instance, if we string together frames with then in the movie it will seem that the object is getting closer to us.
We can reflect the object. This reflects about the line .
The dashed line here is .
This reflects about .
The dashed line below is .
More complex transformations are possible. This is a shear.
In this picture the components of points are unchanged, but the components have added to them the value of .
A major advantage of having this all be matrices is that we can do complex things by combining simple things. To reflect about the line we can find the three matrices to slide everything to the origin, then reflect about , and then slide back.
(As always, the action done first is described by the matrix on the right. That is, the matrix on the right describes sliding all points in the plane of interest by , the matrix in the middle reflects about , and the matrix on the left slides all points back.)
There are even more complex effects possible with matrices. These are the matrices for the general affine transformation, and the general projective transformation.
However, description of their geometric effect is beyond our scope.
There is a vast literature on computer graphics, in which linear algebra plays an important part. An excellent source is [Hughes et al.]. The subject is a wonderful blend of mathematics and art; see [Disney].
Exercises
Exercise 2 Supplied answer
Find the matrix that reflects about the line .
Answer. Working in , let the matrix be . We get these two.
(For the second one, the starting vector is on the line through the origin that is perpendicular to .) We have this.
Solving gives
and so for homogeneous coordinates the matrix is this.
Exercise 3 Supplied answer
Find the matrix that reflects about the line .
Answer. Move all points over by , reflect about the line using the prior exercise, and them move them back.
Exercise 4 Supplied answer
Rotation and translation are rigid operations. What is the matrix for a rotation followed by a translation?
Exercise 5 Supplied answer
The homogeneous coordinates extend to manipulations of three dimensional space in the obvious way: every coordinate is a set of four-tall nonzero vectors that are related by being scalar multiples of each other. Give the matrix to do rotation about the axis, and the matrix for rotation about the axis.
References cited in this section
Hughes et al.
John F. Hughes, Andries van Dam, Morgan McGuire, David F. Sklar, James D. Foley, Steven K. Feiner, Kurt Akeley, Computer graphics: principles and practice, third edition, Addison-Wesley, 1995.
Disney
Walt Disney Animation Studios, Disney’s Practical Guide to Path Tracing, https://www.youtube.com/watch?v=frLwRLS_ZR0 (as of 2020-Apr-11).