1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00

Code cleanup

This commit is contained in:
Martin Tůma 2021-10-03 00:16:59 +02:00
parent e1d4c2b532
commit 3338bfa73f
3 changed files with 1 additions and 28 deletions

View File

@ -5,9 +5,6 @@
Matrix::~Matrix() Matrix::~Matrix()
{ {
if (isNull())
return;
delete[] _m; delete[] _m;
} }
@ -35,28 +32,6 @@ Matrix::Matrix(const Matrix& M)
m(i,j) = M.m(i,j); m(i,j) = M.m(i,j);
} }
Matrix &Matrix::operator=(const Matrix &M)
{
if (this != &M) {
if (_h != M._h || _w != M._w) {
if (!isNull())
delete[] _m;
_h = M._h; _w = M._w;
if (isNull())
_m = 0;
else
_m = new double[_h * _w];
}
for (size_t i = 0; i < _h; i++)
for (size_t j = 0; j < _w; j++)
m(i,j) = M.m(i,j);
}
return *this;
}
bool Matrix::eliminate(double epsilon) bool Matrix::eliminate(double epsilon)
{ {
size_t i, j, k, maxrow; size_t i, j, k, maxrow;

View File

@ -13,8 +13,6 @@ public:
Matrix(const Matrix& M); Matrix(const Matrix& M);
~Matrix(); ~Matrix();
Matrix &operator=(const Matrix &M);
size_t h() const {return _h;} size_t h() const {return _h;}
size_t w() const {return _w;} size_t w() const {return _w;}
double &m(size_t i, size_t j) {return _m[_w * i + j];} double &m(size_t i, size_t j) {return _m[_w * i + j];}

View File

@ -53,7 +53,7 @@ void Transform::affine(const QList<ReferencePoint> &points)
Q.m(i,j) += v[i] * v[j]; Q.m(i,j) += v[i] * v[j];
} }
Matrix M = Q.augemented(c); Matrix M(Q.augemented(c));
if (!M.eliminate()) { if (!M.eliminate()) {
_errorString = "Singular transformation matrix"; _errorString = "Singular transformation matrix";
return; return;