Home | | Syllabus | | Assignments | | Documentation

    Solution to Assignment 4


    Problem 1a: A 3D spinning box

    C code for solution to 3D spinning box problem


    Problem 1b: A user-interfaced controlled spinning box

    C code for solution to 3D box with user interface problem


    Problem 1c: Approximating a cylinder.

    C code for approximation to a cylinder.


    Problem 2: Gimbal Lock

    We can show that the two sets of rotation cause identical results by multiplying the matrices together and showing the result is the same.

    Multiplying the first set of matrices yields:

    Multiplying the second set of matrices yields:

    The results are the same. Therefore the two sets of rotations will cause identical overall rotation of the object.


    Problem 3: Yaw, Pitch and Roll

    When we compute the transformation of the viewer in an airplane according to Yaw, Pitch and Roll, we need to accomplish 4 steps.

    1. Move the camera from the origin to position d along the Z axis (where d is the distance from the plane's center of mass to the cockpit.
    2. Rotate about the Y axis (yaw) by theta1.
    3. Rotate about the X axis (pitch) by theta2.
    4. Rotate about the Z axis (roll) by theta3.

    Moving the viewer in these 4 transformations is equivalent to moving object frame in the opposite direction:

    1. Move the object frame from the origin to position -d along the Z axis (where d is the distance from the plane's center of mass to the cockpit.
    2. Rotate about the Y axis (yaw) by -theta1.
    3. Rotate about the X axis (pitch) by -theta2.
    4. Rotate about the Z axis (roll) by -theta3.
    The entire transformation can be written as the matrix, M, where

    M = Rz(-theta3)*Rx(-theta2)*Ry(-theta1)*T(0, 0, -d)

    Note that the order in which we perform the yaw, pitch and roll transformations matters. You will get different matrices for different ordering of the rotation transformations. In this problem you were given the order as yaw, pitch and then roll.

    Here is the matrix equation for the above transformations:

    Here is the result for the order of multiplication shown above:


    Home | | Syllabus | | Assignments | | Documentation


    Constance Royden--croyden@mathcs.holycross.edu
    Computer Science 384
    Date Created: August 17, 1999
    Last Modified: October 28, 2003
    Page Expires: August 17, 2004