ENH: improve auto-arranging of A1 mini

1. the best object pos of A1 mini is [0.7,0.5] of bed.
2. dominant direction is more accurate (solve the problem that cubes are
not arranged neatly).

Jira: STUDIO-4356

Change-Id: I8931f51a97bee96d5d9e75306481eae2e0cdc059
This commit is contained in:
Arthur 2023-09-07 14:44:43 +08:00 committed by Lane.Wei
parent c7e78511f5
commit 793a642bd7
2 changed files with 9 additions and 2 deletions

View file

@ -217,8 +217,14 @@ void update_selected_items_axis_align(ArrangePolygons& selected, const DynamicPr
double b = m11 / m00 - cx * cy;
double c = m02 / m00 - cy * cy;
angle = std::atan2(2 * b, (a - c)) / 2;
validResult = true;
//if a and c are close, there is no dominant axis, then do not rotate
if (std::abs(a) < 1.5*std::abs(c) && std::abs(c) < 1.5*std::abs(a)) {
validResult = false;
}
else {
angle = std::atan2(2 * b, (a - c)) / 2;
validResult = true;
}
}
}
if (validResult) { ap.rotation += (PI / 2 - angle); }