/* order. */ vec4 operator* (const vec4& v, const mat4& m) { vec4 product = vec4(); /* Multiply the rows of m by the vector to get the products components. */ for(int i = 0; i < 4; i++) { product[i] = m.getColumn(i) * v; } /* Return the new product vector*/ return product; }
/* Multiply the given two 3x3 matrices and return the new matrix. */ mat4 operator* (const mat4& m1, const mat4& m2) { mat4 product = mat4(); /* Multiply the rows of m1 times the columns of m2. */ for(int r = 0; r < 4; r++) { for(int c = 0; c < 4; c++) { product[r][c] = m1[r] * m2.getColumn(c); } } return product; }