Homework 4

For this assignment, we implemented matrix transforms for our primitives.

Tasks


Matrix Manipulation Routines


A polyline scaled and rotated
For the first task, we implemented translate2D, scale2D, scaleArbitrary2D, rotate2D, rotateArbitrary2D, matrix3x3Multiply, matrix3x3Identity, vector3Transform, matrix3x3Print, matrix3x3Copy, and matrix3x3Clear. These allowed us to move points around the screen with translations, rotations, and scales.

The First Enterprise

For the second part of the assignment, we used our matrix manipulations to construct the Starship Enterprise from a unit circle and a unit square.

The Second Enterprise

For the third part, we animated our Starship. We drew it next to a planet, then rotated all the pieces about the center of the planet.

The Third Enterprise

For the fourth and final part, we created a 2D viewing pipeline. This allows for "zooming in" on parts of the scene and moving the view box around.
Spacequake!

Extensions

For an extension, we make the Enterprise go to warp speed. We wrote a loop to stretch and translate the pieces, then collapse and translate them.

  1. Who did you work with on this assignment, and what tasks did each of you do?
    I worked with Stephanie Wojtkowski, and we worked on everything together.
  2. Describe the mechanism you developed for handling the global transformation parameters and matrix.
    I do not know of your "global transformation parameters." We made matrices for every element, passing them to transformation functions which modified the matrix's contents.
  3. Describe the mechanism you developed for handling the viewing pipeline parameters and transformation matrix.
    We treated the viewing pipeline exactly the same as any other transformation matrix, and applied it to each element as the last step. We figure that later we're going to rewrite our entire interface for the heirarchical structure anyway, so it didn't make sense to implement a parital heirarchical structure that we were going to throw away later anyway.
  4. Once you had the code in place, what was the process and how difficult was it to modify the view window and the position of the Enterprise?
    Once we had the Enterprise made and placed somewhere on the screen, it was very easy to move it around. We just had to apply the same translation or rotation to each element, and the ship happily appeared in a new place. The viewing pipeline was even easier because we only had to change the lower left or upper right corner of the view window, and all our changes propogated. We wrote in the VTM multiplication as our last modification to each element before drawing it, so it was easy to change the VTM within a loop and have it affect every element.