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:
parent
bc0fe0c8bc
commit
87abd65ea4
|
@ -1549,9 +1549,10 @@ static inline ExPolygons detect_overhangs(
|
||||||
const bool buildplate_only = ! annotations.buildplate_covered.empty();
|
const bool buildplate_only = ! annotations.buildplate_covered.empty();
|
||||||
// If user specified a custom angle threshold, convert it to radians.
|
// If user specified a custom angle threshold, convert it to radians.
|
||||||
// Zero means automatic overhang detection.
|
// Zero means automatic overhang detection.
|
||||||
const double threshold_rad = (object_config.support_threshold_angle.value > 0) ?
|
// +1 makes the threshold inclusive
|
||||||
M_PI * double(object_config.support_threshold_angle.value + 1) / 180. : // +1 makes the threshold inclusive
|
double thresh_angle = object_config.support_threshold_angle.value > 0 ? object_config.support_threshold_angle.value + 1 : 0;
|
||||||
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 coordf_t max_bridge_length = scale_(object_config.max_bridge_length.value);
|
||||||
const bool bridge_no_support = object_config.bridge_no_support.value;
|
const bool bridge_no_support = object_config.bridge_no_support.value;
|
||||||
const coordf_t xy_expansion = scale_(object_config.support_expansion.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.
|
// BBS.
|
||||||
const bool auto_normal_support = object_config.support_type.value == stNormalAuto;
|
const bool auto_normal_support = object_config.support_type.value == stNormalAuto;
|
||||||
const bool buildplate_only = !annotations.buildplate_covered.empty();
|
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;
|
float no_interface_offset = 0.f;
|
||||||
|
|
||||||
if (layer_id == 0)
|
if (layer_id == 0)
|
||||||
|
|
|
@ -752,7 +752,10 @@ void TreeSupport::detect_overhangs(bool detect_first_sharp_tail_only)
|
||||||
// a region is considered well supported if the number of layers below it exceeds this threshold
|
// a region is considered well supported if the number of layers below it exceeds this threshold
|
||||||
const int thresh_layers_below = 10 / config.layer_height;
|
const int thresh_layers_below = 10 / config.layer_height;
|
||||||
double obj_height = m_object->size().z();
|
double obj_height = m_object->size().z();
|
||||||
double threshold_rad = (config.support_threshold_angle.value < EPSILON ? 30 : config.support_threshold_angle.value + 1) * M_PI / 180.;
|
// +1 makes the threshold inclusive
|
||||||
|
double thresh_angle = config.support_threshold_angle.value > EPSILON ? config.support_threshold_angle.value + 1 : 30;
|
||||||
|
thresh_angle = std::min(thresh_angle, 89.); // should be smaller than 90
|
||||||
|
const double threshold_rad = Geometry::deg2rad(thresh_angle);
|
||||||
|
|
||||||
// for small overhang removal
|
// for small overhang removal
|
||||||
struct OverhangCluster {
|
struct OverhangCluster {
|
||||||
|
@ -3289,7 +3292,7 @@ void TreeSupport::generate_contact_points(std::vector<std::vector<TreeSupport::N
|
||||||
size_t support_roof_layers = config.support_interface_top_layers.value;
|
size_t support_roof_layers = config.support_interface_top_layers.value;
|
||||||
if (support_roof_layers > 0)
|
if (support_roof_layers > 0)
|
||||||
support_roof_layers += 1; // BBS: add a normal support layer below interface (if we have interface)
|
support_roof_layers += 1; // BBS: add a normal support layer below interface (if we have interface)
|
||||||
coordf_t thresh_angle = config.support_threshold_angle.value < EPSILON ? 30.f : config.support_threshold_angle.value;
|
coordf_t thresh_angle = std::min(89.f, config.support_threshold_angle.value < EPSILON ? 30.f : config.support_threshold_angle.value);
|
||||||
coordf_t half_overhang_distance = scale_(tan(thresh_angle * M_PI / 180.0) * layer_height / 2);
|
coordf_t half_overhang_distance = scale_(tan(thresh_angle * M_PI / 180.0) * layer_height / 2);
|
||||||
|
|
||||||
// fix bug of generating support for very thin objects
|
// fix bug of generating support for very thin objects
|
||||||
|
|
Loading…
Reference in New Issue