diff --git a/src/libslic3r/Geometry.cpp b/src/libslic3r/Geometry.cpp index 630adcfb324..46f7b10368a 100644 --- a/src/libslic3r/Geometry.cpp +++ b/src/libslic3r/Geometry.cpp @@ -418,7 +418,7 @@ Vec3d extract_euler_angles(const Transform3d& transform) void rotation_from_two_vectors(Vec3d from, Vec3d to, Vec3d& rotation_axis, double& phi, Matrix3d* rotation_matrix) { - const Matrix3d m = Transform3d(Eigen::Quaterniond().setFromTwoVectors(from, to)).matrix().block<3, 3>(0, 0); + const Matrix3d m = Eigen::Quaterniond().setFromTwoVectors(from, to).toRotationMatrix(); const Eigen::AngleAxisd aa(m); rotation_axis = aa.axis(); phi = aa.angle(); diff --git a/src/libslic3r/Model.hpp b/src/libslic3r/Model.hpp index 6af013602a9..ecab5a1296f 100644 --- a/src/libslic3r/Model.hpp +++ b/src/libslic3r/Model.hpp @@ -1298,10 +1298,9 @@ class ModelInstance final : public ObjectBase // BBS void rotate(Matrix3d rotation_matrix) { - auto R = m_transformation.get_rotation_matrix().matrix().block<3, 3>(0, 0); - auto R_new = rotation_matrix * R; - auto euler_angles = Geometry::extract_euler_angles(R_new); - set_rotation(euler_angles); + auto rotation = m_transformation.get_rotation_matrix(); + rotation = rotation_matrix * rotation; + set_rotation(Geometry::Transformation(rotation).get_rotation()); } Vec3d get_scaling_factor() const { return m_transformation.get_scaling_factor(); }