Lab 2, Spring 2021

The purpose of this lab is to develop a few subroutines (in C or C++) which will be used in future lab assignments.  The subroutines should be written so they are easily used in future programs.  They should be well commented.  The following subroutines should be written:

  1. A subroutine which will multiply two homogeneous matrices to form a composite homogeneous matrix; i.e., matrix A and matrix B are input and matrix C is computed as A times B.
  2. A subroutine which will transform a point using a given homogeneous matrix; i.e., matrix R and point pUVW (not augmented with a 1) are input and pXYZ  is computed as R times pUVW.
  3. A subroutine to compute the inverse of a homogeneous transformation matrix;  i.e., matrix R is input and matrix R-1 is computed.
Note with each of these subroutines you may assume that homogeneous 4x4 matrices are involved and can therefore use the appropriate simplifications.

You are also required to write a main program which inputs matrix values from the keyboard and calls each of the subroutines to test them.  The following is suggested, but variations are allowed (e.g., menu driven operation): 1) Input matrix A. 2) Input matrix B.  3) Input point pUVW. 4) Print A times B. 5) Print A-1. 6) Print A times  pUVW.  Note that printing A times A-1 is also a good test.

Some example C and C++ code is given here.