From eeae1b2c7ed8cc713aee5b57e11607444a9d63f0 Mon Sep 17 00:00:00 2001 From: Noisyfox Date: Wed, 26 Jun 2024 18:08:15 +0800 Subject: [PATCH] Fix few mirror related issues (#5827) * Do not use get_scaling_factor then construct the matrix again, because it cannot properly handle situations that contains negative scale (mirror) / shear (SoftFever/OrcaSlicer#5578) * Do not use get_scaling_factor then construct the matrix again, because it cannot properly handle situations that contains negative scale (mirror) / shear (SoftFever/OrcaSlicer#5578, SoftFever/OrcaSlicer#4719) --- src/libslic3r/Model.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp index c2fd0f6796..cf5de0f3e4 100644 --- a/src/libslic3r/Model.cpp +++ b/src/libslic3r/Model.cpp @@ -2480,11 +2480,7 @@ void ModelVolume::calculate_convex_hull_2d(const Geometry::Transformation &tran return; Points pts; - Vec3d rotation = transformation.get_rotation(); - Vec3d mirror = transformation.get_mirror(); - Vec3d scale = transformation.get_scaling_factor(); - //rotation(2) = 0.f; - Transform3d new_matrix = Geometry::assemble_transform(Vec3d::Zero(), rotation, scale, mirror); + Transform3d new_matrix = transformation.get_matrix_no_offset(); pts.reserve(its.vertices.size()); // Using the shared vertices should be a bit quicker than using the STL faces. @@ -3217,10 +3213,10 @@ void ModelInstance::get_arrange_polygon(void *ap, const Slic3r::DynamicPrintConf Vec3d rotation = get_rotation(); rotation.z() = 0.; - Transform3d trafo_instance = - Geometry::assemble_transform(get_offset().z() * Vec3d::UnitZ(), rotation, get_scaling_factor(), get_mirror()); - - Polygon p = get_object()->convex_hull_2d(trafo_instance); + Geometry::Transformation t(m_transformation); + t.set_offset(get_offset().z() * Vec3d::UnitZ()); + t.set_rotation(rotation); + Polygon p = get_object()->convex_hull_2d(t.get_matrix()); // if (!p.points.empty()) { // Polygons pp{p};