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)
This commit is contained in:
Noisyfox 2024-06-26 18:08:15 +08:00 committed by GitHub
parent 7e85eb0d7d
commit eeae1b2c7e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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};