Skip to content

Commit

Permalink
Fix comment and simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
wawanbreton committed Dec 17, 2024
1 parent d21af14 commit 60b27d6
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions include/PathOrderOptimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -738,29 +738,26 @@ class PathOrderOptimizer

BestElementFinder::WeighedCriterion main_criterion;

if (path.force_start_index_.has_value()) // Actually handles EZSeamType::USER_SPECIFIED
if (path.force_start_index_.has_value()) // Handles EZSeamType::USER_SPECIFIED with "seam_on_vertex" disabled
{
// Use a much smaller distance divider because we want points around the forced points to be filtered out very easily
constexpr double distance_divider = 1.0;
constexpr auto distance_type = DistanceScoringCriterion::DistanceType::Euclidian;
main_criterion.criterion = std::make_shared<DistanceScoringCriterion>(points, points.at(path.force_start_index_.value()), distance_type, distance_divider);
}
else
else if (path.seam_config_.type_ == EZSeamType::SHORTEST || path.seam_config_.type_ == EZSeamType::USER_SPECIFIED)
{
if (path.seam_config_.type_ == EZSeamType::SHORTEST || path.seam_config_.type_ == EZSeamType::USER_SPECIFIED)
{
main_criterion.criterion = std::make_shared<DistanceScoringCriterion>(points, target_pos);
}
else if (
path.seam_config_.type_ == EZSeamType::SHARPEST_CORNER
&& (path.seam_config_.corner_pref_ != EZSeamCornerPrefType::Z_SEAM_CORNER_PREF_NONE && path.seam_config_.corner_pref_ != EZSeamCornerPrefType::PLUGIN))
{
main_criterion.criterion = std::make_shared<CornerScoringCriterion>(points, path.seam_config_.corner_pref_);
}
else if (path.seam_config_.type_ == EZSeamType::RANDOM)
{
main_criterion.criterion = std::make_shared<RandomScoringCriterion>();
}
main_criterion.criterion = std::make_shared<DistanceScoringCriterion>(points, target_pos);
}
else if (
path.seam_config_.type_ == EZSeamType::SHARPEST_CORNER
&& (path.seam_config_.corner_pref_ != EZSeamCornerPrefType::Z_SEAM_CORNER_PREF_NONE && path.seam_config_.corner_pref_ != EZSeamCornerPrefType::PLUGIN))
{
main_criterion.criterion = std::make_shared<CornerScoringCriterion>(points, path.seam_config_.corner_pref_);
}
else if (path.seam_config_.type_ == EZSeamType::RANDOM)
{
main_criterion.criterion = std::make_shared<RandomScoringCriterion>();
}

if (main_criterion.criterion)
Expand Down

0 comments on commit 60b27d6

Please sign in to comment.