mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 06:35:58 +08:00
Add fallback to rear seam picker chosing the point with biggest y
This commit is contained in:
parent
26b96c5ad2
commit
6cc7ff754c
@ -131,7 +131,7 @@ Params Placer::get_params(const DynamicPrintConfig &config) {
|
||||
params.staggered_inner_seams = config.opt_bool("staggered_inner_seams");
|
||||
|
||||
params.max_nearest_detour = 1.0;
|
||||
params.rear_tolerance = 0.2;
|
||||
params.rear_tolerance = 1.0;
|
||||
params.rear_y_offset = 20;
|
||||
params.aligned.jump_visibility_threshold = 0.6;
|
||||
params.max_distance = 5.0;
|
||||
|
@ -59,16 +59,28 @@ struct RearestPointCalculator {
|
||||
const Vec2d prefered_position{center_x, bounding_box.max.y() + rear_y_offset};
|
||||
auto [_, line_index, point] = possible_distancer.distance_from_lines_extra<false>(prefered_position);
|
||||
const Vec2d location_at_bb{center_x, bounding_box.max.y()};
|
||||
auto [_d, line_index_at_bb, point_at_bb] = possible_distancer.distance_from_lines_extra<false>(location_at_bb);
|
||||
const double y_distance{point.y() - point_at_bb.y()};
|
||||
auto [_d, line_index_at_bb, point_bb] = possible_distancer.distance_from_lines_extra<false>(location_at_bb);
|
||||
const double y_distance{point.y() - point_bb.y()};
|
||||
|
||||
Vec2d result{point};
|
||||
if (y_distance < 0) {
|
||||
result = point_at_bb;
|
||||
result = point_bb;
|
||||
} else if (y_distance <= rear_tolerance) {
|
||||
const double factor{y_distance / rear_tolerance};
|
||||
result = factor * point + (1 - factor) * point_at_bb;
|
||||
result = factor * point + (1 - factor) * point_bb;
|
||||
}
|
||||
|
||||
if (bounding_box.max.y() - result.y() > rear_tolerance) {
|
||||
for (const PerimeterLine &line : possible_lines) {
|
||||
if (line.a.y() > result.y()) {
|
||||
result = line.a;
|
||||
}
|
||||
if (line.b.y() > result.y()) {
|
||||
result = line.b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SeamChoice{possible_lines[line_index].previous_index, possible_lines[line_index].next_index, result};
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user