ENH: improve bridge direction detection

Thanks to Prusa.
Jira: STUDIO-2453

Change-Id: Iadcc59df44d5abc552f5d558a500fd9bcd66d43f
(cherry picked from commit c19156fd037df4231f3e0cb1e9a899c9b7525372)
This commit is contained in:
Arthur 2023-03-10 20:44:07 +08:00 committed by Lane.Wei
parent dbe1f3f5b1
commit 246ff2653d
6 changed files with 238 additions and 2 deletions

View file

@ -160,7 +160,8 @@ bool BridgeDetector::detect_angle(double bridge_direction_override)
// if any other direction is within extrusion width of coverage, prefer it if shorter
// TODO: There are two options here - within width of the angle with most coverage, or within width of the currently perferred?
size_t i_best = 0;
for (size_t i = 1; i < candidates.size() && abs(candidates[i_best].archored_percent - candidates[i].archored_percent) < EPSILON; ++ i)
// for (size_t i = 1; i < candidates.size() && abs(candidates[i_best].archored_percent - candidates[i].archored_percent) < EPSILON; ++ i)
for (size_t i = 1; i < candidates.size() && candidates[i_best].coverage - candidates[i].coverage < this->spacing; ++ i)
if (candidates[i].max_length < candidates[i_best].max_length)
i_best = i;