FIX: do not allow support thresh angle to be 90 degrees

tan(90\degrees) is too large and will make detect_overhangs very slow.

Jira: STUDIO-2620
Change-Id: I55901a6bc1b56216549f66e1a7e77c0da680997b
(cherry picked from commit e58cc8a4665808580e84107f54661447000d64f3)
This commit is contained in:
Arthur 2023-04-06 20:48:58 +08:00 committed by Lane.Wei
parent bc0fe0c8bc
commit 87abd65ea4
2 changed files with 9 additions and 10 deletions

View file

@ -1549,9 +1549,10 @@ static inline ExPolygons detect_overhangs(
const bool buildplate_only = ! annotations.buildplate_covered.empty();
// If user specified a custom angle threshold, convert it to radians.
// Zero means automatic overhang detection.
const double threshold_rad = (object_config.support_threshold_angle.value > 0) ?
M_PI * double(object_config.support_threshold_angle.value + 1) / 180. : // +1 makes the threshold inclusive
0.;
// +1 makes the threshold inclusive
double thresh_angle = object_config.support_threshold_angle.value > 0 ? object_config.support_threshold_angle.value + 1 : 0;
thresh_angle = std::min(thresh_angle, 89.); // BBS should be smaller than 90
const double threshold_rad = Geometry::deg2rad(thresh_angle);
const coordf_t max_bridge_length = scale_(object_config.max_bridge_length.value);
const bool bridge_no_support = object_config.bridge_no_support.value;
const coordf_t xy_expansion = scale_(object_config.support_expansion.value);
@ -1731,11 +1732,6 @@ static inline std::tuple<Polygons, Polygons, double> detect_contacts(
// BBS.
const bool auto_normal_support = object_config.support_type.value == stNormalAuto;
const bool buildplate_only = !annotations.buildplate_covered.empty();
// If user specified a custom angle threshold, convert it to radians.
// Zero means automatic overhang detection.
const double threshold_rad = (object_config.support_threshold_angle.value > 0) ?
M_PI * double(object_config.support_threshold_angle.value + 1) / 180. : // +1 makes the threshold inclusive
0.;
float no_interface_offset = 0.f;
if (layer_id == 0)