Fixed some more compilation warnings.

This commit is contained in:
Vojtech Bubnik 2023-05-25 16:49:21 +02:00
parent a732e72ab9
commit 2079fed0ca
8 changed files with 19 additions and 22 deletions

View file

@ -582,7 +582,7 @@ static ExtrusionEntityCollection traverse_extrusions(const PerimeterGenerator::P
} }
// Prefer non-overhang point as a starting point. // Prefer non-overhang point as a starting point.
for (const std::pair<Point, PointInfo> pt : point_occurrence) for (const std::pair<Point, PointInfo> &pt : point_occurrence)
if (pt.second.occurrence == 1) { if (pt.second.occurrence == 1) {
start_point = pt.first; start_point = pt.first;
if (!pt.second.is_overhang) { if (!pt.second.is_overhang) {

View file

@ -186,7 +186,7 @@ std::vector<coordf_t> layer_height_profile_from_ranges(
auto last_z = [&layer_height_profile]() { auto last_z = [&layer_height_profile]() {
return layer_height_profile.empty() ? 0. : *(layer_height_profile.end() - 2); 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()) { if (! layer_height_profile.empty()) {
bool last_z_matches = is_approx(*(layer_height_profile.end() - 2), z); bool last_z_matches = is_approx(*(layer_height_profile.end() - 2), z);
bool last_h_matches = is_approx(layer_height_profile.back(), layer_height); bool last_h_matches = is_approx(layer_height_profile.back(), layer_height);

View file

@ -146,7 +146,7 @@ Forest make_forest(const TreeSupportSettings &config, const SlicingParameters &s
// Collect elements up to a bifurcation above. // Collect elements up to a bifurcation above.
start_element.state.marked = true; start_element.state.marked = true;
// For each branch bifurcating from this point: // 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]; 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) { for (size_t parent_idx = 0; parent_idx < start_element.parents.size(); ++ parent_idx) {
Branch branch; 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. // 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; float weight = 0;
Vec2f new_pos = Vec2f::Zero(); Vec2f new_pos = Vec2f::Zero();
for (size_t i = 0; i < state.branch.num_up_trunk; ++i) { 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); smooth_trees_inside_influence_areas(tree.root(), true);
} }
#if 0
// Test whether two circles, each on its own plane in 3D intersect. // 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. // 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. // 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)); assert(n1.dot(p2) >= n1.dot(lowest_point2));
return n1.dot(lowest_point2) <= 0; return n1.dot(lowest_point2) <= 0;
} }
#endif
template<bool flip_normals> template<bool flip_normals>
void triangulate_fan(indexed_triangle_set &its, int ifan, int ibegin, int iend) void triangulate_fan(indexed_triangle_set &its, int ifan, int ibegin, int iend)
@ -602,7 +602,8 @@ static std::pair<float, float> extrude_branch(
// char fname[2048]; // char fname[2048];
// static int irun = 0; // static int irun = 0;
float zmin, zmax; float zmin = 0;
float zmax = 0;
for (size_t ipath = 1; ipath < path.size(); ++ ipath) { for (size_t ipath = 1; ipath < path.size(); ++ ipath) {
const SupportElement &prev = *path[ipath - 1]; const SupportElement &prev = *path[ipath - 1];
@ -854,7 +855,7 @@ static void organic_smooth_branches_avoid_collisions(
} }
// Laplacian smoothing // Laplacian smoothing
Vec2d avg{ 0, 0 }; 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]; const size_t offset_above = linear_data_layers[collision_sphere.element.state.layer_idx + 1];
double weight = 0.; double weight = 0.;
for (auto iparent : collision_sphere.element.parents) { for (auto iparent : collision_sphere.element.parents) {
@ -1027,7 +1028,7 @@ void organic_draw_branches(
std::vector<std::pair<SupportElement*, int>> map_downwards_new; std::vector<std::pair<SupportElement*, int>> map_downwards_new;
linear_data_layers.emplace_back(0); linear_data_layers.emplace_back(0);
for (LayerIndex layer_idx = 0; layer_idx < LayerIndex(move_bounds.size()); ++ layer_idx) { 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(); map_downwards_new.clear();
std::sort(map_downwards_old.begin(), map_downwards_old.end(), [](auto& l, auto& r) { return l.first < r.first; }); 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]; SupportElements &layer = move_bounds[layer_idx];
@ -1103,7 +1104,7 @@ void organic_draw_branches(
// Collect elements up to a bifurcation above. // Collect elements up to a bifurcation above.
start_element.state.marked = true; start_element.state.marked = true;
// For each branch bifurcating from this point: // 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]; SupportElements &layer_above = move_bounds[start_element.state.layer_idx + 1];
bool root = out.branches.empty(); bool root = out.branches.empty();
for (size_t parent_idx = 0; parent_idx < start_element.parents.size(); ++ parent_idx) { 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_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); 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. // 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) { 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)); rest_support = diff_clipped(rest_support.empty() ? slices.front() : rest_support, volumes.getCollision(0, layer_idx, false));
double rest_support_area = area(rest_support); double rest_support_area = area(rest_support);
@ -1323,11 +1324,11 @@ void organic_draw_branches(
Slice &dst = tree.slices[i - new_begin]; Slice &dst = tree.slices[i - new_begin];
if (++ dst.num_branches > 1) { if (++ dst.num_branches > 1) {
append(dst.polygons, std::move(src)); 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])); append(dst.bottom_contacts, std::move(bottom_contacts[j]));
} else { } else {
dst.polygons = std::move(std::move(src)); 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]); dst.bottom_contacts = std::move(bottom_contacts[j]);
} }
} }

View file

@ -680,7 +680,7 @@ static inline void tree_supports_generate_paths(
ClipperLib_Z::Path *closest_contour = nullptr; ClipperLib_Z::Path *closest_contour = nullptr;
Vec2d closest_point; Vec2d closest_point;
int closest_point_idx = -1; int closest_point_idx = -1;
double closest_point_t; double closest_point_t = 0.;
double d2min = std::numeric_limits<double>::max(); double d2min = std::numeric_limits<double>::max();
Vec2d seam_pt = pl.back().cast<double>(); Vec2d seam_pt = pl.back().cast<double>();
for (ClipperLib_Z::Path &path : anchor_candidates) for (ClipperLib_Z::Path &path : anchor_candidates)

View file

@ -240,7 +240,7 @@ private:
*/ */
std::optional<std::reference_wrapper<const Polygons>> getArea(const TreeModelVolumes::RadiusLayerPair &key) const { std::optional<std::reference_wrapper<const Polygons>> getArea(const TreeModelVolumes::RadiusLayerPair &key) const {
std::lock_guard<std::mutex> guard(m_mutex); std::lock_guard<std::mutex> guard(m_mutex);
if (key.second >= m_data.size()) if (key.second >= LayerIndex(m_data.size()))
return std::optional<std::reference_wrapper<const Polygons>>{}; return std::optional<std::reference_wrapper<const Polygons>>{};
const auto &layer = m_data[key.second]; const auto &layer = m_data[key.second];
auto it = layer.find(key.first); 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. // Get a collision area at a given layer for a radius that is a lower or equial to the key radius.
std::optional<std::pair<coord_t, std::reference_wrapper<const Polygons>>> get_lower_bound_area(const TreeModelVolumes::RadiusLayerPair &key) const { std::optional<std::pair<coord_t, std::reference_wrapper<const Polygons>>> get_lower_bound_area(const TreeModelVolumes::RadiusLayerPair &key) const {
std::lock_guard<std::mutex> guard(m_mutex); std::lock_guard<std::mutex> guard(m_mutex);
if (key.second >= m_data.size()) if (key.second >= LayerIndex(m_data.size()))
return {}; return {};
const auto &layer = m_data[key.second]; const auto &layer = m_data[key.second];
if (layer.empty()) if (layer.empty())

View file

@ -1177,7 +1177,7 @@ void sample_overhang_area(
} }
assert(dtt_roof <= layer_idx); 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. // Reached buildplate when generating contact, interface and base interface layers.
interface_placer.add_roof_build_plate(std::move(overhang_area), dtt_roof); interface_placer.add_roof_build_plate(std::move(overhang_area), dtt_roof);
else { else {
@ -1284,7 +1284,7 @@ static void generate_initial_areas(
tbb::parallel_for(tbb::blocked_range<size_t>(0, raw_overhangs.size()), tbb::parallel_for(tbb::blocked_range<size_t>(0, raw_overhangs.size()),
[&volumes, &config, &raw_overhangs, &mesh_group_settings, [&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<size_t> &range) { &rich_interface_placer, &throw_on_cancel](const tbb::blocked_range<size_t> &range) {
for (size_t raw_overhang_idx = range.begin(); raw_overhang_idx < range.end(); ++ raw_overhang_idx) { 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; size_t layer_idx = raw_overhangs[raw_overhang_idx].first;

View file

@ -78,9 +78,7 @@ TreeSupportMeshGroupSettings::TreeSupportMeshGroupSettings(const PrintObject &pr
} }
TreeSupportSettings::TreeSupportSettings(const TreeSupportMeshGroupSettings &mesh_group_settings, const SlicingParameters &slicing_params) TreeSupportSettings::TreeSupportSettings(const TreeSupportMeshGroupSettings &mesh_group_settings, const SlicingParameters &slicing_params)
: angle(mesh_group_settings.support_tree_angle), : support_line_width(mesh_group_settings.support_line_width),
angle_slow(mesh_group_settings.support_tree_angle_slow),
support_line_width(mesh_group_settings.support_line_width),
layer_height(mesh_group_settings.layer_height), layer_height(mesh_group_settings.layer_height),
branch_radius(mesh_group_settings.support_tree_branch_diameter / 2), 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 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

View file

@ -443,8 +443,6 @@ public:
#endif #endif
private: private:
double angle;
double angle_slow;
// std::vector<coord_t> known_z; // std::vector<coord_t> known_z;
}; };