QMatrix2x2 QMatrix2x2::Invert() const { // We need inverse of determinant in calculus. const float_q INV_DET = SQFloat::_1 / this->GetDeterminant(); return QMatrix2x2( INV_DET * this->ij[1][1], -INV_DET * this->ij[0][1], -INV_DET * this->ij[1][0], INV_DET * this->ij[0][0] ); }
void VideoViewer::resizeGL(int width, int height) { double projectionMatrixValues[4]; double scaleMatrixValues[4]; if(height * _frame->width < width * _frame->height) { projectionMatrixValues[0] = (double) height / (double)width; projectionMatrixValues[1] = 0.0; projectionMatrixValues[2] = 0.0; projectionMatrixValues[3] = 1.0; scaleMatrixValues[0] = (double) _frame->width / (double)_frame->height; scaleMatrixValues[1] = 0.0; scaleMatrixValues[2] = 0.0; scaleMatrixValues[3] = 1.0; } else { projectionMatrixValues[0] = 1.0; projectionMatrixValues[1] = 0.0; projectionMatrixValues[2] = 0.0; projectionMatrixValues[3] = (double) width / (double)height; scaleMatrixValues[0] = 1.0; scaleMatrixValues[1] = 0.0; scaleMatrixValues[2] = 0.0; scaleMatrixValues[3] = (double)_frame->height / (double)_frame->width; } _matrix = QMatrix2x2(projectionMatrixValues) * QMatrix2x2(scaleMatrixValues); glViewport(0, 0, width, height); }
QMatrix2x2 QMatrix2x2::Transpose() const { return QMatrix2x2(this->ij[0][0], this->ij[1][0], this->ij[0][1], this->ij[1][1]); }