Fixed incorrect hole normal transformation when the object is anisotropically scaled
This commit is contained in:
parent
022cc0871a
commit
d58ee47e4d
1 changed files with 8 additions and 1 deletions
|
@ -1182,11 +1182,18 @@ sla::DrainHoles SLAPrintObject::transformed_drainhole_points() const
|
|||
assert(m_model_object != nullptr);
|
||||
auto pts = m_model_object->sla_drain_holes;
|
||||
auto tr = trafo().cast<float>();
|
||||
auto sc = m_model_object->instances.front()->get_scaling_factor().cast<float>();
|
||||
for (sla::DrainHole &hl : pts) {
|
||||
hl.pos = tr * hl.pos;
|
||||
hl.normal = tr * hl.normal - tr.translation();
|
||||
|
||||
// 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)));
|
||||
}
|
||||
|
||||
|
||||
return pts;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue