diff options
author | enricoturri1966 <enricoturri@seznam.cz> | 2021-01-07 12:11:50 +0300 |
---|---|---|
committer | enricoturri1966 <enricoturri@seznam.cz> | 2021-04-12 15:09:05 +0300 |
commit | 096022ebcfed8ea166b6354817ecfa2fa970bc4e (patch) | |
tree | cc4fc4dfbe25dbea83475df5671c3ba86048c007 | |
parent | 91fdb67cd726f280948ffdced65333f6c6625383 (diff) |
Small refactoring in GCodeViewer::load_toolpaths()
-rw-r--r-- | src/slic3r/GUI/GCodeViewer.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 1ae184447..6ecbcf280 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -1053,7 +1053,7 @@ void GCodeViewer::load_toolpaths(const GCodeProcessor::Result& gcode_result) // format data into the buffers to be rendered as lines auto add_vertices_as_line = [](const GCodeProcessor::MoveVertex& prev, const GCodeProcessor::MoveVertex& curr, - TBuffer& buffer, std::vector<float>& buffer_vertices) { + std::vector<float>& buffer_vertices) { // x component of the normal to the current segment (the normal is parallel to the XY plane) float normal_x = (curr.position - prev.position).normalized()[1]; @@ -1413,7 +1413,7 @@ void GCodeViewer::load_toolpaths(const GCodeProcessor::Result& gcode_result) break; } case TBuffer::ERenderPrimitiveType::Line: { - add_vertices_as_line(prev, curr, buffer, buffer_vertices); + add_vertices_as_line(prev, curr, buffer_vertices); break; } case TBuffer::ERenderPrimitiveType::Triangle: { @@ -1422,11 +1422,9 @@ void GCodeViewer::load_toolpaths(const GCodeProcessor::Result& gcode_result) } } - EMoveType type = buffer_type(id); - if (type == EMoveType::Pause_Print || type == EMoveType::Custom_GCode) { + if (curr.type == EMoveType::Pause_Print || curr.type == EMoveType::Custom_GCode) { const float* const last_z = options_zs.empty() ? nullptr : &options_zs.back(); - float z = static_cast<double>(curr.position[2]); - if (last_z == nullptr || z < *last_z - EPSILON || *last_z + EPSILON < z) + if (last_z == nullptr || curr.position[2] < *last_z - EPSILON || *last_z + EPSILON < curr.position[2]) options_zs.emplace_back(curr.position[2]); } } |