WIP TreeSupports: Fixed yet some more compiler warnings

This commit is contained in:
Vojtech Bubnik 2022-08-24 15:32:23 +02:00
parent f54ba6aeaf
commit 51cfec55cf
2 changed files with 9 additions and 12 deletions

View File

@ -615,7 +615,7 @@ void TreeModelVolumes::calculateAvoidance(const std::vector<RadiusLayerPair> &ke
// Merge current layer collisions with shrunk last_avoidance. // Merge current layer collisions with shrunk last_avoidance.
const Polygons &current_layer_collisions = collision_holefree ? getCollisionHolefree(task.radius, layer_idx) : getCollision(task.radius, layer_idx, true); const Polygons &current_layer_collisions = collision_holefree ? getCollisionHolefree(task.radius, layer_idx) : getCollision(task.radius, layer_idx, true);
// For mildly steep branch angles only one step will be taken. // For mildly steep branch angles only one step will be taken.
for (size_t istep = 0; istep < move_steps; ++ istep) for (int istep = 0; istep < move_steps; ++ istep)
latest_avoidance = union_(current_layer_collisions, latest_avoidance = union_(current_layer_collisions,
offset(latest_avoidance, offset(latest_avoidance,
istep + 1 == move_steps ? - last_move_step : - move_step, istep + 1 == move_steps ? - last_move_step : - move_step,

View File

@ -292,9 +292,10 @@ static bool layer_has_overhangs(const Layer &layer)
// +1 makes the threshold inclusive // +1 makes the threshold inclusive
double tan_threshold = support_threshold_auto ? 0. : tan(M_PI * double(support_threshold + 1) / 180.); double tan_threshold = support_threshold_auto ? 0. : tan(M_PI * double(support_threshold + 1) / 180.);
tbb::parallel_for(tbb::blocked_range<size_t>(1, out.size()), tbb::parallel_for(tbb::blocked_range<LayerIndex>(1, out.size()),
[&print_object, &enforcers_layers, &blockers_layers, support_auto, support_enforce_layers, support_threshold_auto, tan_threshold, &out](const tbb::blocked_range<size_t> &range) { [&print_object, &enforcers_layers, &blockers_layers, support_auto, support_enforce_layers, support_threshold_auto, tan_threshold, &out]
for (size_t layer_id = range.begin(); layer_id < range.end(); ++ layer_id) (const tbb::blocked_range<LayerIndex> &range) {
for (LayerIndex layer_id = range.begin(); layer_id < range.end(); ++ layer_id)
if (layer_has_overhangs(*print_object.get_layer(layer_id))) { if (layer_has_overhangs(*print_object.get_layer(layer_id))) {
const Polygons raw_overhangs = layer_overhangs(*print_object.get_layer(layer_id)); const Polygons raw_overhangs = layer_overhangs(*print_object.get_layer(layer_id));
Polygons overhangs; Polygons overhangs;
@ -319,14 +320,10 @@ static bool layer_has_overhangs(const Layer &layer)
diff(clipped_overhangs, lower_layer.lslices) : diff(clipped_overhangs, lower_layer.lslices) :
diff(clipped_overhangs, offset(lower_layer.lslices, lower_layer_offset)); diff(clipped_overhangs, offset(lower_layer.lslices, lower_layer_offset));
} }
if (! enforcers_layers.empty() && ! enforcers_layers[layer_id].empty()) { if (! enforcers_layers.empty() && ! enforcers_layers[layer_id].empty())
// Has some support enforcers at this layer, apply them to the overhangs, don't apply the support threshold angle. // Has some support enforcers at this layer, apply them to the overhangs, don't apply the support threshold angle.
if (Polygons enforced_overhangs = intersection(raw_overhangs, enforcers_layers[layer_id]); ! enforced_overhangs.empty()) if (Polygons enforced_overhangs = intersection(raw_overhangs, enforcers_layers[layer_id]); ! enforced_overhangs.empty())
if (overhangs.empty()) overhangs = overhangs.empty() ? std::move(enforced_overhangs) : union_(overhangs, enforced_overhangs);
overhangs = std::move(enforced_overhangs);
else
overhangs = union_(overhangs, enforced_overhangs);
}
out[layer_id] = std::move(overhangs); out[layer_id] = std::move(overhangs);
} }
}); });
@ -2803,11 +2800,11 @@ void TreeSupport::drawAreas(
auto &this_layers = support_layer_storage[layer_idx]; auto &this_layers = support_layer_storage[layer_idx];
size_t cnt_roofs = 0; size_t cnt_roofs = 0;
size_t cnt_layers = 0; size_t cnt_layers = 0;
for (const std::pair<SupportElement*, Polygons> &data_pair : this_layer_tree_polygons) for (const std::pair<const SupportElement*, Polygons> &data_pair : this_layer_tree_polygons)
++ (data_pair.first->missing_roof_layers > data_pair.first->distance_to_top ? cnt_roofs : cnt_layers); ++ (data_pair.first->missing_roof_layers > data_pair.first->distance_to_top ? cnt_roofs : cnt_layers);
this_roofs.reserve(this_roofs.size() + cnt_roofs); this_roofs.reserve(this_roofs.size() + cnt_roofs);
this_layers.reserve(this_layers.size() + cnt_layers); this_layers.reserve(this_layers.size() + cnt_layers);
for (const std::pair<SupportElement*, Polygons> &data_pair : this_layer_tree_polygons) { for (const std::pair<const SupportElement*, Polygons> &data_pair : this_layer_tree_polygons) {
auto &src = const_cast<Polygons&>(data_pair.second); auto &src = const_cast<Polygons&>(data_pair.second);
std::move(std::begin(src), std::end(src), std::back_inserter(data_pair.first->missing_roof_layers > data_pair.first->distance_to_top ? this_roofs : this_layers)); std::move(std::begin(src), std::end(src), std::back_inserter(data_pair.first->missing_roof_layers > data_pair.first->distance_to_top ? this_roofs : this_layers));
} }