From b4b9f2fb2b74541cf6e078f84551d638884b0218 Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Mon, 17 Jul 2023 17:17:04 +0200 Subject: [PATCH] ArcWelder: Fixed some compiler warnings --- src/libslic3r/GCode/CoolingBuffer.cpp | 3 ++- src/libslic3r/Geometry/ArcWelder.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/libslic3r/GCode/CoolingBuffer.cpp b/src/libslic3r/GCode/CoolingBuffer.cpp index 178864f784..53eeb716e5 100644 --- a/src/libslic3r/GCode/CoolingBuffer.cpp +++ b/src/libslic3r/GCode/CoolingBuffer.cpp @@ -451,7 +451,8 @@ std::vector CoolingBuffer::parse_layer_gcode(const std:: Vec2d(current_pos[AxisIdx::X], current_pos[AxisIdx::Y]), Vec2d(new_pos[AxisIdx::X], new_pos[AxisIdx::Y]), double(new_pos[AxisIdx::R]))); - } + } else + dxy2 = 0; } else dxy2 = sqr(dif[AxisIdx::X]) + sqr(dif[AxisIdx::Y]); float dxyz2 = dxy2 + sqr(dif[AxisIdx::Z]); diff --git a/src/libslic3r/Geometry/ArcWelder.cpp b/src/libslic3r/Geometry/ArcWelder.cpp index 3009305058..25426d68fc 100644 --- a/src/libslic3r/Geometry/ArcWelder.cpp +++ b/src/libslic3r/Geometry/ArcWelder.cpp @@ -167,12 +167,12 @@ static std::optional try_create_circle(const Points::const_iterator begi return circle; #endif // Find the circle with the least deviation, if one exists. - double least_deviation; + double least_deviation = std::numeric_limits::max(); double current_deviation; for (auto it = std::next(begin); std::next(it) != end; ++ it) if (std::optional circle = try_create_circle(*begin, *it, *std::prev(end), max_radius); circle && get_deviation_sum_squared(*circle, begin, end, tolerance, current_deviation)) { - if (! out || current_deviation < least_deviation) { + if (current_deviation < least_deviation) { out = circle; least_deviation = current_deviation; } @@ -631,10 +631,10 @@ std::pair split_at(const Path &path, const PathSegmentProjection &pr auto vstart = (start.point - proj.center).cast(); auto vend = (end.point - proj.center).cast(); auto vproj = (proj.point - proj.center).cast(); - if (bool first_arc_minor = (cross2(vstart, vproj) > 0) == end.ccw()) + if ((cross2(vstart, vproj) > 0) == end.ccw()) // Make the radius of a minor arc positive. out.first.back().radius *= -1.f; - if (bool second_arc_minor = (cross2(vproj, vend) > 0) == end.ccw()) + if ((cross2(vproj, vend) > 0) == end.ccw()) // Make the radius of a minor arc positive. out.second[1].radius *= -1.f; }