|
For this assignment you will complete an implementation for some basic linear algebra classes that we will use throughout the quarter. The project is divided into two parts: In Part 1 you will fill in code to complete the Matrix, Vector3, and Point3 classes. These code 'stubs' are indicated for you in the base code, available below. In Part 2 you will use these classes to generate the local matrices for each of three cubes in a solar system scene.
Base Code: proj1.zip
The base code contains the following files: matrix.h, matrix.cpp, vector.h, vector.cpp, main.cpp
For this assignment you will modify the following files: matrix.cpp, vector.cpp, main.cpp.
Due: 2006-January-17 11:59pm
Begin by familiarizing yourself with the Vector3 and Point3 classes. Notice how the 'w' component of each is implied, and consequently not stored by either class. This detail will be important when performing matrix multiplications. Further information on the common operations supported by the two classes can be found at the top of the vector.h and vector.cpp files.
Next, fill in the following functions to complete the Vector3 class:
Next, explore the Matrix class. Again, details on the common features of the class can be found at the top of the matrix.h and matrix.cpp files. Note, especially, that we are using column vectors in this implementation. Pay careful attention to this when implementing the dot product and Vector3/Point3 transformation functions.
Fill in the following functions to complete the Matrix class:
Most of the code for these functions can be found in the course notes or in the book.
Once you have the matrix framework in place, compile and run the program. You should see a spinning cube with green and blue sides, similar to the screenshot below. + and - keys control the speed of rotation. If your cube is not spinning around its local Y axis, double check your MakeRotate functions as well as your Matrix to Matrix dot product functions.

The cube is drawn using a function called DrawCube, which draws a cube with side length 2, originally centered at the origin (0,0,0). This functions takes a single argument, a Matrix by which to transform the cube before it is drawn. Your job is to create three matrices that define the position and orientation of the sun, earth, and moon cubes.
A few key details regarding the implementation are listed below:
We've provided you with an executable with our solution to this assignment. Yours does not necessarily have to match, so be creative!
proj1.exe (Windows)
Here are a few suggested extra features you can add to your project if you're interested in exploring further.
Functions for the Matrix class:
For your solar system: