Follow-up of 0e173e3f82
- Further code optimization
This commit is contained in:
parent
39fa0b3c46
commit
337d7ffaf6
1 changed files with 4 additions and 9 deletions
|
@ -1492,14 +1492,14 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
|
|||
std::vector<float> options_zs;
|
||||
|
||||
size_t seams_count = 0;
|
||||
std::vector<size_t> seams_ids;
|
||||
std::vector<size_t> biased_seams_ids;
|
||||
|
||||
// toolpaths data -> extract vertices from result
|
||||
for (size_t i = 0; i < m_moves_count; ++i) {
|
||||
const GCodeProcessorResult::MoveVertex& curr = gcode_result.moves[i];
|
||||
if (curr.type == EMoveType::Seam) {
|
||||
++seams_count;
|
||||
seams_ids.push_back(i);
|
||||
biased_seams_ids.push_back(i - biased_seams_ids.size() - 1);
|
||||
}
|
||||
|
||||
size_t move_id = i - seams_count;
|
||||
|
@ -1578,7 +1578,7 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
|
|||
}
|
||||
|
||||
// smooth toolpaths corners for the given TBuffer using triangles
|
||||
auto smooth_triangle_toolpaths_corners = [&gcode_result, &seams_ids](const TBuffer& t_buffer, MultiVertexBuffer& v_multibuffer) {
|
||||
auto smooth_triangle_toolpaths_corners = [&gcode_result, &biased_seams_ids](const TBuffer& t_buffer, MultiVertexBuffer& v_multibuffer) {
|
||||
auto extract_position_at = [](const VertexBuffer& vertices, size_t offset) {
|
||||
return Vec3f(vertices[offset + 0], vertices[offset + 1], vertices[offset + 2]);
|
||||
};
|
||||
|
@ -1652,11 +1652,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
|
|||
}
|
||||
};
|
||||
|
||||
std::vector<size_t> biased_seams_ids(seams_ids.size());
|
||||
for (size_t i = 0; i < seams_ids.size(); ++i) {
|
||||
biased_seams_ids[i] = seams_ids[i] - i - 1;
|
||||
}
|
||||
|
||||
auto extract_move_id = [&biased_seams_ids](size_t id) {
|
||||
size_t new_id = -1;
|
||||
auto it = std::lower_bound(biased_seams_ids.begin(), biased_seams_ids.end(), id);
|
||||
|
@ -1751,7 +1746,7 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
|
|||
}
|
||||
|
||||
// dismiss, no more needed
|
||||
std::vector<size_t>().swap(seams_ids);
|
||||
std::vector<size_t>().swap(biased_seams_ids);
|
||||
|
||||
for (MultiVertexBuffer& v_multibuffer : vertices) {
|
||||
for (VertexBuffer& v_buffer : v_multibuffer) {
|
||||
|
|
Loading…
Reference in a new issue