Browse Source

Fix apply_rotation function (#15636)

Evgeny-SPB 4 years ago
parent
commit
b7db91c46d
1 changed files with 3 additions and 1 deletions
  1. 3
    1
      Marlin/src/libs/vector_3.cpp

+ 3
- 1
Marlin/src/libs/vector_3.cpp View File

@@ -71,7 +71,9 @@ void vector_3::normalize() {
71 71
 // Apply a rotation to the matrix
72 72
 void vector_3::apply_rotation(const matrix_3x3 &matrix) {
73 73
   const float _x = x, _y = y, _z = z;
74
-  *this = matrix.vectors[0] * _x + matrix.vectors[1] * _y + matrix.vectors[2] * _z;
74
+  x = _x * matrix.vectors[0][0] + _y * matrix.vectors[1][0] + _z * matrix.vectors[2][0];
75
+  y = _x * matrix.vectors[0][1] + _y * matrix.vectors[1][1] + _z * matrix.vectors[2][1];
76
+  z = _x * matrix.vectors[0][2] + _y * matrix.vectors[1][2] + _z * matrix.vectors[2][2];
75 77
 }
76 78
 
77 79
 void vector_3::debug(PGM_P const title) {

Loading…
Cancel
Save