FIX: tighten the scarf angle detection strategy
Jira: none BBS: get scarf seam angle detection from OrcaSlicer, thanks SoftFever original msg: Scarf joint seam enhancement: conditional scarf joint and slowdown for scarf joint only allow apply scarf joint seams to perimeters without sharp corners only Signed-off-by: qing.zhang <qing.zhang@bambulab.com> Change-Id: I07f8083ad07b5eb55901ab76824b12549dbac2ee (cherry picked from commit 3a032d9aefb936ba757105c4183cd2f8aeaeadd6)
This commit is contained in:
parent
12ed0626a3
commit
5ae2f68d7b
|
@ -468,13 +468,32 @@ bool ExtrusionLoop::check_seam_point_angle(double angle_threshold, double min_ar
|
||||||
idx_next = Slic3r::next_idx_modulo(idx_next, points.size());
|
idx_next = Slic3r::next_idx_modulo(idx_next, points.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate angle between idx_prev, idx_curr, idx_next.
|
//thanks orca
|
||||||
const Point &p0 = points[idx_prev];
|
for (size_t _i = 0; _i < points.size(); ++_i) {
|
||||||
const Point &p1 = points[idx_curr];
|
// pull idx_prev to current as much as possible, while respecting the min_arm_length
|
||||||
const Point &p2 = points[idx_next];
|
while (distance_to_prev - lengths[idx_prev] > min_arm_length) {
|
||||||
const auto a = angle(p0 - p1, p2 - p1);
|
distance_to_prev -= lengths[idx_prev];
|
||||||
if (a > 0 ? a < angle_threshold : a > -angle_threshold) {
|
idx_prev = Slic3r::next_idx_modulo(idx_prev, points.size());
|
||||||
return false;
|
}
|
||||||
|
|
||||||
|
// push idx_next forward as far as needed
|
||||||
|
while (distance_to_next < min_arm_length) {
|
||||||
|
distance_to_next += lengths[idx_next];
|
||||||
|
idx_next = Slic3r::next_idx_modulo(idx_next, points.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate angle between idx_prev, idx_curr, idx_next.
|
||||||
|
const Point &p0 = points[idx_prev];
|
||||||
|
const Point &p1 = points[idx_curr];
|
||||||
|
const Point &p2 = points[idx_next];
|
||||||
|
const auto a = angle(p0 - p1, p2 - p1);
|
||||||
|
if (a > 0 ? a < angle_threshold : a > -angle_threshold) { return false; }
|
||||||
|
|
||||||
|
// increase idx_curr by one
|
||||||
|
float curr_distance = lengths[idx_curr];
|
||||||
|
idx_curr++;
|
||||||
|
distance_to_prev += curr_distance;
|
||||||
|
distance_to_next -= curr_distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue