






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Computer Science and Electrical Engineering Dept.
West Virginia University
19th September 2007
1 Review
(^2) Matrix operations
(^3) Matrix stacks
4 Matrix inverse
Matrix operations
Recall :
glMatrixMode() - GL_MODELVIEW, GL_PROJECTION
glLoadMatrixf(const GLfloat (^) *m) - Replace current matrix.
glMultMatrixf(const GLfloat (^) *m) - Postmultiply current
matrix.
Matrices ordered by column:
GLfloat m[16]
m [ 0 ] m [ 4 ] m [ 8 ] m [ 12 ]
m [ 1 ] m [ 5 ] m [ 9 ] m [ 13 ]
m [ 2 ] m [ 6 ] m [ 10 ] m [ 14 ]
m [ 3 ] m [ 7 ] m [ 11 ] m [ 15 ]
Matrix stacks
Stack data structure :
OpenGL maintains a stack for each of the matrix modes (modelview,
projection).
Push and Pop operations:
Push matrix onto stack (left), pop matrix off of stack (right)
This allows the application programmer to easily restore previous
matrices.
Matrix inverse
The identity matrix, I , performs no transformation :
Ip = p
Each of the transformations, A , we have discussed has an inverse, A
− 1 which
”undoes” the transformation of A :
− 1 p = p
Matrix inverse
The translation T ( x , y , z ) is undone by applying another translation in the
opposite direction T (− x , − y , − z ).
1 0 0 x
0 1 0 y
0 0 1 z
0 0 0 1
1 0 0 − x
0 1 0 − y
0 0 1 − z
0 0 0 1
So T (− x , − y , − z ) = T ( x , y , z )
− 1 .
Matrix inverse
The rotation transformation R (θ) is undone by applying another rotation
operation R (−θ). Using the fact that sin −θ = − sin θ and cos −θ = cos θ we
can compute the inverse matrix for rotation about the z-axis.
cos θ − sin θ 0 0
sin θ cos θ 0 0
0 0 1 0
0 0 0 1
cos θ sin θ 0 0
− sin θ cos θ 0 0
0 0 1 0
0 0 0 1
So R (−θ) = R (θ)
− 1 .
Also note that R (θ)
− 1 = R (θ)
T , the matrix inverse equals the matrix
transpose for rotation matrices.
(Rotation matrix is an orthogonal matrix.)