ENH: improve sharp tail detection

1. When sharp tail region suddenly grows a lot, it means it connects to
   a well supported region and is no longer a sharp tail.
   Jira: STUDIO-1862
2. First layer of sharp tail can not be reducible (must have extrusion,
   i.e. won't disappear after slicing), otherwise thin spikes at the
   top of the object are also treated as sharp tails.
   Model: knight_seadra
3. Increase sharp_tail_max_support_height to 16mm
   Model: Crane_reversed

Jira: STUDIO-1859 (for this issue I don't what is the exact cause,
   but adding these three improvements solves the problem)

Change-Id: I3cd57b184d78dba8862ab3c214057ae78fe49d1f
(cherry picked from commit 9242c6a6d1f23f11ebc43a9049ce10229a15c60e)
This commit is contained in:
Arthur 2022-12-26 16:59:30 +08:00 committed by Lane.Wei
parent 4284d2ddb0
commit 38ce4b94f4
3 changed files with 23 additions and 7 deletions

View file

@ -733,7 +733,7 @@ void TreeSupport::detect_object_overhangs()
const int enforce_support_layers = config.enforce_support_layers.value;
const double area_thresh_well_supported = SQ(scale_(6));
const double length_thresh_well_supported = scale_(6);
static const double sharp_tail_max_support_height = 8.f;
static const double sharp_tail_max_support_height = 16.f;
// 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;
double obj_height = m_object->size().z();
@ -923,9 +923,9 @@ void TreeSupport::detect_object_overhangs()
float accum_height = layer->height;
do {
// 1. nothing below
// check whether this is a sharp tail region
// this is a sharp tail region if it's small but non-ignorable
if (intersection_ex({expoly}, lower_polys).empty()) {
is_sharp_tail = expoly.area() < area_thresh_well_supported;
is_sharp_tail = expoly.area() < area_thresh_well_supported && !offset_ex(expoly,-0.5*extrusion_width_scaled).empty();
break;
}
@ -969,7 +969,7 @@ void TreeSupport::detect_object_overhangs()
// 2.4 if the area grows fast than threshold, it get connected to other part or
// it has a sharp slop and will be auto supported.
ExPolygons new_overhang_expolys = diff_ex({expoly}, lower_layer_sharptails);
if (!offset_ex(new_overhang_expolys, -5.0 * extrusion_width_scaled).empty()) {
if ((get_extents(new_overhang_expolys).size()-get_extents(lower_layer_sharptails).size()).both_comp(Point(scale_(5),scale_(5)),">") || !offset_ex(new_overhang_expolys, -5.0 * extrusion_width_scaled).empty()) {
is_sharp_tail = false;
break;
}