From c28a00ae0413afcf9b42833f1759d870b9462006 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Fri, 4 Nov 2022 13:34:31 +0100 Subject: [PATCH] Holes are were not drilled in the right orientation. This change seemingly fixes the issue. --- src/libslic3r/SLA/Hollowing.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/libslic3r/SLA/Hollowing.cpp b/src/libslic3r/SLA/Hollowing.cpp index 974e525638..a35ba511b1 100644 --- a/src/libslic3r/SLA/Hollowing.cpp +++ b/src/libslic3r/SLA/Hollowing.cpp @@ -118,9 +118,9 @@ indexed_triangle_set DrainHole::to_mesh() const { auto r = double(radius); auto h = double(height); - indexed_triangle_set hole = sla::cylinder(r, h, steps); + indexed_triangle_set hole = its_make_cylinder(r, h); //sla::cylinder(r, h, steps); Eigen::Quaternionf q; - q.setFromTwoVectors(Vec3f{0.f, 0.f, 1.f}, normal); + q.setFromTwoVectors(Vec3f::UnitZ(), normal); for(auto& p : hole.vertices) p = q * p + pos; return hole; @@ -692,24 +692,23 @@ DrainHoles transformed_drainhole_points(const ModelObject &mo, const Transform3d &trafo) { auto pts = mo.sla_drain_holes; - const Transform3d& vol_trafo = mo.volumes.front()->get_transformation().get_matrix(); - const Geometry::Transformation trans(trafo * vol_trafo); - const Transform3f& tr = trans.get_matrix().cast(); - const Vec3f sc = trans.get_scaling_factor().cast(); +// const Transform3d& vol_trafo = mo.volumes.front()->get_transformation().get_matrix(); + const Geometry::Transformation trans(trafo /** vol_trafo*/); + const Transform3d& tr = trans.get_matrix(); for (sla::DrainHole &hl : pts) { - hl.pos = tr * hl.pos; - hl.normal = tr * hl.normal - tr.translation(); + Vec3d pos = hl.pos.cast(); + Vec3d nrm = hl.normal.cast(); - // The normal scales as a covector (and we must also - // undo the damage already done). - hl.normal = Vec3f(hl.normal(0)/(sc(0)*sc(0)), - hl.normal(1)/(sc(1)*sc(1)), - hl.normal(2)/(sc(2)*sc(2))); + pos = tr * pos; + nrm = tr * nrm - tr.translation(); // Now shift the hole a bit above the object and make it deeper to // compensate for it. This is to avoid problems when the hole is placed // on (nearly) flat surface. - hl.pos -= hl.normal.normalized() * sla::HoleStickOutLength; + pos -= nrm.normalized() * sla::HoleStickOutLength; + + hl.pos = pos.cast(); + hl.normal = nrm.cast(); hl.height += sla::HoleStickOutLength; }