FIX: STUDIO-2246 flatten bug

Fix the flatten bug

Change-Id: I448704dc9180cdd3f1142c988d0000f053417c9c
(cherry picked from commit a8e35d1fef183f907e78124a3b73bd0cabb69e9b)
This commit is contained in:
shuai.liu 2023-06-15 16:39:27 +08:00 committed by Lane.Wei
parent 629b717148
commit 08c2bf665c

View file

@ -141,6 +141,7 @@ void GLGizmoFlatten::update_planes()
// Following constants are used for discarding too small polygons.
const float minimal_area = 5.f; // in square mm (world coordinates)
const float minimal_side = 1.f; // mm
const float minimal_angle = 1.f; // degree, initial value was 10, but cause bugs
// Now we'll go through all the facets and append Points of facets sharing the same normal.
// This part is still performed in mesh coordinate system.
@ -235,7 +236,7 @@ void GLGizmoFlatten::update_planes()
discard = true;
else {
// We also check the inner angles and discard polygons with angles smaller than the following threshold
const double angle_threshold = ::cos(10.0 * (double)PI / 180.0);
const double angle_threshold = ::cos(minimal_angle * (double)PI / 180.0);
for (unsigned int i = 0; i < polygon.size(); ++i) {
const Vec3d& prec = polygon[(i == 0) ? polygon.size() - 1 : i - 1];