header

Lab 13

In this assignment you will implement a matrixType class that will be very useful in viewing a 3-D model. I've done some of the work for you in Lab13.cpp.

Data

The only data in the matrixType class is a 4 x 4 two-dimensional array of double values. This array represents a 4 x 4 transformation matrix.

The multiply Function

This private function has one parameter that represents a 4 x 4 matrix. It replaces the current matrix with the product of the parameter and the matrix: matrix = parameter * matrix.

Constructor

The default matrix is the identity matrix (see the example output in the display function section below).

The reset Function

The reset function sets the matrix equal to the identity matrix. It resets the matrix back to its default state.

The display Function

The display function displays the matrix. This is the output generated by the display function for the identity matrix:

    1.0000    0.0000    0.0000    0.0000
    0.0000    1.0000    0.0000    0.0000
    0.0000    0.0000    1.0000    0.0000
    0.0000    0.0000    0.0000    1.0000
    

The scale Function

This function sets up a scaling transformation matrix and then replaces the class matrix with the product of the scaling transformation matrix and the class matrix (using the private multiply function):

 matrix = scaling transformation matrix * matrix

The translate Function

This function sets up a translation transformation matrix and then replaces the class matrix with the product of the translation transformation matrix and the class matrix (using the private multiply function):

matrix = translation transformation matrix * matrix

The rotate Function

This function sets up a rotation transformation matrix and then replaces the class matrix with the product of the rotation transformation matrix and the class matrix (using the private multiply function):

matrix = rotation transformation matrix * matrix

The applyTo Function

The applyTo function returns the point whose coordinates are determined by multiplying the matrix by the point that is passed in as a parameter:

returned point = transformation matrix * point parameter

File Submission

 Submit your completed Lab13.cpp application as an email attachment.