Browse Source

Move apply_rotation_xyz into matrix_3x3

Scott Lahteine 3 years ago
parent
commit
be775ed72d

+ 1
- 1
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp View File

@@ -1592,7 +1592,7 @@ void unified_bed_leveling::smart_fill_mesh() {
1592 1592
         DEBUG_DELAY(20);
1593 1593
       }
1594 1594
 
1595
-      apply_rotation_xyz(rotation, mx, my, mz);
1595
+      rotation.apply_rotation_xyz(mx, my, mz);
1596 1596
 
1597 1597
       if (DEBUGGING(LEVELING)) {
1598 1598
         DEBUG_ECHOPAIR_F("after rotation = [", mx, 7);

+ 1
- 1
Marlin/src/gcode/bedlevel/abl/G29.cpp View File

@@ -794,7 +794,7 @@ G29_TYPE GcodeSuite::G29() {
794 794
               const int ind = abl.indexIntoAB[xx][yy];
795 795
               xyz_float_t tmp = { abl.eqnAMatrix[ind + 0 * abl.abl_points],
796 796
                                   abl.eqnAMatrix[ind + 1 * abl.abl_points], 0 };
797
-              apply_rotation_xyz(planner.bed_level_matrix, tmp);
797
+              planner.bed_level_matrix.apply_rotation_xyz(tmp);
798 798
               if (get_min) NOMORE(min_diff, abl.eqnBVector[ind] - tmp.z);
799 799
               const float subval = get_min ? abl.mean : tmp.z + min_diff,
800 800
                             diff = abl.eqnBVector[ind] - subval;

+ 2
- 2
Marlin/src/libs/vector_3.cpp View File

@@ -87,8 +87,8 @@ void vector_3::debug(PGM_P const title) {
87 87
  *  matrix_3x3
88 88
  */
89 89
 
90
-void apply_rotation_xyz(const matrix_3x3 &matrix, float &_x, float &_y, float &_z) {
91
-  vector_3 vec = vector_3(_x, _y, _z); vec.apply_rotation(matrix);
90
+void matrix_3x3::apply_rotation_xyz(float &_x, float &_y, float &_z) {
91
+  vector_3 vec = vector_3(_x, _y, _z); vec.apply_rotation(*this);
92 92
   _x = vec.x; _y = vec.y; _z = vec.z;
93 93
 }
94 94
 

+ 4
- 6
Marlin/src/libs/vector_3.h View File

@@ -45,7 +45,6 @@
45 45
 class matrix_3x3;
46 46
 
47 47
 struct vector_3 : xyz_float_t {
48
-
49 48
   vector_3(const float &_x, const float &_y, const float &_z) { set(_x, _y, _z); }
50 49
   vector_3(const xy_float_t   &in) { set(in.x, in.y); }
51 50
   vector_3(const xyz_float_t  &in) { set(in.x, in.y, in.z); }
@@ -82,9 +81,8 @@ struct matrix_3x3 {
82 81
   void set_to_identity();
83 82
 
84 83
   void debug(PGM_P const title);
85
-};
86 84
 
87
-void apply_rotation_xyz(const matrix_3x3 &rotationMatrix, float &x, float &y, float &z);
88
-FORCE_INLINE void apply_rotation_xyz(const matrix_3x3 &rotationMatrix, xyz_pos_t &pos) {
89
-  apply_rotation_xyz(rotationMatrix, pos.x, pos.y, pos.z);
90
-}
85
+  void apply_rotation_xyz(float &x, float &y, float &z);
86
+
87
+  FORCE_INLINE void apply_rotation_xyz(xyz_pos_t &pos) { apply_rotation_xyz(pos.x, pos.y, pos.z); }
88
+};

+ 2
- 2
Marlin/src/module/planner.cpp View File

@@ -1534,7 +1534,7 @@ void Planner::check_axes_activity() {
1534 1534
     #if ABL_PLANAR
1535 1535
 
1536 1536
       xy_pos_t d = raw - level_fulcrum;
1537
-      apply_rotation_xyz(bed_level_matrix, d.x, d.y, raw.z);
1537
+      bed_level_matrix.apply_rotation_xyz(d.x, d.y, raw.z);
1538 1538
       raw = d + level_fulcrum;
1539 1539
 
1540 1540
     #elif HAS_MESH
@@ -1571,7 +1571,7 @@ void Planner::check_axes_activity() {
1571 1571
         matrix_3x3 inverse = matrix_3x3::transpose(bed_level_matrix);
1572 1572
 
1573 1573
         xy_pos_t d = raw - level_fulcrum;
1574
-        apply_rotation_xyz(inverse, d.x, d.y, raw.z);
1574
+        inverse.apply_rotation_xyz(d.x, d.y, raw.z);
1575 1575
         raw = d + level_fulcrum;
1576 1576
 
1577 1577
       #elif HAS_MESH

Loading…
Cancel
Save