Browse Source

Move apply_rotation_xyz into matrix_3x3

Scott Lahteine 4 years ago
parent
commit
be775ed72d

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

1592
         DEBUG_DELAY(20);
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
       if (DEBUGGING(LEVELING)) {
1597
       if (DEBUGGING(LEVELING)) {
1598
         DEBUG_ECHOPAIR_F("after rotation = [", mx, 7);
1598
         DEBUG_ECHOPAIR_F("after rotation = [", mx, 7);

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

794
               const int ind = abl.indexIntoAB[xx][yy];
794
               const int ind = abl.indexIntoAB[xx][yy];
795
               xyz_float_t tmp = { abl.eqnAMatrix[ind + 0 * abl.abl_points],
795
               xyz_float_t tmp = { abl.eqnAMatrix[ind + 0 * abl.abl_points],
796
                                   abl.eqnAMatrix[ind + 1 * abl.abl_points], 0 };
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
               if (get_min) NOMORE(min_diff, abl.eqnBVector[ind] - tmp.z);
798
               if (get_min) NOMORE(min_diff, abl.eqnBVector[ind] - tmp.z);
799
               const float subval = get_min ? abl.mean : tmp.z + min_diff,
799
               const float subval = get_min ? abl.mean : tmp.z + min_diff,
800
                             diff = abl.eqnBVector[ind] - subval;
800
                             diff = abl.eqnBVector[ind] - subval;

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

87
  *  matrix_3x3
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
   _x = vec.x; _y = vec.y; _z = vec.z;
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
 class matrix_3x3;
45
 class matrix_3x3;
46
 
46
 
47
 struct vector_3 : xyz_float_t {
47
 struct vector_3 : xyz_float_t {
48
-
49
   vector_3(const float &_x, const float &_y, const float &_z) { set(_x, _y, _z); }
48
   vector_3(const float &_x, const float &_y, const float &_z) { set(_x, _y, _z); }
50
   vector_3(const xy_float_t   &in) { set(in.x, in.y); }
49
   vector_3(const xy_float_t   &in) { set(in.x, in.y); }
51
   vector_3(const xyz_float_t  &in) { set(in.x, in.y, in.z); }
50
   vector_3(const xyz_float_t  &in) { set(in.x, in.y, in.z); }
82
   void set_to_identity();
81
   void set_to_identity();
83
 
82
 
84
   void debug(PGM_P const title);
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
     #if ABL_PLANAR
1534
     #if ABL_PLANAR
1535
 
1535
 
1536
       xy_pos_t d = raw - level_fulcrum;
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
       raw = d + level_fulcrum;
1538
       raw = d + level_fulcrum;
1539
 
1539
 
1540
     #elif HAS_MESH
1540
     #elif HAS_MESH
1571
         matrix_3x3 inverse = matrix_3x3::transpose(bed_level_matrix);
1571
         matrix_3x3 inverse = matrix_3x3::transpose(bed_level_matrix);
1572
 
1572
 
1573
         xy_pos_t d = raw - level_fulcrum;
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
         raw = d + level_fulcrum;
1575
         raw = d + level_fulcrum;
1576
 
1576
 
1577
       #elif HAS_MESH
1577
       #elif HAS_MESH

Loading…
Cancel
Save