mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 17:27:52 -06:00
ENH: sync with master on sharp tail and cantilever detection
Change-Id: Id514d47d868fd02a8ac02ef85ef33ef48a2bd7c7
This commit is contained in:
parent
967909937d
commit
4bab300e18
2 changed files with 22 additions and 8 deletions
|
@ -1518,6 +1518,16 @@ static inline Polygons detect_overhangs(
|
||||||
{
|
{
|
||||||
// Don't fill in the holes. The user may apply a higher raft_expansion if one wants a better 1st layer adhesion.
|
// Don't fill in the holes. The user may apply a higher raft_expansion if one wants a better 1st layer adhesion.
|
||||||
overhang_polygons = to_polygons(layer.lslices);
|
overhang_polygons = to_polygons(layer.lslices);
|
||||||
|
|
||||||
|
for (auto& slice : layer.lslices) {
|
||||||
|
auto bbox_size = get_extents(slice).size();
|
||||||
|
if (g_config_support_sharp_tails &&
|
||||||
|
!(bbox_size.x() > length_thresh_well_supported && bbox_size.y() > length_thresh_well_supported))
|
||||||
|
{
|
||||||
|
layer.sharp_tails.push_back(slice);
|
||||||
|
layer.sharp_tails_height.insert({ &slice, layer.height });
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (! layer.regions().empty())
|
else if (! layer.regions().empty())
|
||||||
{
|
{
|
||||||
|
@ -1609,12 +1619,12 @@ static inline Polygons detect_overhangs(
|
||||||
supported_area += temp.area();
|
supported_area += temp.area();
|
||||||
bbox.merge(get_extents(temp));
|
bbox.merge(get_extents(temp));
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
if (supported_area > area_thresh_well_supported) {
|
if (supported_area > area_thresh_well_supported) {
|
||||||
is_sharp_tail = false;
|
is_sharp_tail = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (bbox.size().x() > length_thresh_well_supported && bbox.size().y() > length_thresh_well_supported) {
|
if (bbox.size().x() > length_thresh_well_supported && bbox.size().y() > length_thresh_well_supported) {
|
||||||
is_sharp_tail = false;
|
is_sharp_tail = false;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -844,9 +844,13 @@ void TreeSupport::detect_object_overhangs()
|
||||||
if (layer->lower_layer == nullptr) {
|
if (layer->lower_layer == nullptr) {
|
||||||
for (auto& slice : layer->lslices) {
|
for (auto& slice : layer->lslices) {
|
||||||
auto bbox_size = get_extents(slice).size();
|
auto bbox_size = get_extents(slice).size();
|
||||||
if (slice.area() > area_thresh_well_supported
|
if (/*slice.area() > area_thresh_well_supported || */
|
||||||
|| (bbox_size.x()>length_thresh_well_supported && bbox_size.y()>length_thresh_well_supported))
|
(bbox_size.x()>length_thresh_well_supported && bbox_size.y()>length_thresh_well_supported))
|
||||||
regions_well_supported.emplace_back(slice);
|
regions_well_supported.emplace_back(slice);
|
||||||
|
else if(g_config_support_sharp_tails){
|
||||||
|
layer->sharp_tails.push_back(slice);
|
||||||
|
layer->sharp_tails_height.insert({ &slice, layer->height });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -932,12 +936,13 @@ void TreeSupport::detect_object_overhangs()
|
||||||
// 2.2 If sharp tail below, check whether it support this region enough.
|
// 2.2 If sharp tail below, check whether it support this region enough.
|
||||||
float supported_area = area(supported_by_lower);
|
float supported_area = area(supported_by_lower);
|
||||||
BoundingBox bbox = get_extents(supported_by_lower);
|
BoundingBox bbox = get_extents(supported_by_lower);
|
||||||
|
#if 0
|
||||||
|
// judge by area isn't reliable, failure cases include 45 degree rotated cube
|
||||||
if (supported_area > area_thresh_well_supported) {
|
if (supported_area > area_thresh_well_supported) {
|
||||||
is_sharp_tail = false;
|
is_sharp_tail = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (bbox.size().x() > length_thresh_well_supported && bbox.size().y() > length_thresh_well_supported) {
|
if (bbox.size().x() > length_thresh_well_supported && bbox.size().y() > length_thresh_well_supported) {
|
||||||
is_sharp_tail = false;
|
is_sharp_tail = false;
|
||||||
break;
|
break;
|
||||||
|
@ -950,7 +955,6 @@ void TreeSupport::detect_object_overhangs()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (accum_height >= sharp_tail_max_support_height) {
|
if (accum_height >= sharp_tail_max_support_height) {
|
||||||
is_sharp_tail = false;
|
is_sharp_tail = false;
|
||||||
break;
|
break;
|
||||||
|
@ -1061,7 +1065,7 @@ void TreeSupport::detect_object_overhangs()
|
||||||
}
|
}
|
||||||
dist_max = std::max(dist_max, dist_pt);
|
dist_max = std::max(dist_max, dist_pt);
|
||||||
}
|
}
|
||||||
if (dist_max > scale_(5)) { // this cluster is cantilever, add all expolygons to sharp tail
|
if (dist_max > scale_(3)) { // this cluster is cantilever if the farmost point is larger than 3mm away from base
|
||||||
for (auto it = cluster.layer_overhangs.begin(); it != cluster.layer_overhangs.end(); it++) {
|
for (auto it = cluster.layer_overhangs.begin(); it != cluster.layer_overhangs.end(); it++) {
|
||||||
int layer_nr = it->first;
|
int layer_nr = it->first;
|
||||||
auto p_overhang = it->second;
|
auto p_overhang = it->second;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue