Skip to content

Commit 60b27d6

Browse files
committed
Fix comment and simplify code
CURA-12340
1 parent d21af14 commit 60b27d6

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

include/PathOrderOptimizer.h

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -738,29 +738,26 @@ class PathOrderOptimizer
738738

739739
BestElementFinder::WeighedCriterion main_criterion;
740740

741-
if (path.force_start_index_.has_value()) // Actually handles EZSeamType::USER_SPECIFIED
741+
if (path.force_start_index_.has_value()) // Handles EZSeamType::USER_SPECIFIED with "seam_on_vertex" disabled
742742
{
743743
// Use a much smaller distance divider because we want points around the forced points to be filtered out very easily
744744
constexpr double distance_divider = 1.0;
745745
constexpr auto distance_type = DistanceScoringCriterion::DistanceType::Euclidian;
746746
main_criterion.criterion = std::make_shared<DistanceScoringCriterion>(points, points.at(path.force_start_index_.value()), distance_type, distance_divider);
747747
}
748-
else
748+
else if (path.seam_config_.type_ == EZSeamType::SHORTEST || path.seam_config_.type_ == EZSeamType::USER_SPECIFIED)
749749
{
750-
if (path.seam_config_.type_ == EZSeamType::SHORTEST || path.seam_config_.type_ == EZSeamType::USER_SPECIFIED)
751-
{
752-
main_criterion.criterion = std::make_shared<DistanceScoringCriterion>(points, target_pos);
753-
}
754-
else if (
755-
path.seam_config_.type_ == EZSeamType::SHARPEST_CORNER
756-
&& (path.seam_config_.corner_pref_ != EZSeamCornerPrefType::Z_SEAM_CORNER_PREF_NONE && path.seam_config_.corner_pref_ != EZSeamCornerPrefType::PLUGIN))
757-
{
758-
main_criterion.criterion = std::make_shared<CornerScoringCriterion>(points, path.seam_config_.corner_pref_);
759-
}
760-
else if (path.seam_config_.type_ == EZSeamType::RANDOM)
761-
{
762-
main_criterion.criterion = std::make_shared<RandomScoringCriterion>();
763-
}
750+
main_criterion.criterion = std::make_shared<DistanceScoringCriterion>(points, target_pos);
751+
}
752+
else if (
753+
path.seam_config_.type_ == EZSeamType::SHARPEST_CORNER
754+
&& (path.seam_config_.corner_pref_ != EZSeamCornerPrefType::Z_SEAM_CORNER_PREF_NONE && path.seam_config_.corner_pref_ != EZSeamCornerPrefType::PLUGIN))
755+
{
756+
main_criterion.criterion = std::make_shared<CornerScoringCriterion>(points, path.seam_config_.corner_pref_);
757+
}
758+
else if (path.seam_config_.type_ == EZSeamType::RANDOM)
759+
{
760+
main_criterion.criterion = std::make_shared<RandomScoringCriterion>();
764761
}
765762

766763
if (main_criterion.criterion)

0 commit comments

Comments
 (0)