From e8aafd3c830cca2df628a2d330640f825e0067c1 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 24 Aug 2018 11:46:54 +0200 Subject: [PATCH] Lay flat - simple rejection of very small surfaces --- xs/src/slic3r/GUI/GLGizmo.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xs/src/slic3r/GUI/GLGizmo.cpp b/xs/src/slic3r/GUI/GLGizmo.cpp index 9ef12c813..bbd8f44eb 100644 --- a/xs/src/slic3r/GUI/GLGizmo.cpp +++ b/xs/src/slic3r/GUI/GLGizmo.cpp @@ -680,6 +680,12 @@ void GLGizmoFlatten::update_planes() } } m_planes.back().normal = Pointf3(normal_ptr->x, normal_ptr->y, normal_ptr->z); + + // if this is a just a very small triangle, remove it to speed up further calculations (it would be rejected anyway): + if (m_planes.back().vertices.size() == 3 && + ( m_planes.back().vertices[0].distance_to(m_planes.back().vertices[1]) < 1.f + || m_planes.back().vertices[0].distance_to(m_planes.back().vertices[2]) < 1.f)) + m_planes.pop_back(); } // Now we'll go through all the polygons, transform the points into xy plane to process them: