/** * This method is used to overload operator* (matrix-matrix multiplication) * @author Razmik Avetisyan * @param Object Matrix2d for multiplication * @return Result of multiplication */ Matrix2d Matrix2d::operator* (Matrix2d data) { GLdouble *tmp = data.get(); GLdouble temp[3][3]; for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) temp[i][j] = (tmp[j] * m[2][i])+ (tmp[1*3 + j] * m[1][i]) + (tmp[2*3 + j] * m[0][i]); Matrix2d obj(temp); return obj; }
/** * This method is used to transpose the matrix * @author Razmik Avetisyan * @return Result of transpose operation */ Matrix2d Matrix2d::transpose() { Matrix2d data = m; GLdouble *tmp = data.get(); int swap; for(int i = 0; i < 3; i++) for(int j = i+1; j < 3;j++){ swap = tmp[i*3+j]; tmp[i*3+j] = tmp[j*3+i]; tmp[j*3+i] = swap; } return data; }