From f27999e1360df10af470892e0876c8f9cda5b189 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Wed, 1 Apr 2020 16:47:35 +0200 Subject: [PATCH] Follow-up of cfb6ac76fc643bc95911580b69929f6b9c27f60b - Another attempt to fix the build on AppleClang (std::array in lambdas) --- src/libslic3r/GCodeTimeEstimator.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/libslic3r/GCodeTimeEstimator.cpp b/src/libslic3r/GCodeTimeEstimator.cpp index 833421d14ad..51293ed174e 100644 --- a/src/libslic3r/GCodeTimeEstimator.cpp +++ b/src/libslic3r/GCodeTimeEstimator.cpp @@ -981,13 +981,15 @@ namespace Slic3r { return current_absolute_position; }; - auto move_length = [](const std::array& delta_pos) { - float xyz_length = std::sqrt(sqr(delta_pos[(size_t)X]) + sqr(delta_pos[(size_t)Y]) + sqr(delta_pos[(size_t)Z])); - return (xyz_length > 0.0f) ? xyz_length : std::abs(delta_pos[(size_t)E]); + // delta_pos must have size >= 4 + auto move_length = [](const float* delta_pos) { + float xyz_length = std::sqrt(sqr(delta_pos[X]) + sqr(delta_pos[Y]) + sqr(delta_pos[Z])); + return (xyz_length > 0.0f) ? xyz_length : std::abs(delta_pos[E]); }; - auto is_extruder_only_move = [](const std::array& delta_pos) { - return (delta_pos[(size_t)X] == 0.0f) && (delta_pos[(size_t)Y] == 0.0f) && (delta_pos[(size_t)Z] == 0.0f) && (delta_pos[(size_t)E] != 0.0f); + // delta_pos must have size >= 4 + auto is_extruder_only_move = [](const float* delta_pos) { + return (delta_pos[X] == 0.0f) && (delta_pos[Y] == 0.0f) && (delta_pos[Z] == 0.0f) && (delta_pos[E] != 0.0f); }; PROFILE_FUNC(); @@ -1023,7 +1025,7 @@ namespace Slic3r { // calculates block feedrate m_curr.feedrate = std::max(get_feedrate(), (delta_pos[E] == 0.0f) ? get_minimum_travel_feedrate() : get_minimum_feedrate()); - block.distance = move_length(delta_pos); + block.distance = move_length(delta_pos.data()); float invDistance = 1.0f / block.distance; float min_feedrate_factor = 1.0f; @@ -1050,7 +1052,7 @@ namespace Slic3r { } // calculates block acceleration - float acceleration = is_extruder_only_move(delta_pos) ? get_retract_acceleration() : get_acceleration(); + float acceleration = is_extruder_only_move(delta_pos.data()) ? get_retract_acceleration() : get_acceleration(); for (unsigned char a = X; a < Num_Axis; ++a) {