mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-07 07:09:06 +08:00
TriangleSelector: bugfix - backend did not correctly account for mirrorring
This commit is contained in:
parent
5a1d9aee15
commit
74a1aeff8e
@ -2677,10 +2677,10 @@ void PrintObject::project_and_append_custom_supports(
|
|||||||
if (custom_facets.indices.empty())
|
if (custom_facets.indices.empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const TriangleMesh& mesh = mv->mesh();
|
|
||||||
const Transform3f& tr1 = mv->get_matrix().cast<float>();
|
const Transform3f& tr1 = mv->get_matrix().cast<float>();
|
||||||
const Transform3f& tr2 = this->trafo().cast<float>();
|
const Transform3f& tr2 = this->trafo().cast<float>();
|
||||||
const Transform3f tr = tr2 * tr1;
|
const Transform3f tr = tr2 * tr1;
|
||||||
|
const float tr_det_sign = (tr.matrix().determinant() > 0. ? 1.f : -1.f);
|
||||||
|
|
||||||
|
|
||||||
// The projection will be at most a pentagon. Let's minimize heap
|
// The projection will be at most a pentagon. Let's minimize heap
|
||||||
@ -2719,8 +2719,9 @@ void PrintObject::project_and_append_custom_supports(
|
|||||||
for (int i=0; i<3; ++i)
|
for (int i=0; i<3; ++i)
|
||||||
facet[i] = tr * custom_facets.vertices[custom_facets.indices[idx](i)];
|
facet[i] = tr * custom_facets.vertices[custom_facets.indices[idx](i)];
|
||||||
|
|
||||||
// Ignore triangles with upward-pointing normal.
|
// Ignore triangles with upward-pointing normal. Don't forget about mirroring.
|
||||||
if ((facet[1]-facet[0]).cross(facet[2]-facet[0]).z() > 0.)
|
float z_comp = (facet[1]-facet[0]).cross(facet[2]-facet[0]).z();
|
||||||
|
if (tr_det_sign * z_comp > 0.)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Sort the three vertices according to z-coordinate.
|
// Sort the three vertices according to z-coordinate.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user