# HG changeset patch # User Teemu Piippo # Date 1485616984 -7200 # Node ID 292c64cb2a759f18a0a8a228fb1656a0fe789fe1 # Parent 220cde0fa2d9a40f5a20800aba860e67a46fdc5a Moved the identity matrix constant into Matrix's namespace diff -r 220cde0fa2d9 -r 292c64cb2a75 src/addObjectDialog.cpp --- a/src/addObjectDialog.cpp Sat Jan 28 17:20:16 2017 +0200 +++ b/src/addObjectDialog.cpp Sat Jan 28 17:23:04 2017 +0200 @@ -193,7 +193,7 @@ QLabel* lb_matrix = new QLabel ("Matrix:"); le_matrix = new QLineEdit; // le_matrix->setValidator (new QDoubleValidator); - Matrix defaultMatrix = IdentityMatrix; + Matrix defaultMatrix = Matrix::identity; if (mo) { @@ -299,7 +299,7 @@ return; // Nothing to edit with empties const bool newObject = (obj == nullptr); - Matrix transform = IdentityMatrix; + Matrix transform = Matrix::identity; AddObjectDialog dlg (type, obj); if (obj and obj->type() != type) diff -r 220cde0fa2d9 -r 292c64cb2a75 src/basics.h --- a/src/basics.h Sat Jan 28 17:20:16 2017 +0200 +++ b/src/basics.h Sat Jan 28 17:23:04 2017 +0200 @@ -125,7 +125,6 @@ }; extern const Vertex Origin; -extern const Matrix IdentityMatrix; static const double pi = 3.14159265358979323846; diff -r 220cde0fa2d9 -r 292c64cb2a75 src/glRenderer.cpp --- a/src/glRenderer.cpp Sat Jan 28 17:20:16 2017 +0200 +++ b/src/glRenderer.cpp Sat Jan 28 17:23:04 2017 +0200 @@ -1567,7 +1567,7 @@ ref->setColor (MainColor); ref->setFileInfo (m_documents->getDocumentByName (primitiveName)); ref->setPosition (Origin); - ref->setTransformationMatrix (IdentityMatrix); + ref->setTransformationMatrix (Matrix::identity); currentDocument()->insertObject (m_window->suggestInsertPoint(), ref); ref->select(); m_window->buildObjectList(); diff -r 220cde0fa2d9 -r 292c64cb2a75 src/ldObject.cpp --- a/src/ldObject.cpp Sat Jan 28 17:20:16 2017 +0200 +++ b/src/ldObject.cpp Sat Jan 28 17:23:04 2017 +0200 @@ -699,7 +699,7 @@ { // Subfile has all vertices zero on one specific plane, so it is flat. // Let's flip it. - Matrix matrixModifier = IdentityMatrix; + Matrix matrixModifier = Matrix::identity; if (axisSet & (1 << X)) matrixModifier(0, 0) = -1; diff -r 220cde0fa2d9 -r 292c64cb2a75 src/main.cpp --- a/src/main.cpp Sat Jan 28 17:20:16 2017 +0200 +++ b/src/main.cpp Sat Jan 28 17:23:04 2017 +0200 @@ -26,7 +26,6 @@ MainWindow* g_win = nullptr; const Vertex Origin (0.0f, 0.0f, 0.0f); -const Matrix IdentityMatrix ({1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}); ConfigOption (bool FirstStart = true) diff -r 220cde0fa2d9 -r 292c64cb2a75 src/toolsets/algorithmtoolset.cpp --- a/src/toolsets/algorithmtoolset.cpp Sat Jan 28 17:20:16 2017 +0200 +++ b/src/toolsets/algorithmtoolset.cpp Sat Jan 28 17:23:04 2017 +0200 @@ -576,7 +576,7 @@ ref->setColor (MainColor); ref->setFileInfo (doc); ref->setPosition (Origin); - ref->setTransformationMatrix (IdentityMatrix); + ref->setTransformationMatrix (Matrix::identity); currentDocument()->insertObject (refidx, ref); // Refresh stuff diff -r 220cde0fa2d9 -r 292c64cb2a75 src/types/matrix.cpp --- a/src/types/matrix.cpp Sat Jan 28 17:20:16 2017 +0200 +++ b/src/types/matrix.cpp Sat Jan 28 17:23:04 2017 +0200 @@ -20,6 +20,8 @@ #include "../format.h" #include "matrix.h" +const Matrix Matrix::identity {1, 0, 0, 0, 1, 0, 0, 0, 1}; + /* * Default-constructor for a matrix */ diff -r 220cde0fa2d9 -r 292c64cb2a75 src/types/matrix.h --- a/src/types/matrix.h Sat Jan 28 17:20:16 2017 +0200 +++ b/src/types/matrix.h Sat Jan 28 17:23:04 2017 +0200 @@ -52,6 +52,8 @@ double& operator()(int row, int column); const double& operator()(int row, int column) const; + static const Matrix identity; + private: double m_values[9]; };