From b7db91c46d1db59646e6fc7037807f77f596ccdd Mon Sep 17 00:00:00 2001 From: Evgeny-SPB Date: Thu, 24 Oct 2019 20:02:28 +0300 Subject: [PATCH] Fix apply_rotation function (#15636) --- Marlin/src/libs/vector_3.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Marlin/src/libs/vector_3.cpp b/Marlin/src/libs/vector_3.cpp index 0363318e5..41ea3ec97 100644 --- a/Marlin/src/libs/vector_3.cpp +++ b/Marlin/src/libs/vector_3.cpp @@ -71,7 +71,9 @@ void vector_3::normalize() { // Apply a rotation to the matrix void vector_3::apply_rotation(const matrix_3x3 &matrix) { const float _x = x, _y = y, _z = z; - *this = matrix.vectors[0] * _x + matrix.vectors[1] * _y + matrix.vectors[2] * _z; + x = _x * matrix.vectors[0][0] + _y * matrix.vectors[1][0] + _z * matrix.vectors[2][0]; + y = _x * matrix.vectors[0][1] + _y * matrix.vectors[1][1] + _z * matrix.vectors[2][1]; + z = _x * matrix.vectors[0][2] + _y * matrix.vectors[1][2] + _z * matrix.vectors[2][2]; } void vector_3::debug(PGM_P const title) {