Skip to content

Commit

Permalink
Simplified the bulding of the transformation matrix for autoleveling.…
Browse files Browse the repository at this point in the history
… Maybe there was a mistake with autolevelTransformation[1]
  • Loading branch information
Jantek committed Mar 5, 2015
1 parent cb53d0c commit 8824cff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/ArduinoAVR/Repetier/Printer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1392,10 +1392,11 @@ void Printer::buildTransformationMatrix(float h1,float h2,float h3)
autolevelTransformation[5] = -autolevelTransformation[7];
// cross(y,z)
autolevelTransformation[0] = autolevelTransformation[4]*autolevelTransformation[8]-autolevelTransformation[5]*autolevelTransformation[7];
autolevelTransformation[1] = autolevelTransformation[5]*autolevelTransformation[6]-autolevelTransformation[3]*autolevelTransformation[8];
autolevelTransformation[2] = autolevelTransformation[3]*autolevelTransformation[7]-autolevelTransformation[4]*autolevelTransformation[6];
len = sqrt(autolevelTransformation[0]*autolevelTransformation[0]+autolevelTransformation[2]*autolevelTransformation[2]);
autolevelTransformation[1] = autolevelTransformation[5]*autolevelTransformation[6]/*-autolevelTransformation[3]*autolevelTransformation[8]*/; //autolevelTransformation[3] == 0 !
autolevelTransformation[2] = /*autolevelTransformation[3]*autolevelTransformation[7]*/-autolevelTransformation[4]*autolevelTransformation[6];
len = sqrt(autolevelTransformation[0]*autolevelTransformation[0]+autolevelTransformation[1]*autolevelTransformation[1]+autolevelTransformation[2]*autolevelTransformation[2]); //Shouldn't autolevelTransformation[1] also get normed?!?
autolevelTransformation[0] /= len;
autolevelTransformation[1] /= len;
autolevelTransformation[2] /= len;
len = sqrt(autolevelTransformation[4]*autolevelTransformation[4]+autolevelTransformation[5]*autolevelTransformation[5]);
autolevelTransformation[4] /= len;
Expand Down
7 changes: 4 additions & 3 deletions src/ArduinoDUE/Repetier/Printer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1392,10 +1392,11 @@ void Printer::buildTransformationMatrix(float h1,float h2,float h3)
autolevelTransformation[5] = -autolevelTransformation[7];
// cross(y,z)
autolevelTransformation[0] = autolevelTransformation[4]*autolevelTransformation[8]-autolevelTransformation[5]*autolevelTransformation[7];
autolevelTransformation[1] = autolevelTransformation[5]*autolevelTransformation[6]-autolevelTransformation[3]*autolevelTransformation[8];
autolevelTransformation[2] = autolevelTransformation[3]*autolevelTransformation[7]-autolevelTransformation[4]*autolevelTransformation[6];
len = sqrt(autolevelTransformation[0]*autolevelTransformation[0]+autolevelTransformation[2]*autolevelTransformation[2]);
autolevelTransformation[1] = autolevelTransformation[5]*autolevelTransformation[6]/*-autolevelTransformation[3]*autolevelTransformation[8]*/; //autolevelTransformation[3] == 0 !
autolevelTransformation[2] = /*autolevelTransformation[3]*autolevelTransformation[7]*/-autolevelTransformation[4]*autolevelTransformation[6];
len = sqrt(autolevelTransformation[0]*autolevelTransformation[0]+autolevelTransformation[1]*autolevelTransformation[1]+autolevelTransformation[2]*autolevelTransformation[2]); //Shouldn't autolevelTransformation[1] also get normed?!?
autolevelTransformation[0] /= len;
autolevelTransformation[1] /= len;
autolevelTransformation[2] /= len;
len = sqrt(autolevelTransformation[4]*autolevelTransformation[4]+autolevelTransformation[5]*autolevelTransformation[5]);
autolevelTransformation[4] /= len;
Expand Down

0 comments on commit 8824cff

Please sign in to comment.