mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 11:45:56 +08:00
Holes are were not drilled in the right orientation.
This change seemingly fixes the issue.
This commit is contained in:
parent
28ffdcc391
commit
c28a00ae04
@ -118,9 +118,9 @@ indexed_triangle_set DrainHole::to_mesh() const
|
|||||||
{
|
{
|
||||||
auto r = double(radius);
|
auto r = double(radius);
|
||||||
auto h = double(height);
|
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;
|
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;
|
for(auto& p : hole.vertices) p = q * p + pos;
|
||||||
|
|
||||||
return hole;
|
return hole;
|
||||||
@ -692,24 +692,23 @@ DrainHoles transformed_drainhole_points(const ModelObject &mo,
|
|||||||
const Transform3d &trafo)
|
const Transform3d &trafo)
|
||||||
{
|
{
|
||||||
auto pts = mo.sla_drain_holes;
|
auto pts = mo.sla_drain_holes;
|
||||||
const Transform3d& vol_trafo = mo.volumes.front()->get_transformation().get_matrix();
|
// const Transform3d& vol_trafo = mo.volumes.front()->get_transformation().get_matrix();
|
||||||
const Geometry::Transformation trans(trafo * vol_trafo);
|
const Geometry::Transformation trans(trafo /** vol_trafo*/);
|
||||||
const Transform3f& tr = trans.get_matrix().cast<float>();
|
const Transform3d& tr = trans.get_matrix();
|
||||||
const Vec3f sc = trans.get_scaling_factor().cast<float>();
|
|
||||||
for (sla::DrainHole &hl : pts) {
|
for (sla::DrainHole &hl : pts) {
|
||||||
hl.pos = tr * hl.pos;
|
Vec3d pos = hl.pos.cast<double>();
|
||||||
hl.normal = tr * hl.normal - tr.translation();
|
Vec3d nrm = hl.normal.cast<double>();
|
||||||
|
|
||||||
// The normal scales as a covector (and we must also
|
pos = tr * pos;
|
||||||
// undo the damage already done).
|
nrm = tr * nrm - tr.translation();
|
||||||
hl.normal = Vec3f(hl.normal(0)/(sc(0)*sc(0)),
|
|
||||||
hl.normal(1)/(sc(1)*sc(1)),
|
|
||||||
hl.normal(2)/(sc(2)*sc(2)));
|
|
||||||
|
|
||||||
// Now shift the hole a bit above the object and make it deeper to
|
// 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
|
// compensate for it. This is to avoid problems when the hole is placed
|
||||||
// on (nearly) flat surface.
|
// on (nearly) flat surface.
|
||||||
hl.pos -= hl.normal.normalized() * sla::HoleStickOutLength;
|
pos -= nrm.normalized() * sla::HoleStickOutLength;
|
||||||
|
|
||||||
|
hl.pos = pos.cast<float>();
|
||||||
|
hl.normal = nrm.cast<float>();
|
||||||
hl.height += sla::HoleStickOutLength;
|
hl.height += sla::HoleStickOutLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user