From d6693ea9565e1ba093ec5a48088811b84591e7da Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Wed, 8 Feb 2023 14:08:51 +0100 Subject: [PATCH] Methods Transformation::get_scaling_factor() and Transformation::get_scaling_factor_matrix() modified to use TransformationSVD --- src/libslic3r/Geometry.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/libslic3r/Geometry.cpp b/src/libslic3r/Geometry.cpp index ac4af4828..2c50af6e0 100644 --- a/src/libslic3r/Geometry.cpp +++ b/src/libslic3r/Geometry.cpp @@ -539,17 +539,14 @@ void Transformation::set_rotation(Axis axis, double rotation) #if ENABLE_WORLD_COORDINATE Vec3d Transformation::get_scaling_factor() const { - const Transform3d scale = extract_scale(m_matrix); - return { std::abs(scale(0, 0)), std::abs(scale(1, 1)), std::abs(scale(2, 2)) }; + const TransformationSVD svd(*this); + return { svd.s(0, 0), svd.s(1, 1), svd.s(2, 2) }; } Transform3d Transformation::get_scaling_factor_matrix() const { - Transform3d scale = extract_scale(m_matrix); - scale(0, 0) = std::abs(scale(0, 0)); - scale(1, 1) = std::abs(scale(1, 1)); - scale(2, 2) = std::abs(scale(2, 2)); - return scale; + const TransformationSVD svd(*this); + return Transform3d(svd.s); } #endif // ENABLE_WORLD_COORDINATE