WIP TreeSupports: Fixed some more compiler warnings

This commit is contained in:
Vojtech Bubnik 2022-08-24 14:39:13 +02:00
parent 9045ff8f0e
commit f54ba6aeaf
3 changed files with 20 additions and 21 deletions

View File

@ -110,7 +110,7 @@ void export_support_surface_type_legend_to_svg(SVG &svg, const Point &pos)
svg.draw_legend(Point(pos_x, pos_y), "intermediate" , support_surface_type_to_color_name(SupporLayerType::Intermediate));
}
void export_print_z_polygons_to_svg(const char *path, SupportGeneratorLayer ** const layers, size_t n_layers)
void export_print_z_polygons_to_svg(const char *path, SupportGeneratorLayer ** const layers, int n_layers)
{
BoundingBox bbox;
for (int i = 0; i < n_layers; ++ i)
@ -129,10 +129,10 @@ void export_print_z_polygons_to_svg(const char *path, SupportGeneratorLayer ** c
}
void export_print_z_polygons_and_extrusions_to_svg(
const char *path,
const char *path,
SupportGeneratorLayer ** const layers,
size_t n_layers,
SupportLayer &support_layer)
int n_layers,
SupportLayer &support_layer)
{
BoundingBox bbox;
for (int i = 0; i < n_layers; ++ i)

View File

@ -465,10 +465,10 @@ void TreeModelVolumes::calculateCollision(const coord_t radius, const LayerIndex
Polygons collisions;
for (int i = -z_distance_bottom_layers; i <= z_distance_top_layers; ++ i) {
int j = layer_idx + i - min_layer_bottom;
if (j >= 0 && j < collision_areas_offsetted.size())
if (j >= 0 && j < int(collision_areas_offsetted.size()))
append(collisions, collision_areas_offsetted[j]);
}
collisions = last && layer_idx < anti_overhang.size() ? union_(collisions, offset(union_ex(anti_overhang[layer_idx]), radius, ClipperLib::jtMiter, 1.2)) : union_(collisions);
collisions = last && layer_idx < int(anti_overhang.size()) ? union_(collisions, offset(union_ex(anti_overhang[layer_idx]), radius, ClipperLib::jtMiter, 1.2)) : union_(collisions);
auto &dst = data[layer_idx - (min_layer_last + 1)];
if (last) {
if (! dst.empty())
@ -490,7 +490,7 @@ void TreeModelVolumes::calculateCollision(const coord_t radius, const LayerIndex
assert(layer_idx_below >= 0);
auto &current = collision_areas_offsetted[layer_idx - min_layer_bottom];
auto &below = collision_areas_offsetted[layer_idx_below];
auto placable = diff(below, layer_idx < anti_overhang.size() ? union_(current, anti_overhang[layer_idx - (z_distance_bottom_layers + 1)]) : current);
auto placable = diff(below, layer_idx < int(anti_overhang.size()) ? union_(current, anti_overhang[layer_idx - (z_distance_bottom_layers + 1)]) : current);
auto &dst = data_placeable[layer_idx - (min_layer_last + 1)];
if (last) {
if (! dst.empty())
@ -524,10 +524,10 @@ void TreeModelVolumes::calculateCollisionHolefree(const std::vector<RadiusLayerP
for (long long unsigned int i = 0; i < keys.size(); i++)
max_layer = std::max(max_layer, keys[i].second);
tbb::parallel_for(tbb::blocked_range<size_t>(0, max_layer + 1, keys.size()),
[&](const tbb::blocked_range<size_t> &range) {
tbb::parallel_for(tbb::blocked_range<LayerIndex>(0, max_layer + 1, keys.size()),
[&](const tbb::blocked_range<LayerIndex> &range) {
RadiusLayerPolygonCacheData data;
for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++ layer_idx) {
for (LayerIndex layer_idx = range.begin(); layer_idx < range.end(); ++ layer_idx) {
for (RadiusLayerPair key : keys)
if (layer_idx <= key.second) {
// Logically increase the collision by m_increase_until_radius
@ -565,7 +565,7 @@ void TreeModelVolumes::calculateAvoidance(const std::vector<RadiusLayerPair> &ke
std::vector<AvoidanceTask> avoidance_tasks;
avoidance_tasks.reserve((int(to_build_plate) + int(to_model)) * keys.size() * size_t(AvoidanceType::Count));
for (int iter_idx = 0; iter_idx < 2 * keys.size() * size_t(AvoidanceType::Count); ++ iter_idx) {
for (int iter_idx = 0; iter_idx < 2 * int(keys.size()) * int(AvoidanceType::Count); ++ iter_idx) {
AvoidanceTask task{
AvoidanceType(iter_idx % int(AvoidanceType::Count)),
keys[iter_idx / 6].first, // radius
@ -666,7 +666,7 @@ void TreeModelVolumes::calculatePlaceables(const coord_t radius, const LayerInde
tbb::parallel_for(tbb::blocked_range<LayerIndex>(std::max(1, start_layer), max_required_layer + 1),
[this, &data, radius, start_layer](const tbb::blocked_range<LayerIndex>& range) {
for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++ layer_idx)
for (LayerIndex layer_idx = range.begin(); layer_idx < range.end(); ++ layer_idx)
data[layer_idx - start_layer] = offset(union_ex(getPlaceableAreas(0, layer_idx)), - radius, jtMiter, 1.2);
});
#ifdef SLIC3R_TREESUPPORTS_PROGRESS
@ -730,7 +730,7 @@ void TreeModelVolumes::calculateWallRestrictions(const std::vector<RadiusLayerPa
data_min.assign(buffer_size, Polygons{});
tbb::parallel_for(tbb::blocked_range<LayerIndex>(min_layer_bottom, max_required_layer + 1),
[this, &data, &data_min, radius, min_layer_bottom](const tbb::blocked_range<LayerIndex> &range) {
for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++ layer_idx) {
for (LayerIndex layer_idx = range.begin(); layer_idx < range.end(); ++ layer_idx) {
data[layer_idx - min_layer_bottom] = polygons_simplify(
// radius contains m_current_min_xy_dist_delta already if required
intersection(getCollision(0, layer_idx, false), getCollision(radius, layer_idx - 1, true)),

View File

@ -186,9 +186,9 @@ static std::vector<std::pair<TreeSupport::TreeSupportSettings, std::vector<size_
// as different settings in the same group may only occur in the tip, which uses the original settings objects from the meshes.
for (size_t object_id = 0; object_id < print_object_ids.size(); ++ object_id) {
const PrintObject &print_object = *print.get_object(object_id);
#ifndef _NDEBUG
#ifndef NDEBUG
const PrintObjectConfig &object_config = print_object.config();
#endif // _NDEBUG
#endif // NDEBUG
// Support must be enabled and set to Tree style.
assert(object_config.support_material);
assert(object_config.support_material_style == smsTree);
@ -347,7 +347,7 @@ static bool layer_has_overhangs(const Layer &layer)
for (size_t object_id : object_ids) {
const PrintObject &print_object = *print.get_object(object_id);
int max_support_layer_id = 0;
for (int layer_id = 1; layer_id < print_object.layer_count(); ++ layer_id)
for (int layer_id = 1; layer_id < int(print_object.layer_count()); ++ layer_id)
if (! overhangs[layer_id].empty())
max_support_layer_id = layer_id;
max_layer = std::max(max_support_layer_id - int(config.z_distance_top_layers), 0);
@ -995,7 +995,7 @@ static std::optional<std::pair<Point, size_t>> polyline_sample_next_point_at_dis
}
coord_t step_size = safe_step_size;
size_t steps = distance > last_step_offset_without_check ? (distance - last_step_offset_without_check) / step_size : 0;
int steps = distance > last_step_offset_without_check ? (distance - last_step_offset_without_check) / step_size : 0;
if (distance - steps * step_size > last_step_offset_without_check) {
if ((steps + 1) * step_size <= distance)
// This will be the case when last_step_offset_without_check >= safe_step_size
@ -1015,7 +1015,7 @@ static std::optional<std::pair<Point, size_t>> polyline_sample_next_point_at_dis
steps = distance / step_size;
}
// offset in steps
for (size_t i = 0; i < steps; i++) {
for (int i = 0; i < steps; ++ i) {
ret = diff(offset(ret, step_size, ClipperLib::jtRound, scaled<float>(0.01)), collision_trimmed());
// ensure that if many offsets are done the performance does not suffer extremely by the new vertices of jtRound.
if (i % 10 == 7)
@ -2309,7 +2309,7 @@ bool TreeSupport::setToModelContact(std::vector<std::set<SupportElement*>>& move
moveInside(*checked[last_successfull_layer - layer_idx]->area, best);
checked[last_successfull_layer - layer_idx]->result_on_layer = best;
BOOST_LOG_TRIVIAL(debug) << "Added gracious Support On Model Point (" << best.x() << "," << best.y() << "). The current layer is ", last_successfull_layer;
BOOST_LOG_TRIVIAL(debug) << "Added gracious Support On Model Point (" << best.x() << "," << best.y() << "). The current layer is " << last_successfull_layer;
return last_successfull_layer != layer_idx;
}
@ -2320,12 +2320,11 @@ bool TreeSupport::setToModelContact(std::vector<std::set<SupportElement*>>& move
moveInside(*first_elem->area, best);
first_elem->result_on_layer = best;
first_elem->to_model_gracious = false;
BOOST_LOG_TRIVIAL(debug) << "Added NON gracious Support On Model Point (" << best.x() << "," << best.y() << "). The current layer is ", layer_idx;
BOOST_LOG_TRIVIAL(debug) << "Added NON gracious Support On Model Point (" << best.x() << "," << best.y() << "). The current layer is " << layer_idx;
return false;
}
}
void TreeSupport::createNodesFromArea(std::vector<std::set<SupportElement*>>& move_bounds)
{
// Initialize points on layer 0, with a "random" point in the influence area. Point is chosen based on an inaccurate estimate where the branches will split into two, but every point inside the influence area would produce a valid result.