FIX: compiling error due to template function deduction

jira: none
Change-Id: Ib2a3f03468b7992defef3ff2298882b4435cabd1
(cherry picked from commit 9efa2ee2e2dcd4d1322afa03c7b7ce05b1d69872)
(cherry picked from commit 40a468be3df9abc35054185ce780ada20902970b)
This commit is contained in:
Arthur 2024-03-15 10:11:54 +08:00 committed by Noisyfox
parent da7eea49c9
commit 19107b5869

View file

@ -1728,24 +1728,22 @@ Polygons TreeSupport::get_collision_polys(coordf_t radius, size_t layer_nr)
return Polygons(); return Polygons();
} }
template<typename RegionType> // RegionType could be ExPolygons or Polygons ExPolygons avoid_object_remove_extra_small_parts(const ExPolygon &expoly, const ExPolygons& avoid_region) {
ExPolygons avoid_object_remove_extra_small_parts(ExPolygons &expolys, const RegionType&avoid_region) {
ExPolygons expolys_out; ExPolygons expolys_out;
if(expolys.empty()) return expolys_out; if(expoly.empty()) return expolys_out;
auto clipped_avoid_region=ClipperUtils::clip_clipper_polygons_with_subject_bbox(avoid_region, get_extents(expolys)); auto clipped_avoid_region=ClipperUtils::clip_clipper_polygons_with_subject_bbox(avoid_region, get_extents(expoly));
for (auto expoly : expolys) { auto expolys_avoid = diff_ex(expoly, clipped_avoid_region);
auto expolys_avoid = diff_ex(expoly, clipped_avoid_region); int idx_max_area = -1;
int idx_max_area = -1; float max_area = 0;
float max_area = 0; for (int i = 0; i < expolys_avoid.size(); ++i) {
for (int i = 0; i < expolys_avoid.size(); ++i) { auto a = expolys_avoid[i].area();
auto a = expolys_avoid[i].area(); if (a > max_area) {
if (a > max_area) { max_area = a;
max_area = a; idx_max_area = i;
idx_max_area = i;
}
} }
if (idx_max_area >= 0) expolys_out.emplace_back(std::move(expolys_avoid[idx_max_area]));
} }
if (idx_max_area >= 0) expolys_out.emplace_back(std::move(expolys_avoid[idx_max_area]));
return expolys_out; return expolys_out;
} }
@ -1983,7 +1981,7 @@ void TreeSupport::draw_circles(const std::vector<std::vector<SupportNode*>>& con
if(!tmp.empty()) if(!tmp.empty())
circle = tmp[0]; circle = tmp[0];
} }
area = avoid_object_remove_extra_small_parts(ExPolygons{ ExPolygon(circle) }, get_collision(node.is_sharp_tail && node.distance_to_top <= 0)); area = avoid_object_remove_extra_small_parts(ExPolygon(circle), get_collision(node.is_sharp_tail && node.distance_to_top <= 0));
// merge overhang to get a smoother interface surface // merge overhang to get a smoother interface surface
// Do not merge when buildplate_only is on, because some underneath nodes may have been deleted. // Do not merge when buildplate_only is on, because some underneath nodes may have been deleted.
if (top_interface_layers > 0 && node.support_roof_layers_below > 0 && !on_buildplate_only && !node.is_sharp_tail) { if (top_interface_layers > 0 && node.support_roof_layers_below > 0 && !on_buildplate_only && !node.is_sharp_tail) {