From 2079fed0cadb61f5a3dcde9428b4edd7c7d12054 Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Thu, 25 May 2023 16:49:21 +0200 Subject: [PATCH] Fixed some more compilation warnings. --- src/libslic3r/PerimeterGenerator.cpp | 2 +- src/libslic3r/Slicing.cpp | 2 +- src/libslic3r/Support/OrganicSupport.cpp | 21 +++++++++++---------- src/libslic3r/Support/SupportCommon.cpp | 2 +- src/libslic3r/Support/TreeModelVolumes.hpp | 4 ++-- src/libslic3r/Support/TreeSupport.cpp | 4 ++-- src/libslic3r/Support/TreeSupportCommon.cpp | 4 +--- src/libslic3r/Support/TreeSupportCommon.hpp | 2 -- 8 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index 5b2ffaa6a..b0fd7f35b 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -582,7 +582,7 @@ static ExtrusionEntityCollection traverse_extrusions(const PerimeterGenerator::P } // Prefer non-overhang point as a starting point. - for (const std::pair pt : point_occurrence) + for (const std::pair &pt : point_occurrence) if (pt.second.occurrence == 1) { start_point = pt.first; if (!pt.second.is_overhang) { diff --git a/src/libslic3r/Slicing.cpp b/src/libslic3r/Slicing.cpp index a0fe3e662..855f1502b 100644 --- a/src/libslic3r/Slicing.cpp +++ b/src/libslic3r/Slicing.cpp @@ -186,7 +186,7 @@ std::vector layer_height_profile_from_ranges( auto last_z = [&layer_height_profile]() { return layer_height_profile.empty() ? 0. : *(layer_height_profile.end() - 2); }; - auto lh_append = [&layer_height_profile, last_z](coordf_t z, coordf_t layer_height) { + auto lh_append = [&layer_height_profile](coordf_t z, coordf_t layer_height) { if (! layer_height_profile.empty()) { bool last_z_matches = is_approx(*(layer_height_profile.end() - 2), z); bool last_h_matches = is_approx(layer_height_profile.back(), layer_height); diff --git a/src/libslic3r/Support/OrganicSupport.cpp b/src/libslic3r/Support/OrganicSupport.cpp index ca92629ff..e3c09d0cc 100644 --- a/src/libslic3r/Support/OrganicSupport.cpp +++ b/src/libslic3r/Support/OrganicSupport.cpp @@ -146,7 +146,7 @@ Forest make_forest(const TreeSupportSettings &config, const SlicingParameters &s // Collect elements up to a bifurcation above. start_element.state.marked = true; // For each branch bifurcating from this point: - SupportElements &layer = move_bounds[start_element.state.layer_idx]; +// SupportElements &layer = move_bounds[start_element.state.layer_idx]; SupportElements &layer_above = move_bounds[start_element.state.layer_idx + 1]; for (size_t parent_idx = 0; parent_idx < start_element.parents.size(); ++ parent_idx) { Branch branch; @@ -401,8 +401,6 @@ void smooth_trees_inside_influence_areas(Branch &root, bool is_root) } { // Laplacian smoothing with 0.5 weight, branching point. - const Vec3f &p0 = state.branch.path[state.branch.path.size() - 2].prev_position; - const Vec3f &p1 = state.branch.path.back().prev_position; float weight = 0; Vec2f new_pos = Vec2f::Zero(); for (size_t i = 0; i < state.branch.num_up_trunk; ++i) { @@ -454,6 +452,7 @@ void smooth_trees_inside_influence_areas(Forest &forest) smooth_trees_inside_influence_areas(tree.root(), true); } +#if 0 // Test whether two circles, each on its own plane in 3D intersect. // Circles are considered intersecting, if the lowest point on one circle is below the other circle's plane. // Assumption: The two planes are oriented the same way. @@ -474,6 +473,7 @@ static bool circles_intersect( assert(n1.dot(p2) >= n1.dot(lowest_point2)); return n1.dot(lowest_point2) <= 0; } +#endif template void triangulate_fan(indexed_triangle_set &its, int ifan, int ibegin, int iend) @@ -602,7 +602,8 @@ static std::pair extrude_branch( // char fname[2048]; // static int irun = 0; - float zmin, zmax; + float zmin = 0; + float zmax = 0; for (size_t ipath = 1; ipath < path.size(); ++ ipath) { const SupportElement &prev = *path[ipath - 1]; @@ -854,7 +855,7 @@ static void organic_smooth_branches_avoid_collisions( } // Laplacian smoothing Vec2d avg{ 0, 0 }; - const SupportElements &above = move_bounds[collision_sphere.element.state.layer_idx + 1]; + //const SupportElements &above = move_bounds[collision_sphere.element.state.layer_idx + 1]; const size_t offset_above = linear_data_layers[collision_sphere.element.state.layer_idx + 1]; double weight = 0.; for (auto iparent : collision_sphere.element.parents) { @@ -1027,7 +1028,7 @@ void organic_draw_branches( std::vector> map_downwards_new; linear_data_layers.emplace_back(0); for (LayerIndex layer_idx = 0; layer_idx < LayerIndex(move_bounds.size()); ++ layer_idx) { - SupportElements *layer_above = layer_idx + 1 < move_bounds.size() ? &move_bounds[layer_idx + 1] : nullptr; + SupportElements *layer_above = layer_idx + 1 < LayerIndex(move_bounds.size()) ? &move_bounds[layer_idx + 1] : nullptr; map_downwards_new.clear(); std::sort(map_downwards_old.begin(), map_downwards_old.end(), [](auto& l, auto& r) { return l.first < r.first; }); SupportElements &layer = move_bounds[layer_idx]; @@ -1103,7 +1104,7 @@ void organic_draw_branches( // Collect elements up to a bifurcation above. start_element.state.marked = true; // For each branch bifurcating from this point: - SupportElements &layer = move_bounds[start_element.state.layer_idx]; + //SupportElements &layer = move_bounds[start_element.state.layer_idx]; SupportElements &layer_above = move_bounds[start_element.state.layer_idx + 1]; bool root = out.branches.empty(); for (size_t parent_idx = 0; parent_idx < start_element.parents.size(); ++ parent_idx) { @@ -1244,7 +1245,7 @@ void organic_draw_branches( double support_area_min_radius = M_PI * sqr(double(config.branch_radius)); double support_area_stop = std::max(0.2 * M_PI * sqr(double(bottom_radius)), 0.5 * support_area_min_radius); // Only propagate until the rest area is smaller than this threshold. - double support_area_min = 0.1 * support_area_min_radius; + //double support_area_min = 0.1 * support_area_min_radius; for (LayerIndex layer_idx = layer_begin - 1; layer_idx >= layer_bottommost; -- layer_idx) { rest_support = diff_clipped(rest_support.empty() ? slices.front() : rest_support, volumes.getCollision(0, layer_idx, false)); double rest_support_area = area(rest_support); @@ -1323,11 +1324,11 @@ void organic_draw_branches( Slice &dst = tree.slices[i - new_begin]; if (++ dst.num_branches > 1) { append(dst.polygons, std::move(src)); - if (j < bottom_contacts.size()) + if (j < int(bottom_contacts.size())) append(dst.bottom_contacts, std::move(bottom_contacts[j])); } else { dst.polygons = std::move(std::move(src)); - if (j < bottom_contacts.size()) + if (j < int(bottom_contacts.size())) dst.bottom_contacts = std::move(bottom_contacts[j]); } } diff --git a/src/libslic3r/Support/SupportCommon.cpp b/src/libslic3r/Support/SupportCommon.cpp index 7c4f9b979..dce57a72c 100644 --- a/src/libslic3r/Support/SupportCommon.cpp +++ b/src/libslic3r/Support/SupportCommon.cpp @@ -680,7 +680,7 @@ static inline void tree_supports_generate_paths( ClipperLib_Z::Path *closest_contour = nullptr; Vec2d closest_point; int closest_point_idx = -1; - double closest_point_t; + double closest_point_t = 0.; double d2min = std::numeric_limits::max(); Vec2d seam_pt = pl.back().cast(); for (ClipperLib_Z::Path &path : anchor_candidates) diff --git a/src/libslic3r/Support/TreeModelVolumes.hpp b/src/libslic3r/Support/TreeModelVolumes.hpp index 81fbdaa2b..8d9c3a232 100644 --- a/src/libslic3r/Support/TreeModelVolumes.hpp +++ b/src/libslic3r/Support/TreeModelVolumes.hpp @@ -240,7 +240,7 @@ private: */ std::optional> getArea(const TreeModelVolumes::RadiusLayerPair &key) const { std::lock_guard guard(m_mutex); - if (key.second >= m_data.size()) + if (key.second >= LayerIndex(m_data.size())) return std::optional>{}; const auto &layer = m_data[key.second]; auto it = layer.find(key.first); @@ -250,7 +250,7 @@ private: // Get a collision area at a given layer for a radius that is a lower or equial to the key radius. std::optional>> get_lower_bound_area(const TreeModelVolumes::RadiusLayerPair &key) const { std::lock_guard guard(m_mutex); - if (key.second >= m_data.size()) + if (key.second >= LayerIndex(m_data.size())) return {}; const auto &layer = m_data[key.second]; if (layer.empty()) diff --git a/src/libslic3r/Support/TreeSupport.cpp b/src/libslic3r/Support/TreeSupport.cpp index 051f6cbb1..ffcdc5e3e 100644 --- a/src/libslic3r/Support/TreeSupport.cpp +++ b/src/libslic3r/Support/TreeSupport.cpp @@ -1177,7 +1177,7 @@ void sample_overhang_area( } assert(dtt_roof <= layer_idx); - if (int(dtt_roof) >= layer_idx && large_horizontal_roof) + if (dtt_roof >= layer_idx && large_horizontal_roof) // Reached buildplate when generating contact, interface and base interface layers. interface_placer.add_roof_build_plate(std::move(overhang_area), dtt_roof); else { @@ -1284,7 +1284,7 @@ static void generate_initial_areas( tbb::parallel_for(tbb::blocked_range(0, raw_overhangs.size()), [&volumes, &config, &raw_overhangs, &mesh_group_settings, - min_xy_dist, force_tip_to_roof, roof_enabled, num_support_roof_layers, extra_outset, circle_length_to_half_linewidth_change, connect_length, max_overhang_insert_lag, + min_xy_dist, roof_enabled, num_support_roof_layers, extra_outset, circle_length_to_half_linewidth_change, connect_length, &rich_interface_placer, &throw_on_cancel](const tbb::blocked_range &range) { for (size_t raw_overhang_idx = range.begin(); raw_overhang_idx < range.end(); ++ raw_overhang_idx) { size_t layer_idx = raw_overhangs[raw_overhang_idx].first; diff --git a/src/libslic3r/Support/TreeSupportCommon.cpp b/src/libslic3r/Support/TreeSupportCommon.cpp index 54f67e940..a4f59da66 100644 --- a/src/libslic3r/Support/TreeSupportCommon.cpp +++ b/src/libslic3r/Support/TreeSupportCommon.cpp @@ -78,9 +78,7 @@ TreeSupportMeshGroupSettings::TreeSupportMeshGroupSettings(const PrintObject &pr } TreeSupportSettings::TreeSupportSettings(const TreeSupportMeshGroupSettings &mesh_group_settings, const SlicingParameters &slicing_params) - : angle(mesh_group_settings.support_tree_angle), - angle_slow(mesh_group_settings.support_tree_angle_slow), - support_line_width(mesh_group_settings.support_line_width), + : support_line_width(mesh_group_settings.support_line_width), layer_height(mesh_group_settings.layer_height), branch_radius(mesh_group_settings.support_tree_branch_diameter / 2), min_radius(mesh_group_settings.support_tree_tip_diameter / 2), // The actual radius is 50 microns larger as the resulting branches will be increased by 50 microns to avoid rounding errors effectively increasing the xydistance diff --git a/src/libslic3r/Support/TreeSupportCommon.hpp b/src/libslic3r/Support/TreeSupportCommon.hpp index 1e73344ed..b0d224586 100644 --- a/src/libslic3r/Support/TreeSupportCommon.hpp +++ b/src/libslic3r/Support/TreeSupportCommon.hpp @@ -443,8 +443,6 @@ public: #endif private: - double angle; - double angle_slow; // std::vector known_z; };