Cynthia Vaskis

SLM521 Spring 2004

Dropin #2 Assignment

4/2/04

File: matrotY1.htm

Cynthia Vaskis

 

Lesson Title:  Math Calculations to Rotate an Object in 3D Space – Rotation matrix about the Z axis

 

Use graph paper to draw the resulting Points from the Y axis rotations.  The new Point 1 = (1, -1, 1) from the Y axis rotations where Point 2 and Point 3 must also have been calculated.

 

The original Point vectors were:

Point 1 = (x1, y1, z1) = (1, 1, 1)

Point 2 = (x2, y2, z2) = (2, 2, 2)

Point 3 = (x3, y3, z3) = (1, 1, 2)

See diagram of the original triangle in 3D space.

 

For reference see how an object is rotated about its X, Y and Z axes, use the three rotation matrix equations in (5), (6), and (7) (click and move down to see the rotating boxes about each axis and matrix equations (5), (6), and (7)).  The first box rotates about the X axis, the second box rotates about the Y axis, and the third box rotates about the Z axis.  The rotation matrices, listed in matrix equations (5), (6), and (7), are listed again below.  We are using equation (7) here for Z axis rotations.

 

To rotate an object about one axis the set of equations is written in the form called a rotational matrix.  It is really a list of simultaneous equations with their coefficients taken out and placed in a box structure.

The matrix for rotating an object about the Z axis is found in equation (7) from the reference above.

 

To rotate an object about its Z axis the amount of angle gamma, notice that the one (1) in the third row and third column indicates that the rotation does not change the Z values in the object’s definition.  The positive rotation direction is clockwise as you look down the coordinate axis vector that you are going to rotate around toward the origin of the coordinate system.

 

          

 

To rotate an object about just one of its axes at a time is done by multiplying the associated rotational matrix with each of the object’s definition vectors to obtain new definition vectors that are in the rotated position.

The rotational matrices use the trigonometry functions of sine and cosine of the rotational angle.  To understand how we calculate values for the sine and cosine we must look at the unit circle with the sine and cosine values for several angles around the circle.  Of course, you could use any angle amount between -180 degrees and + 180 degrees but the value would have to be looked up in a trigonometry table.  For simplicity, the examples use angles that produce well know whole number (integer) sine and cosine values such as -1, 0 and +1.

 

 

To multiply a matrix times a vector you first write the matrix down and then write the vector in a vertical position to the right of the matrix.

 

For this example, the angle gamma = -90 degrees.  The cosine of -90 degrees = 0 and the sine -90 degrees = -1.

 

The matrix for a rotation about the Z axis of -90 degrees is below.  Look here for basic matrix multiplication operations.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


Exercises:

 

a)  First, look at the values in the Yaw matrix to see if they are correct based on the general Z axis rotational matrix mentioned above.  Then multiply the Z rotational matrix with the resulting Point 1, 2, and 3 vectors from the Pitch axis rotations.  The resulting vectors will be the final position of the triangle.  Use graph paper to draw where the final triangle’s Point vectors (corners) after all of the rotations are performed.

 

b)  Compare where the object’s Point vectors first started (original Points listed above) and where they ended up?

 

Hint – Rotational exercise answers

 

Summary

 

You just performed all three rotations on the triangle’s points by rotating them about each axis separately.  You can accomplish the same thing by multiplying the first matrix M(Roll) by the second matrix M(Pitch) and  then multiplying the resulting matrix by the third matrix M(Yaw) to get just one Full Rotational matrix that could rotate the object’s points to the final position in one matrix multiply per vector.  This is written as M(Yaw) * M(Pitch) * M(Roll) to produce M(Full Rotation) matrix that could be used to multiply the point vectors just once to get the final fully rotated point vectors.

 

If a matrix has all ones down the diagonal from the top left down to the bottom right corner and all zeros elsewhere it is called an Identity matrix.  When it is used to multiply a vector it does nothing to the vector.  It is the matrix equivalent of multiplying by the number one.