Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CURA-12340 Seam on vertex does not work as expected with user defined #2189

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
{
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
Loading