/***************************************************************************** Compute a general 4x4 rotation matrix for 3-D rotation about a center point For CS480 Programming Assignment 3 ****************************************************************************** Author: ******************************************************************************/ #include /* Write a routine that constructs the 4x4 homogeneous transform for rotation about a center point. The rotations should be applied in order: x rotation first, y rotation second, and z rotation third. Note that a 4x4 matrix multiplication has been provided if you wish to use it for the assignment. */ compute_rotation(angles,center,M) float *angles; /* 3 angles of rotation: angles[0] is x rotation, angles[1] is y, etc. */ float *center; /* the center for the rotation */ float M[4][4]; /* the resulting rotation matrix */ { } /* 4x4 matrix multiplication routine */ matrix_multiply_4x4(R,A,B) float R[4][4]; /* result */ float A[4][4],B[4][4]; /* two matrices to be multiplied */ { int i,j,k; float a; for(i=0;i<4;++i) for(j=0;j<4;++j) { for(k=0,a=0.0;k<4;++k) a += A[i][k]*B[k][j]; R[i][j] = a; } }