From 10f24119d0e66ce8336c961b1a4ae440957670a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hejl?= Date: Mon, 25 Oct 2021 08:43:30 +0200 Subject: [PATCH] Fixed the propagation of painted top and bottom layers for mirrored objects in multi-material segmentation. --- src/libslic3r/TriangleMeshSlicer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/TriangleMeshSlicer.cpp b/src/libslic3r/TriangleMeshSlicer.cpp index 0f3d0f5b64..83a2be3226 100644 --- a/src/libslic3r/TriangleMeshSlicer.cpp +++ b/src/libslic3r/TriangleMeshSlicer.cpp @@ -1919,6 +1919,7 @@ void slice_mesh_slabs( #endif // EXPENSIVE_DEBUG_CHECKS std::vector vertices_transformed = transform_mesh_vertices_for_slicing(mesh, trafo); + const bool mirrored = trafo.matrix().determinant() < 0; std::vector face_orientation(mesh.indices.size(), FaceOrientation::Up); for (const stl_triangle_vertex_indices &tri : mesh.indices) { @@ -1929,7 +1930,7 @@ void slice_mesh_slabs( const Point a = to_2d(fa).cast(); const Point b = to_2d(fb).cast(); const Point c = to_2d(fc).cast(); - const int64_t d = cross2((b - a).cast(), (c - b).cast()); + const int64_t d = cross2((b - a).cast(), (c - b).cast()) * (mirrored ? -1 : 1); FaceOrientation fo = FaceOrientation::Vertical; if (d > 0) fo = FaceOrientation::Up;