Skip to content

Commit

Permalink
Applied code suggestion by @casperlamboo
Browse files Browse the repository at this point in the history
  • Loading branch information
wawanbreton committed Oct 9, 2023
1 parent edd9b39 commit 0c757cb
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions include/PathOrderOptimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <range/v3/view/enumerate.hpp>
#include <range/v3/view/filter.hpp>
#include <range/v3/view/reverse.hpp>
#include <range/v3/view/drop_last.hpp>
#include <spdlog/spdlog.h>

#include <unordered_set>
Expand Down Expand Up @@ -649,14 +650,8 @@ class PathOrderOptimizer

size_t best_i;
float best_score = std::numeric_limits<float>::infinity();
for (const auto& [i, here] : **path.converted | ranges::views::enumerate)
for (const auto& [i, here] : **path.converted | ranges::views::drop_last(1) | ranges::views::enumerate)
{
if (i == path.converted->size() - 1)
{
// The path is closed so the last point is the same as the first, don't process it twice
continue;
}

// For most seam types, the shortest distance matters. Not for SHARPEST_CORNER though.
// For SHARPEST_CORNER, use a fixed starting score of 0.
const coord_t distance = (combing_boundary == nullptr) ? getDirectDistance(here, target_pos) : getCombingDistance(here, target_pos);
Expand Down

0 comments on commit 0c757cb

Please sign in to comment.