From 73a25602527844fdf1a53f353534ab57b04925bd Mon Sep 17 00:00:00 2001 From: Michael Kirsch Date: Wed, 17 Jul 2019 19:05:28 +0200 Subject: [PATCH] Trafo class description --- xs/src/libslic3r/TransformationMatrix.hpp | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/xs/src/libslic3r/TransformationMatrix.hpp b/xs/src/libslic3r/TransformationMatrix.hpp index 6cf4b9ff2..28401041f 100644 --- a/xs/src/libslic3r/TransformationMatrix.hpp +++ b/xs/src/libslic3r/TransformationMatrix.hpp @@ -6,6 +6,33 @@ namespace Slic3r { +/* + + The TransformationMatrix class was created to keep track of the transformations applied + to the objects from the GUI. Reloading these objects will now preserve their orientation. + + As usual in engineering vectors are treated as column vectors. + + Note that if they are treated as row vectors, the order is inversed: + (') denotes the transponse and column vectors + Column: out' = M1 * M2 * in' + Row: out = in * M2' * M1' + + Every vector gets a 4th component w added, + with positions lying in hyperplane w=1 + and direction vectors lying in hyperplane w=0 + + Using this, affine transformations (scaling, rotating, shearing, translating and their combinations) + can be represented as 4x4 Matri. + The 4th row equals [0 0 0 1] in order to not alter the w component. + The other entries are represented by the class properties mij (i-th row [1,2,3], j-th column [1,2,3,4]). + The 4th row is not explicitly stored, it is hard coded in the multiply function. + + Column vectors have to be multiplied from the right side. + + */ + + class TransformationMatrix { public: